Kaynağa Gözat

Fix FW update needed button order

D.R.racer 2 yıl önce
ebeveyn
işleme
87ed42ba9b

+ 1 - 1
Firmware/mmu2/errors_list.h

@@ -330,7 +330,7 @@ static const uint8_t errorButtons[] PROGMEM = {
     Btns(ButtonOperations::Unload, ButtonOperations::Continue),
     Btns(ButtonOperations::StopPrint, ButtonOperations::RestartMMU),
     Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
-    Btns(ButtonOperations::NoOperation, ButtonOperations::DisableMMU),
+    Btns(ButtonOperations::DisableMMU, ButtonOperations::NoOperation),
     Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
     Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
 };

+ 5 - 1
Firmware/mmu2_error_converter.cpp

@@ -29,6 +29,9 @@ static constexpr uint8_t FindErrorIndex(uint16_t pec) {
 
 // check that the searching algoritm works
 static_assert( FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_TRIGGER) == 0);
+static_assert( FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_GO_OFF) == 1);
+static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER) == 2);
+static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_GO_OFF) == 3);
 
 uint8_t PrusaErrorCodeIndex(uint16_t ec) {
     switch (ec) {
@@ -132,7 +135,8 @@ uint8_t PrusaErrorButtons(uint8_t i){
 }
 
 const char * const PrusaErrorButtonTitle(uint8_t bi){
-    return (const char * const)pgm_read_ptr(btnOperation + bi);
+    // -1 represents the hidden NoOperation button which is not drawn in any way
+    return (const char * const)pgm_read_ptr(btnOperation + bi - 1);
 }
 
 const char * const PrusaErrorButtonMore(){

+ 2 - 2
Firmware/mmu2_reporting.cpp

@@ -56,8 +56,8 @@ back_to_choices:
         NULL, // NULL, since title screen is not in PROGMEM
         false,
         two_choices ? LEFT_BUTTON_CHOICE : MIDDLE_BUTTON_CHOICE,
-        _T(PrusaErrorButtonTitle(button_low_nibble - 1)),
-        _T(two_choices ? PrusaErrorButtonMore() : PrusaErrorButtonTitle(button_high_nibble - 1)),
+        _T(PrusaErrorButtonTitle(button_low_nibble)),
+        _T(two_choices ? PrusaErrorButtonMore() : PrusaErrorButtonTitle(button_high_nibble)),
         two_choices ? nullptr : _T(PrusaErrorButtonMore()),
         two_choices ? 
             10 // If two choices, allow the first choice to have more characters