Fix double feedback in First Layer Calibration

For MMU users: This happens when the user
selects a filament to load from 1 to 5

For non-MMU: this happens when clicking
the knob within 2 seconds.

Additionally fixed the code indendation
it was a mix of spaces and tabs
This commit is contained in:
Guðni Már Gilbert 2023-04-15 09:34:25 +00:00 committed by Alex Voinea
parent e516d8a0c4
commit b6e228d5a5
No known key found for this signature in database
GPG Key ID: 37EDFD565CB33BAD
1 changed files with 29 additions and 32 deletions

View File

@ -3607,46 +3607,38 @@ void lcd_first_layer_calibration_reset()
} }
void lcd_v2_calibration() void lcd_v2_calibration() {
{ if (MMU2::mmu2.Enabled()) {
if (MMU2::mmu2.Enabled()) const uint8_t filament = choose_menu_P(
{ _T(MSG_SELECT_FILAMENT),
const uint8_t filament = choose_menu_P( _T(MSG_FILAMENT),(_T(MSG_CANCEL)+1)); //Hack to reuse MSG but strip 1st char off
_T(MSG_SELECT_FILAMENT), if (filament < MMU_FILAMENT_COUNT) {
_T(MSG_FILAMENT),(_T(MSG_CANCEL)+1)); //Hack to reuse MSG but strip 1st char off lay1cal_filament = filament;
if (filament < 5) } else {
{ menu_back();
lay1cal_filament = filament; return;
} }
else
{
menu_back();
return;
}
} }
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
else if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) else if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE))
{ {
bool loaded = false; bool loaded = false;
if (fsensor.isReady()) if (fsensor.isReady()) {
{ loaded = fsensor.getFilamentPresent();
loaded = fsensor.getFilamentPresent(); } else {
} loaded = !lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_LOADED), false, LCD_MIDDLE_BUTTON_CHOICE);
else lcd_update_enabled = true;
{ }
loaded = !lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_LOADED), false, LCD_MIDDLE_BUTTON_CHOICE);
lcd_update_enabled = true;
} if (!loaded) {
if (!loaded)
{
lcd_display_message_fullscreen_P(_i("Please load filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 lcd_display_message_fullscreen_P(_i("Please load filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4
lcd_consume_click(); lcd_consume_click();
for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s
delay_keep_alive(100); delay_keep_alive(100);
if (lcd_clicked()) { if (LCD_CLICKED) {
// Click event is consumed below when
// rendering the preheat menu. We use this
// to check whether a audio feedback should be shown
break; break;
} }
} }
@ -3658,7 +3650,12 @@ void lcd_v2_calibration()
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
eFilamentAction = FilamentAction::Lay1Cal; eFilamentAction = FilamentAction::Lay1Cal;
menu_goto(lcd_generic_preheat_menu, 0, true, true);
// Produce feedback if the LCD knob was not clicked
// Note for non-MMU setups there is a 2 second timeout in case
// the user does not click the knob, in such a case we want feedback
// since the firmware is changing the menu silently.
menu_goto(lcd_generic_preheat_menu, 0, true, !lcd_clicked());
} }
void lcd_wizard() { void lcd_wizard() {