diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 56319cbd0..93a0e9059 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -628,14 +628,8 @@ void MMU2::ReportError(ErrorCode ec) { void MMU2::ReportProgress(ProgressCode pc) { ReportProgressHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)pc); - // Log progress - example: MMU2:P=123 EngageIdler - char msg[64]; - int len = snprintf(msg, sizeof(msg), "MMU2:P=%hu ", (uint16_t)pc); - // Append a human readable form of the progress code - TranslateProgress((uint16_t)pc, &msg[len], 64 - len); - SERIAL_ECHO_START; - SERIAL_ECHOLN(msg); + SERIAL_ECHOLNRPGM( ProgressCodeToText((uint16_t)pc) ); } void MMU2::OnMMUProgressMsg(ProgressCode pc){ diff --git a/Firmware/mmu2/error_codes.h b/Firmware/mmu2/error_codes.h index 019b08950..385690a9b 100644 --- a/Firmware/mmu2/error_codes.h +++ b/Firmware/mmu2/error_codes.h @@ -38,10 +38,15 @@ enum class ErrorCode : uint_fast16_t { HOMING_SELECTOR_FAILED = HOMING_FAILED | TMC_SELECTOR_BIT, ///< E32903 the Selector was unable to home properly - that means something is blocking its movement 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 - - MOVE_FAILED = 0x8009, ///< generic move failed error - always reported with the corresponding axis bit set (Idler or Selector) as follows: + + FSENSOR_TOO_EARLY = 0x8009, ///< E32777 FSensor triggered while doing FastFeedToBondtech - that means either: + ///< - the PTFE is too short + ///< - a piece of filament was left inside - pushed in front of the loaded filament causing the fsensor trigger too early + ///< - fsensor is faulty producing bogus triggers + + MOVE_FAILED = 0x800a, ///< generic move failed error - always reported with the corresponding axis bit set (Idler or Selector) as follows: MOVE_SELECTOR_FAILED = MOVE_FAILED | TMC_SELECTOR_BIT, ///< E32905 the Selector was unable to move to desired position properly - that means something is blocking its movement, e.g. a piece of filament got out of pulley body MOVE_IDLER_FAILED = MOVE_FAILED | TMC_IDLER_BIT, ///< E33033 the Idler was unable to move - unused at the time of creation, but added for completeness MOVE_PULLEY_FAILED = MOVE_FAILED | TMC_PULLEY_BIT, ///< E32841 the Pulley was unable to move - unused at the time of creation, but added for completeness diff --git a/Firmware/mmu2/errors_list.h b/Firmware/mmu2/errors_list.h index 1b4f32074..f814d52fd 100644 --- a/Firmware/mmu2/errors_list.h +++ b/Firmware/mmu2/errors_list.h @@ -19,6 +19,7 @@ typedef enum : uint16_t { ERR_MECHANICAL_FINDA_DIDNT_GO_OFF, ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER, ERR_MECHANICAL_FSENSOR_DIDNT_GO_OFF, + ERR_MECHANICAL_FSENSOR_TOO_EARLY, ERR_MECHANICAL_PULLEY_CANNOT_MOVE = 105, ERR_MECHANICAL_SELECTOR_CANNOT_HOME = 115, @@ -79,6 +80,7 @@ static const constexpr uint16_t errorCodes[] PROGMEM = { ERR_MECHANICAL_FINDA_DIDNT_GO_OFF, ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER, ERR_MECHANICAL_FSENSOR_DIDNT_GO_OFF, + ERR_MECHANICAL_FSENSOR_TOO_EARLY, ERR_MECHANICAL_PULLEY_CANNOT_MOVE, ERR_MECHANICAL_SELECTOR_CANNOT_HOME, ERR_MECHANICAL_SELECTOR_CANNOT_MOVE, @@ -117,6 +119,7 @@ static const char titleFINDA_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("FINDA DIDNT TRIG static const char titleFINDA_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("FINDA DIDNT GO OFF"); static const char titleFSENSOR_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("FSENSOR DIDNT TRIGGER"); static const char titleFSENSOR_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("FSENSOR DIDNT GO OFF"); +static const char titleFSENSOR_TOO_EARLY[] PROGMEM_I1 = ISTR("FSENSOR TOO EARLY"); static const char titlePULLEY_CANNOT_MOVE[] PROGMEM_I1 = ISTR("PULLEY CANNOT MOVE"); static const char titleSELECTOR_CANNOT_MOVE[] PROGMEM_I1 = ISTR("SELECTOR CANNOT MOVE"); static const char titleSELECTOR_CANNOT_HOME[] PROGMEM_I1 = ISTR("SELECTOR CANNOT HOME"); @@ -154,6 +157,7 @@ static const char * const errorTitles [] PROGMEM = { titleFINDA_DIDNT_GO_OFF, titleFSENSOR_DIDNT_TRIGGER, titleFSENSOR_DIDNT_GO_OFF, + titleFSENSOR_TOO_EARLY, titlePULLEY_CANNOT_MOVE, titleSELECTOR_CANNOT_HOME, titleSELECTOR_CANNOT_MOVE, @@ -192,6 +196,7 @@ static const char descFINDA_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("FINDA didn't trig static const char descFINDA_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("FINDA didn't switch off while unloading filament. Try unloading manually. Ensure filament can move and FINDA works."); static const char descFSENSOR_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("Filament sensor didn't trigger while loading filament. Ensure filament reached the fsensor and the sensor works."); static const char descFSENSOR_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("Filament sensor didn't switch off while unloading filament. Ensure filament can move and the sensor works."); +static const char descFSENSOR_TOO_EARLY[] PROGMEM_I1 = ISTR("Filament sensor triggered too early."); static const char descPULLEY_STALLED[] PROGMEM_I1 = ISTR("The Pulley motor stalled - Ensure the pulley can move and check the wiring."); static const char descSELECTOR_CANNOT_HOME[] PROGMEM_I1 = ISTR("The Selector cannot home properly - check for anything blocking its movement."); static const char descSELECTOR_CANNOT_MOVE[] PROGMEM_I1 = ISTR("The Selector cannot move - check for anything blocking its movement. Check the wiring is correct."); @@ -229,6 +234,7 @@ static const char * const errorDescs[] PROGMEM = { descFINDA_DIDNT_GO_OFF, descFSENSOR_DIDNT_TRIGGER, descFSENSOR_DIDNT_GO_OFF, + descFSENSOR_TOO_EARLY, descPULLEY_STALLED, descSELECTOR_CANNOT_HOME, descSELECTOR_CANNOT_MOVE, @@ -298,6 +304,7 @@ static const uint8_t errorButtons[] PROGMEM = { Btns(ButtonOperations::Retry, ButtonOperations::NoOperation), Btns(ButtonOperations::Retry, ButtonOperations::NoOperation), Btns(ButtonOperations::Retry, ButtonOperations::NoOperation), + Btns(ButtonOperations::Retry, ButtonOperations::NoOperation), Btns(ButtonOperations::Retry, ButtonOperations::NoOperation), Btns(ButtonOperations::Retry, ButtonOperations::NoOperation), diff --git a/Firmware/mmu2_error_converter.cpp b/Firmware/mmu2_error_converter.cpp index 3485b8490..153811930 100644 --- a/Firmware/mmu2_error_converter.cpp +++ b/Firmware/mmu2_error_converter.cpp @@ -43,17 +43,25 @@ uint8_t PrusaErrorCodeIndex(uint16_t ec) { return FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER); case (uint16_t)ErrorCode::FSENSOR_DIDNT_SWITCH_OFF: return FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_GO_OFF); + case (uint16_t)ErrorCode::FSENSOR_TOO_EARLY: + return FindErrorIndex(ERR_MECHANICAL_FSENSOR_TOO_EARLY); + case (uint16_t)ErrorCode::STALLED_PULLEY: case (uint16_t)ErrorCode::MOVE_PULLEY_FAILED: return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE); + case (uint16_t)ErrorCode::HOMING_SELECTOR_FAILED: return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME); case (uint16_t)ErrorCode::MOVE_SELECTOR_FAILED: return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE); + case (uint16_t)ErrorCode::HOMING_IDLER_FAILED: return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME); - case (uint16_t)ErrorCode::MMU_NOT_RESPONDING: + case (uint16_t)ErrorCode::MOVE_IDLER_FAILED: return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE); + + case (uint16_t)ErrorCode::MMU_NOT_RESPONDING: + return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING); case (uint16_t)ErrorCode::PROTOCOL_ERROR: return FindErrorIndex(ERR_CONNECT_COMMUNICATION_ERROR); case (uint16_t)ErrorCode::FILAMENT_ALREADY_LOADED: diff --git a/Firmware/mmu2_power.cpp b/Firmware/mmu2_power.cpp index b9ce75ed6..7096358e4 100644 --- a/Firmware/mmu2_power.cpp +++ b/Firmware/mmu2_power.cpp @@ -16,10 +16,8 @@ void reset() { WRITE(MMU_RST_PIN, 0); _delay_us(100); WRITE(MMU_RST_PIN, 1); -#else // SW - send X0 command - // mmu_puts_P(PSTR("X0\n")); - #error todo send command if hardware pin not available #endif + // otherwise HW reset is not available } } // namespace MMU2 diff --git a/Firmware/mmu2_progress_converter.cpp b/Firmware/mmu2_progress_converter.cpp index edebef331..2e1a6d5ef 100644 --- a/Firmware/mmu2_progress_converter.cpp +++ b/Firmware/mmu2_progress_converter.cpp @@ -30,6 +30,8 @@ static const char progressParkSelector[] PROGMEM_I1 = ISTR("Parking selector"); static const char progressEjectFilament[] PROGMEM_I1 = ISTR("Ejecting filament"); static const char progressRetractFinda[] PROGMEM_I1 = ISTR("Retracting from FINDA"); static const char progressHoming[] PROGMEM_I1 = ISTR("Homing"); +static const char progressMovingSelector[] PROGMEM_I1 = ISTR("Moving selector"); +static const char progressFeedingToFSensor[] PROGMEM_I1 = ISTR("FeedingToFSensor"); static const char * const progressTexts[] PROGMEM = { progressOk, @@ -59,15 +61,15 @@ static const char * const progressTexts[] PROGMEM = { progressEjectFilament, progressRetractFinda, progressHoming, + progressMovingSelector, + progressFeedingToFSensor }; const char * const ProgressCodeToText(uint16_t pc){ // @@TODO ?? a better fallback option? - return ( pc <= 26 ) ? static_cast(pgm_read_ptr(&progressTexts[pc])) : static_cast(pgm_read_ptr(&progressTexts[0])); -} - -void TranslateProgress(uint16_t pc, char *dst, size_t dstSize) { - strncpy_P(dst, ProgressCodeToText(pc), dstSize); // @@TODO temporarily to prevent removal of the texts at LTO + return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) ) + ? static_cast(pgm_read_ptr(&progressTexts[pc])) + : static_cast(pgm_read_ptr(&progressTexts[0])); } } // namespace MMU2 diff --git a/Firmware/mmu2_progress_converter.h b/Firmware/mmu2_progress_converter.h index 97fd344b8..72dcc031b 100644 --- a/Firmware/mmu2_progress_converter.h +++ b/Firmware/mmu2_progress_converter.h @@ -3,5 +3,7 @@ #include namespace MMU2 { -void TranslateProgress(uint16_t pc, char *dst, size_t dstSize); + +const char * const ProgressCodeToText(uint16_t pc); + }