From 9479ec32f7e7a811c1946a142fcb00e538bf87e2 Mon Sep 17 00:00:00 2001 From: Ludy Date: Sat, 10 Aug 2019 07:53:26 +0200 Subject: [PATCH] Fix Service Menu compile error (#14903) --- Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/lcd/language/language_de.h | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 4 +- Marlin/src/lcd/menu/menu_service.cpp | 60 ++++++++++++++-------- buildroot/share/tests/megaatmega2560-tests | 17 +++--- 5 files changed, 51 insertions(+), 34 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index da099fffa..9d6706b99 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -567,7 +567,7 @@ #define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define HAS_LEDS_OFF_FLAG (BOTH(PRINTER_EVENT_LEDS, SDSUPPORT) && HAS_RESUME_CONTINUE) #define HAS_PRINT_PROGRESS EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) -#define HAS_SERVICE_INTERVALS (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0) +#define HAS_SERVICE_INTERVALS (ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)) #define HAS_FILAMENT_SENSOR ENABLED(FILAMENT_RUNOUT_SENSOR) #define Z_MULTI_STEPPER_DRIVERS EITHER(Z_DUAL_STEPPER_DRIVERS, Z_TRIPLE_STEPPER_DRIVERS) diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 3f81b45f0..6122383f5 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -287,7 +287,7 @@ #define MSG_BUTTON_INIT _UxGT("Bestätigen") #define MSG_BUTTON_STOP _UxGT("Stop") #define MSG_BUTTON_PRINT _UxGT("Drucken") -#define MSG_BUTTON_RESET _UxGT("Zurücksetzen") +#define MSG_BUTTON_RESET _UxGT("Reseten") #define MSG_BUTTON_CANCEL _UxGT("Abbrechen") #define MSG_BUTTON_DONE _UxGT("Fertig") #define MSG_PAUSE_PRINT _UxGT("SD-Druck pausieren") diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 081b208fd..8b0a40b6b 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -83,7 +83,7 @@ void menu_configuration(); void menu_mixer(); #endif -#if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER) +#if HAS_SERVICE_INTERVALS #if SERVICE_INTERVAL_1 > 0 void menu_service1(); #endif @@ -237,7 +237,7 @@ void menu_main() { } #endif // HAS_ENCODER_WHEEL && SDSUPPORT - #if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER) + #if HAS_SERVICE_INTERVALS #if SERVICE_INTERVAL_1 > 0 MENU_ITEM(submenu, SERVICE_NAME_1, menu_service1); #endif diff --git a/Marlin/src/lcd/menu/menu_service.cpp b/Marlin/src/lcd/menu/menu_service.cpp index 6eee17814..fb7f05c90 100644 --- a/Marlin/src/lcd/menu/menu_service.cpp +++ b/Marlin/src/lcd/menu/menu_service.cpp @@ -26,39 +26,57 @@ #include "../../inc/MarlinConfigPre.h" -#if HAS_LCD_MENU && HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER) +#if HAS_LCD_MENU && HAS_SERVICE_INTERVALS #include "menu.h" #include "../../module/printcounter.h" -inline void _menu_service(const int index, PGM_P const name) { - char sram[30]; - strncpy_P(sram, name, 29); - do_select_screen( - PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL), - []{ - print_job_timer.resetServiceInterval(index); - #if HAS_BUZZER - ui.completion_feedback(); - #endif - ui.reset_status(); - ui.return_to_status(); - }, - ui.goto_previous_screen, - PSTR(MSG_SERVICE_RESET), sram, PSTR("?") - ); +inline void _service_reset(const int index) { + print_job_timer.resetServiceInterval(index); + #if HAS_BUZZER + ui.completion_feedback(); + #endif + ui.reset_status(); + ui.return_to_status(); } #if SERVICE_INTERVAL_1 > 0 - void menu_service1() { _menu_service(1, PSTR(SERVICE_NAME_1)); } + void menu_service1() { + char sram[30]; + strncpy_P(sram, PSTR(SERVICE_NAME_1), 29); + do_select_screen( + PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL), + []{ _service_reset(1); }, + ui.goto_previous_screen, + PSTR(MSG_SERVICE_RESET), sram, PSTR("?") + ); + } #endif #if SERVICE_INTERVAL_2 > 0 - void menu_service2() { _menu_service(2, PSTR(SERVICE_NAME_2)); } + void menu_service2() { + char sram[30]; + strncpy_P(sram, PSTR(SERVICE_NAME_2), 29); + do_select_screen( + PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL), + []{ _service_reset(2); }, + ui.goto_previous_screen, + PSTR(MSG_SERVICE_RESET), sram, PSTR("?") + ); + } #endif #if SERVICE_INTERVAL_3 > 0 - void menu_service3() { _menu_service(3, PSTR(SERVICE_NAME_3)); } + void menu_service3() { + char sram[30]; + strncpy_P(sram, PSTR(SERVICE_NAME_3), 29); + do_select_screen( + PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL), + []{ _service_reset(3); }, + ui.goto_previous_screen, + PSTR(MSG_SERVICE_RESET), sram, PSTR("?") + ); + } #endif -#endif // HAS_LCD_MENU && HAS_SERVICE_INTERVALS && PRINTCOUNTER +#endif // HAS_LCD_MENU && HAS_SERVICE_INTERVALS diff --git a/buildroot/share/tests/megaatmega2560-tests b/buildroot/share/tests/megaatmega2560-tests index dd69f1c49..62d0f8711 100755 --- a/buildroot/share/tests/megaatmega2560-tests +++ b/buildroot/share/tests/megaatmega2560-tests @@ -93,18 +93,17 @@ exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD" # restore_configs opt_set MOTHERBOARD BOARD_MINIRAMBO -opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR G26_MESH_EDITING LCD_BED_LEVELING MESH_EDIT_MENU \ - EEPROM_SETTINGS EEPROM_CHITCHAT \ +opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT \ + ULTIMAKERCONTROLLER SDSUPPORT PCA9632 LCD_INFO_MENU \ + AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY LCD_BED_LEVELING G26_MESH_EDITING MESH_EDIT_MENU \ M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR \ - INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ - ULTIMAKERCONTROLLER SDSUPPORT \ - PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE PCA9632 \ - BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS \ - ADVANCED_PAUSE_FEATURE ADVANCED_PAUSE_CONTINUOUS_PURGE FILAMENT_LOAD_UNLOAD_GCODES PARK_HEAD_ON_PAUSE \ - LCD_INFO_MENU M114_DETAIL + INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS \ + NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE \ + ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE ADVANCED_PAUSE_CONTINUOUS_PURGE FILAMENT_LOAD_UNLOAD_GCODES \ + PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 M114_DETAIL opt_set PWM_MOTOR_CURRENT "{ 1300, 1300, 1250 }" opt_set I2C_SLAVE_ADDRESS 63 -exec_test $1 $2 "MINIRAMBO for PWM_MOTOR_CURRENT etc" +exec_test $1 $2 "MINIRAMBO with M100, PWM_MOTOR_CURRENT, PRINTCOUNTER, etc." # # Mixing Extruder with 5 steppers, Cyrillic