Fix bug with button choice on MMU error screen isn't reset
PFW-1381
This commit is contained in:
parent
d2f3835b2c
commit
a35e7d543f
|
|
@ -101,6 +101,7 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) {
|
||||||
uint8_t ret = 0;
|
uint8_t ret = 0;
|
||||||
bool two_choices = false;
|
bool two_choices = false;
|
||||||
static int8_t enc_dif = lcd_encoder_diff;
|
static int8_t enc_dif = lcd_encoder_diff;
|
||||||
|
static uint8_t reset_button_selection = 1;
|
||||||
|
|
||||||
if (lcd_encoder_diff == 0)
|
if (lcd_encoder_diff == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -123,6 +124,14 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) {
|
||||||
static int8_t current_selection = two_choices ? LCD_LEFT_BUTTON_CHOICE : LCD_MIDDLE_BUTTON_CHOICE;
|
static int8_t current_selection = two_choices ? LCD_LEFT_BUTTON_CHOICE : LCD_MIDDLE_BUTTON_CHOICE;
|
||||||
static int8_t choice_selected = -1;
|
static int8_t choice_selected = -1;
|
||||||
|
|
||||||
|
if (reset_button_selection) {
|
||||||
|
// If a new error screen is shown, we must reset the button selection
|
||||||
|
// Default selection is different depending on how many buttons are present
|
||||||
|
current_selection = two_choices ? LCD_LEFT_BUTTON_CHOICE : LCD_MIDDLE_BUTTON_CHOICE;
|
||||||
|
choice_selected = -1;
|
||||||
|
reset_button_selection = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if knob was rotated
|
// Check if knob was rotated
|
||||||
if (abs(enc_dif - lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP) {
|
if (abs(enc_dif - lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP) {
|
||||||
if (two_choices == false) { // third_choice is not nullptr, safe to dereference
|
if (two_choices == false) { // third_choice is not nullptr, safe to dereference
|
||||||
|
|
@ -203,9 +212,8 @@ static uint8_t ReportErrorHookMonitor(uint8_t ei) {
|
||||||
ret = 2;
|
ret = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset static variables to their default value
|
// Next MMU error screen should reset the choice selection
|
||||||
current_selection = two_choices ? LCD_LEFT_BUTTON_CHOICE : LCD_MIDDLE_BUTTON_CHOICE;
|
reset_button_selection = 1;
|
||||||
choice_selected = -1;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue