Skip to content

Commit

Permalink
Fix Service Menu compile error (MarlinFirmware#14903)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludy87 authored and thinkyhead committed Aug 10, 2019
1 parent a7f1021 commit 9479ec3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/language/language_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
60 changes: 39 additions & 21 deletions Marlin/src/lcd/menu/menu_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 8 additions & 9 deletions buildroot/share/tests/megaatmega2560-tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9479ec3

Please sign in to comment.