Update MK3S to match MMU PR#168

- new progress and error codes
- remove #error from mmu2_power.cpp as it makes no sense
- remove temporary error translation code
This commit is contained in:
D.R.racer 2022-05-23 09:21:02 +02:00
parent 33650c6e56
commit 8a92865969
7 changed files with 36 additions and 20 deletions

View File

@ -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){

View File

@ -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

View File

@ -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),

View File

@ -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:

View File

@ -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

View File

@ -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<const char * const>(pgm_read_ptr(&progressTexts[pc])) : static_cast<const char * const>(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<const char * const>(pgm_read_ptr(&progressTexts[pc]))
: static_cast<const char * const>(pgm_read_ptr(&progressTexts[0]));
}
} // namespace MMU2

View File

@ -3,5 +3,7 @@
#include <stddef.h>
namespace MMU2 {
void TranslateProgress(uint16_t pc, char *dst, size_t dstSize);
const char * const ProgressCodeToText(uint16_t pc);
}