From f064381f707daad9b384cb3396ac02853ca873ab Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Wed, 8 Jun 2022 10:58:34 +0200 Subject: [PATCH] Introduce NO_FINDA_BUT_EEPROM_HAS_FILAMENT error --- src/logic/error_codes.h | 3 ++- src/main.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/logic/error_codes.h b/src/logic/error_codes.h index 66734a7..8c2b460 100644 --- a/src/logic/error_codes.h +++ b/src/logic/error_codes.h @@ -39,7 +39,8 @@ enum class ErrorCode : uint_fast16_t { HOMING_IDLER_FAILED = HOMING_FAILED | TMC_IDLER_BIT, ///< E33031 the Idler was unable to home properly - that means something is blocking its movement STALLED_PULLEY = HOMING_FAILED | TMC_PULLEY_BIT, ///< E32839 for the Pulley "homing" means just stallguard detected during Pulley's operation (Pulley doesn't home) - FINDA_VS_EEPROM_DISREPANCY = 0x8008, ///< E32776 FINDA is pressed but we have no such record in EEPROM - this can only happen at the start of the MMU and can be resolved by issuing an Unload command + FINDA_PRESSED_BUT_NO_EEPROM_RECORD = 0x8008, ///< E32776 FINDA is pressed but we have no such record in EEPROM - this can only happen at the start of the MMU and can be resolved by issuing an Unload command + NO_FINDA_BUT_EEPROM_HAS_FILAMENT = 0x800b, ///< E32779 opposite scenario - FINDA not pressed but there is a filament record in the EEPROM. Resolve: Unload, Done (clears the EEPROM) FSENSOR_TOO_EARLY = 0x8009, ///< E32777 FSensor triggered while doing FastFeedToBondtech - that means either: ///< - the PTFE is too short diff --git a/src/main.cpp b/src/main.cpp index 769441f..ff1689d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -92,7 +92,15 @@ void setup() { // For this we speculatively set the active slot to 2 (in the middle ;) ) // Ideally this should be signalled as an error state and displayed on the printer and recovered properly. mg::globals.SetFilamentLoaded(2, mg::InFSensor); - logic::noCommand.SetInitError(ErrorCode::FINDA_VS_EEPROM_DISREPANCY); + logic::noCommand.SetInitError(ErrorCode::FINDA_PRESSED_BUT_NO_EEPROM_RECORD); + } + + if (!mf::finda.Pressed() && mg::globals.FilamentLoaded() >= mg::InSelector) { + // Opposite situation - not so dangerous, but definitely confusing to users. + // FINDA is not pressed but we have a record in the EEPROM. + // The user must tell us if there is filament (FINDA doesn't work correctly) + // or not (filament pulled out while the MMU was off - which is the usual case) + logic::noCommand.SetInitError(ErrorCode::NO_FINDA_BUT_EEPROM_HAS_FILAMENT); } /// Turn off all leds