Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x

This commit is contained in:
Bob-the-Kuhn
2019-04-25 12:06:01 -05:00
154 changed files with 1156 additions and 525 deletions

View File

@ -268,6 +268,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
#if HAS_GRAPHICAL_LCD
drawing_screen = false;
#endif
set_ui_selection(false);
}
}
@ -436,12 +438,21 @@ void _lcd_draw_homing() {
void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); }
#endif
void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
//
// Selection screen presents a prompt and two options
//
bool ui_selection; // = false
void set_ui_selection(const bool sel) { ui_selection = sel; }
void do_select_screen(PGM_P const yes, PGM_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string/*=NULL*/, PGM_P const suff/*=NULL*/) {
if (ui.encoderPosition) {
yesno = int16_t(ui.encoderPosition) > 0;
ui_selection = int16_t(ui.encoderPosition) > 0;
ui.encoderPosition = 0;
}
draw_select_screen(yes, no, yesno, pref, string, suff);
const bool got_click = ui.use_click();
if (got_click || ui.should_draw()) {
draw_select_screen(yes, no, ui_selection, pref, string, suff);
if (got_click) { ui_selection ? yesFunc() : noFunc(); }
}
}
#endif // HAS_LCD_MENU

View File

@ -65,12 +65,15 @@ DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 123
///////// Menu Item Draw Functions /////////
////////////////////////////////////////////
void draw_edit_screen(PGM_P const pstr, const char* const value=NULL);
typedef void (*selectFunc_t)();
void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff);
void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL);
inline void do_select_screen_yn(bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesno, pref, string, suff);
void set_ui_selection(const bool sel);
void do_select_screen(PGM_P const yes, PGM_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL);
inline void do_select_screen_yn(selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL) {
do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesFunc, noFunc, pref, string, suff);
}
void draw_edit_screen(PGM_P const pstr, const char* const value=NULL);
void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL);
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm);

View File

@ -604,16 +604,13 @@ void menu_backlash();
#include "../../module/configuration_store.h"
static void lcd_init_eeprom() {
ui.completion_feedback(settings.init_eeprom());
ui.goto_previous_screen();
}
static void lcd_init_eeprom_confirm() {
START_MENU();
MENU_BACK(MSG_ADVANCED_SETTINGS);
MENU_ITEM(function, MSG_INIT_EEPROM, lcd_init_eeprom);
END_MENU();
do_select_screen(
PSTR(MSG_BUTTON_INIT), PSTR(MSG_BUTTON_CANCEL),
[]{ ui.completion_feedback(settings.init_eeprom()); },
ui.goto_previous_screen,
PSTR(MSG_INIT_EEPROM), NULL, PSTR("?")
);
}
#endif

View File

@ -50,13 +50,6 @@ static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Pleas
static bool leveling_was_active = false;
#endif
static inline void _lcd_level_bed_corners_back() {
#if HAS_LEVELING
set_bed_leveling_enabled(leveling_was_active);
#endif
ui.goto_previous_screen_no_defer();
}
/**
* Level corners, starting in the front-left corner.
*/
@ -94,17 +87,23 @@ static inline void _lcd_goto_next_corner() {
}
static inline void menu_level_bed_corners() {
START_MENU();
MENU_ITEM(function,
#if ENABLED(LEVEL_CENTER_TOO)
MSG_LEVEL_BED_NEXT_POINT
#else
MSG_NEXT_CORNER
#endif
, _lcd_goto_next_corner
do_select_screen(
PSTR(MSG_BUTTON_NEXT), PSTR(MSG_BUTTON_DONE),
_lcd_goto_next_corner,
[]{
#if HAS_LEVELING
set_bed_leveling_enabled(leveling_was_active);
#endif
ui.goto_previous_screen_no_defer();
},
PSTR(
#if ENABLED(LEVEL_CENTER_TOO)
MSG_LEVEL_BED_NEXT_POINT
#else
MSG_NEXT_CORNER
#endif
), NULL, PSTR("?")
);
MENU_ITEM(function, MSG_BACK, _lcd_level_bed_corners_back);
END_MENU();
}
static inline void _lcd_level_bed_corners_homing() {
@ -112,6 +111,7 @@ static inline void _lcd_level_bed_corners_homing() {
if (all_axes_homed()) {
bed_corner = 0;
ui.goto_screen(menu_level_bed_corners);
set_ui_selection(true);
_lcd_goto_next_corner();
}
}

View File

@ -44,6 +44,8 @@ static void lcd_power_loss_recovery_cancel() {
ui.return_to_status();
}
// TODO: Display long filename with Cancel/Resume buttons
// Requires supporting methods in PLR class.
void menu_job_recovery() {
ui.defer_status_screen();
START_MENU();

View File

@ -101,10 +101,7 @@
}
void menu_abort_confirm() {
START_MENU();
MENU_BACK(MSG_MAIN);
MENU_ITEM(function, MSG_STOP_PRINT, lcd_abort_job);
END_MENU();
do_select_screen(PSTR(MSG_BUTTON_STOP), PSTR(MSG_BACK), lcd_abort_job, ui.goto_previous_screen, PSTR(MSG_STOP_PRINT), NULL, PSTR("?"));
}
#endif // MACHINE_CAN_STOP

View File

@ -250,17 +250,17 @@ void lcd_mixer_mix_edit() {
//
// Reset All V-Tools
//
inline void _lcd_reset_vtools() {
LCD_MESSAGEPGM(MSG_VTOOLS_RESET);
ui.return_to_status();
mixer.reset_vtools();
}
void menu_mixer_vtools_reset_confirm() {
START_MENU();
MENU_BACK(MSG_BACK);
MENU_ITEM(function, MSG_RESET_VTOOLS, _lcd_reset_vtools);
END_MENU();
do_select_screen(
PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL),
[]{
mixer.reset_vtools();
LCD_MESSAGEPGM(MSG_VTOOLS_RESET);
ui.return_to_status();
},
ui.goto_previous_screen,
PSTR(MSG_RESET_VTOOLS), NULL, PSTR("?")
);
}
void menu_mixer() {

View File

@ -81,17 +81,12 @@ inline void sdcard_start_selected_file() {
#if ENABLED(SD_MENU_CONFIRM_START)
bool do_print_file;
void menu_sd_confirm() {
if (ui.should_draw())
do_select_screen(PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL), do_print_file, PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?"));
if (ui.use_click()) {
if (do_print_file)
sdcard_start_selected_file();
else
ui.goto_previous_screen();
}
do_select_screen(
PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL),
sdcard_start_selected_file, ui.goto_previous_screen,
PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?")
);
}
#endif
@ -106,7 +101,6 @@ class MenuItem_sdfile {
sd_items = screen_items;
#endif
#if ENABLED(SD_MENU_CONFIRM_START)
do_print_file = false;
MenuItem_submenu::action(menu_sd_confirm);
#else
sdcard_start_selected_file();

View File

@ -31,52 +31,32 @@
#include "menu.h"
#include "../../module/printcounter.h"
inline void _lcd_reset_service(const int index) {
print_job_timer.resetServiceInterval(index);
BUZZ(200, 404);
ui.reset_status();
ui.return_to_status();
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);
ui.completion_feedback(true);
ui.reset_status();
ui.return_to_status();
},
ui.goto_previous_screen,
PSTR(MSG_SERVICE_RESET), sram, PSTR("?")
);
}
#if SERVICE_INTERVAL_1 > 0
void menu_action_reset_service1() { _lcd_reset_service(1); }
void menu_service1() { _menu_service(1, PSTR(SERVICE_NAME_1)); }
#endif
#if SERVICE_INTERVAL_2 > 0
void menu_action_reset_service2() { _lcd_reset_service(2); }
void menu_service2() { _menu_service(2, PSTR(SERVICE_NAME_2)); }
#endif
#if SERVICE_INTERVAL_3 > 0
void menu_action_reset_service3() { _lcd_reset_service(3); }
#endif
inline void _menu_service(const int index) {
START_MENU();
MENU_BACK(MSG_MAIN);
switch (index) {
#if SERVICE_INTERVAL_1 > 0
case 1: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service1); break;
#endif
#if SERVICE_INTERVAL_2 > 0
case 2: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service2); break;
#endif
#if SERVICE_INTERVAL_3 > 0
case 3: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service3); break;
#endif
}
END_MENU();
}
#if SERVICE_INTERVAL_1 > 0
void menu_service1() { _menu_service(1); }
#endif
#if SERVICE_INTERVAL_2 > 0
void menu_service2() { _menu_service(2); }
#endif
#if SERVICE_INTERVAL_3 > 0
void menu_service3() { _menu_service(3); }
void menu_service3() { _menu_service(3, PSTR(SERVICE_NAME_3)); }
#endif
#endif // HAS_LCD_MENU && HAS_SERVICE_INTERVALS && PRINTCOUNTER

View File

@ -32,7 +32,7 @@
#include "../../module/stepper_indirection.h"
#include "../../feature/tmc_util.h"
#define TMC_EDIT_STORED_I_RMS(ST) MENU_ITEM_EDIT_CALLBACK(uint16_4, MSG_##ST, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST)
#define TMC_EDIT_STORED_I_RMS(ST,MSG) MENU_ITEM_EDIT_CALLBACK(uint16_4, MSG, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST)
#if AXIS_IS_TMC(X)
void refresh_stepper_current_X() { stepperX.refresh_stepper_current(); }
@ -78,50 +78,50 @@ void menu_tmc_current() {
START_MENU();
MENU_BACK(MSG_TMC_DRIVERS);
#if AXIS_IS_TMC(X)
TMC_EDIT_STORED_I_RMS(X);
TMC_EDIT_STORED_I_RMS(X, MSG_X);
#endif
#if AXIS_IS_TMC(Y)
TMC_EDIT_STORED_I_RMS(Y);
TMC_EDIT_STORED_I_RMS(Y, MSG_Y);
#endif
#if AXIS_IS_TMC(Z)
TMC_EDIT_STORED_I_RMS(Z);
TMC_EDIT_STORED_I_RMS(Z, MSG_Z);
#endif
#if AXIS_IS_TMC(X2)
TMC_EDIT_STORED_I_RMS(X2);
TMC_EDIT_STORED_I_RMS(X2, MSG_X2);
#endif
#if AXIS_IS_TMC(Y2)
TMC_EDIT_STORED_I_RMS(Y2);
TMC_EDIT_STORED_I_RMS(Y2, MSG_Y2);
#endif
#if AXIS_IS_TMC(Z2)
TMC_EDIT_STORED_I_RMS(Z2);
TMC_EDIT_STORED_I_RMS(Z2, MSG_Z2);
#endif
#if AXIS_IS_TMC(Z3)
TMC_EDIT_STORED_I_RMS(Z3);
TMC_EDIT_STORED_I_RMS(Z3, MSG_Z3);
#endif
#if AXIS_IS_TMC(E0)
TMC_EDIT_STORED_I_RMS(E0);
TMC_EDIT_STORED_I_RMS(E0, MSG_E1);
#endif
#if AXIS_IS_TMC(E1)
TMC_EDIT_STORED_I_RMS(E1);
TMC_EDIT_STORED_I_RMS(E1, MSG_E2);
#endif
#if AXIS_IS_TMC(E2)
TMC_EDIT_STORED_I_RMS(E2);
TMC_EDIT_STORED_I_RMS(E2, MSG_E3);
#endif
#if AXIS_IS_TMC(E3)
TMC_EDIT_STORED_I_RMS(E3);
TMC_EDIT_STORED_I_RMS(E3, MSG_E4);
#endif
#if AXIS_IS_TMC(E4)
TMC_EDIT_STORED_I_RMS(E4);
TMC_EDIT_STORED_I_RMS(E4, MSG_E5);
#endif
#if AXIS_IS_TMC(E5)
TMC_EDIT_STORED_I_RMS(E5);
TMC_EDIT_STORED_I_RMS(E5, MSG_E6);
#endif
END_MENU();
}
#if ENABLED(HYBRID_THRESHOLD)
#define TMC_EDIT_STORED_HYBRID_THRS(ST) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_##ST, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST);
#define TMC_EDIT_STORED_HYBRID_THRS(ST, MSG) MENU_ITEM_EDIT_CALLBACK(uint8, MSG, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST);
#if AXIS_HAS_STEALTHCHOP(X)
void refresh_hybrid_thrs_X() { stepperX.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[X_AXIS]); }
@ -167,43 +167,43 @@ void menu_tmc_current() {
START_MENU();
MENU_BACK(MSG_TMC_DRIVERS);
#if AXIS_HAS_STEALTHCHOP(X)
TMC_EDIT_STORED_HYBRID_THRS(X);
TMC_EDIT_STORED_HYBRID_THRS(X, MSG_X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_EDIT_STORED_HYBRID_THRS(Y);
TMC_EDIT_STORED_HYBRID_THRS(Y, MSG_Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_EDIT_STORED_HYBRID_THRS(Z);
TMC_EDIT_STORED_HYBRID_THRS(Z, MSG_Z);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_EDIT_STORED_HYBRID_THRS(X2);
TMC_EDIT_STORED_HYBRID_THRS(X2, MSG_X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_EDIT_STORED_HYBRID_THRS(Y2);
TMC_EDIT_STORED_HYBRID_THRS(Y2, MSG_Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_EDIT_STORED_HYBRID_THRS(Z2);
TMC_EDIT_STORED_HYBRID_THRS(Z2, MSG_Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_EDIT_STORED_HYBRID_THRS(Z3);
TMC_EDIT_STORED_HYBRID_THRS(Z3, MSG_Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_EDIT_STORED_HYBRID_THRS(E0);
TMC_EDIT_STORED_HYBRID_THRS(E0, MSG_E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_EDIT_STORED_HYBRID_THRS(E1);
TMC_EDIT_STORED_HYBRID_THRS(E1, MSG_E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_EDIT_STORED_HYBRID_THRS(E2);
TMC_EDIT_STORED_HYBRID_THRS(E2, MSG_E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_EDIT_STORED_HYBRID_THRS(E3);
TMC_EDIT_STORED_HYBRID_THRS(E3, MSG_E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_EDIT_STORED_HYBRID_THRS(E4);
TMC_EDIT_STORED_HYBRID_THRS(E4, MSG_E5);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_EDIT_STORED_HYBRID_THRS(E5);
TMC_EDIT_STORED_HYBRID_THRS(E5, MSG_E6);
#endif
END_MENU();
}
@ -243,7 +243,7 @@ void menu_tmc_current() {
#if HAS_STEALTHCHOP
#define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST)
#define TMC_EDIT_STEP_MODE(ST, MSG) MENU_ITEM_EDIT_CALLBACK(bool, MSG, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST)
#if AXIS_HAS_STEALTHCHOP(X)
void refresh_stepping_mode_X() { stepperX.refresh_stepping_mode(); }
@ -290,43 +290,43 @@ void menu_tmc_current() {
STATIC_ITEM(MSG_TMC_STEALTH_ENABLED);
MENU_BACK(MSG_TMC_DRIVERS);
#if AXIS_HAS_STEALTHCHOP(X)
TMC_EDIT_STEP_MODE(X);
TMC_EDIT_STEP_MODE(X, MSG_X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_EDIT_STEP_MODE(Y);
TMC_EDIT_STEP_MODE(Y, MSG_Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_EDIT_STEP_MODE(Z);
TMC_EDIT_STEP_MODE(Z, MSG_Z);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_EDIT_STEP_MODE(X2);
TMC_EDIT_STEP_MODE(X2, MSG_X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_EDIT_STEP_MODE(Y2);
TMC_EDIT_STEP_MODE(Y2, MSG_Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_EDIT_STEP_MODE(Z2);
TMC_EDIT_STEP_MODE(Z2, MSG_Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_EDIT_STEP_MODE(Z3);
TMC_EDIT_STEP_MODE(Z3, MSG_Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_EDIT_STEP_MODE(E0);
TMC_EDIT_STEP_MODE(E0, MSG_E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_EDIT_STEP_MODE(E1);
TMC_EDIT_STEP_MODE(E1, MSG_E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_EDIT_STEP_MODE(E2);
TMC_EDIT_STEP_MODE(E2, MSG_E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_EDIT_STEP_MODE(E3);
TMC_EDIT_STEP_MODE(E3, MSG_E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_EDIT_STEP_MODE(E4);
TMC_EDIT_STEP_MODE(E4, MSG_E5);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_EDIT_STEP_MODE(E5);
TMC_EDIT_STEP_MODE(E5, MSG_E6);
#endif
END_MENU();
}

View File

@ -615,8 +615,10 @@ void _lcd_ubl_step_by_step() {
void _lcd_ubl_level_bed() {
START_MENU();
MENU_BACK(MSG_MOTION);
MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
if (planner.leveling_active)
MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
else
MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
MENU_ITEM(function, MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd);
MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);