From cbd7f033e87cd64454d8fb6a68a3f9b63c360034 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Wed, 27 Dec 2017 21:43:04 +0100 Subject: [PATCH] crashdetection and mode menu (PFW-85, PFW-97) --- Firmware/language_all.cpp | 5 +++ Firmware/language_all.h | 2 ++ Firmware/language_cz.h | 1 + Firmware/language_en.h | 1 + Firmware/ultralcd.cpp | 69 +++++++++++++++++---------------------- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index d2546d64..18556e86 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -389,6 +389,11 @@ const char * const MSG_COUNT_X_LANG_TABLE[1] PROGMEM = { MSG_COUNT_X_EN }; +const char MSG_CRASHDETECT_NA_EN[] PROGMEM = "Crash det. [N/A]"; +const char * const MSG_CRASHDETECT_NA_LANG_TABLE[1] PROGMEM = { + MSG_CRASHDETECT_NA_EN +}; + const char MSG_CRASHDETECT_OFF_EN[] PROGMEM = "Crash det. [off]"; const char MSG_CRASHDETECT_OFF_CZ[] PROGMEM = "Crash det. [vyp]"; const char * const MSG_CRASHDETECT_OFF_LANG_TABLE[LANG_NUM] PROGMEM = { diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 6a3a472f..41af38fa 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -142,6 +142,8 @@ extern const char* const MSG_CORRECTLY_LANG_TABLE[LANG_NUM]; #define MSG_CORRECTLY LANG_TABLE_SELECT(MSG_CORRECTLY_LANG_TABLE) extern const char* const MSG_COUNT_X_LANG_TABLE[1]; #define MSG_COUNT_X LANG_TABLE_SELECT_EXPLICIT(MSG_COUNT_X_LANG_TABLE, 0) +extern const char* const MSG_CRASHDETECT_NA_LANG_TABLE[1]; +#define MSG_CRASHDETECT_NA LANG_TABLE_SELECT_EXPLICIT(MSG_CRASHDETECT_NA_LANG_TABLE, 0) extern const char* const MSG_CRASHDETECT_OFF_LANG_TABLE[LANG_NUM]; #define MSG_CRASHDETECT_OFF LANG_TABLE_SELECT(MSG_CRASHDETECT_OFF_LANG_TABLE) extern const char* const MSG_CRASHDETECT_ON_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_cz.h b/Firmware/language_cz.h index 0bdd3540..e1aa8b88 100644 --- a/Firmware/language_cz.h +++ b/Firmware/language_cz.h @@ -348,6 +348,7 @@ #define MSG_FSENSOR_NA "Fil. senzor [err]" #define MSG_FSENSOR_ON "Fil. senzor [zap]" #define MSG_CRASHDETECT_ON "Crash det. [zap]" +#define MSG_CRASHDETECT_NA "Crash det. [N/A]" #define MSG_CRASHDETECT_OFF "Crash det. [vyp]" #define MSG_FANS_CHECK_ON "Kontr. vent.[zap]" #define MSG_FANS_CHECK_OFF "Kontr. vent.[vyp]" diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 637324a0..adc25d4b 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -349,6 +349,7 @@ //messages bellow has no translation yet #define MSG_CRASHDETECT_OFF "Crash det. [off]" +#define MSG_CRASHDETECT_NA "Crash det. [N/A]" #define MSG_CRASHDETECT_ON "Crash det. [on]" #define MSG_FSENSOR_OFF "Fil. sensor [off]" #define MSG_FSENSOR_NA "Fil. sensor [N/A]" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 43b8f966..65eb6d56 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3281,9 +3281,17 @@ static void lcd_sort_type_set() { } #endif //SDCARD_SORT_ALPHA +static void lcd_crash_mode_info2() +{ + lcd_show_fullscreen_message_and_wait_P(PSTR("WARNING: crashdetection unavailable in STEALTH mode.")); +} + + static void lcd_silent_mode_set() { SilentModeMenu = !SilentModeMenu; eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); + if (CrashDetectMenu && SilentModeMenu) + lcd_crash_mode_info2(); #ifdef TMC2130 st_synchronize(); if (tmc2130_wait_standstill_xy(1000)) {} @@ -3300,6 +3308,12 @@ static void lcd_silent_mode_set() { else lcd_goto_menu(lcd_settings_menu, 7); } +static void lcd_crash_mode_info() +{ + lcd_show_fullscreen_message_and_wait_P(PSTR("Crash-detection can be used only in NORMAL mode.")); +} + + static void lcd_crash_mode_set() { CrashDetectMenu = !CrashDetectMenu; //set also from crashdet_enable() and crashdet_disable() @@ -3763,14 +3777,15 @@ static void lcd_settings_menu() MENU_ITEM(function, MSG_FANS_CHECK_OFF, lcd_set_fan_check); } - - if (SilentModeMenu == 0) { - if (CrashDetectMenu == 0) { - MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set); - } else { - MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set); - } + if (SilentModeMenu == 0) MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); + else MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); + if (SilentModeMenu == 0) + { + if (CrashDetectMenu == 0) MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set); + else MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set); } + else MENU_ITEM(function, MSG_CRASHDETECT_NA, lcd_crash_mode_info); + if (temp_cal_active == false) { MENU_ITEM(function, MSG_TEMP_CALIBRATION_OFF, lcd_temp_calibration_set); } @@ -3784,13 +3799,7 @@ static void lcd_settings_menu() MENU_ITEM(function, MSG_SECOND_SERIAL_ON, lcd_second_serial_set); } - if (SilentModeMenu == 0) { - MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); - } - else { - MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); - } - if (!isPrintPaused && !homing_flag) + if (!isPrintPaused && !homing_flag) { MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); } @@ -5075,20 +5084,6 @@ static void lcd_autostart_sd() -static void lcd_silent_mode_set_tune() { - SilentModeMenu = !SilentModeMenu; - eeprom_update_byte((unsigned char*)EEPROM_SILENT, SilentModeMenu); -#ifdef TMC2130 - st_synchronize(); - cli(); - tmc2130_mode = SilentModeMenu?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; - tmc2130_init(); - sei(); -#endif //TMC2130 - digipot_init(); - lcd_goto_menu(lcd_tune_menu, 9); -} - static void lcd_colorprint_change() { enquecommand_P(PSTR("M600")); @@ -5125,19 +5120,15 @@ static void lcd_tune_menu() MENU_ITEM(function, MSG_FSENSOR_ON, lcd_fsensor_state_set); } - if (SilentModeMenu == 0) { - MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); - } else { - MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); - } + if (SilentModeMenu == 0) MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); + else MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); - if (SilentModeMenu == 0) { - if (CrashDetectMenu == 0) { - MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set); - } else { - MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set); - } + if (SilentModeMenu == 0) + { + if (CrashDetectMenu == 0) MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set); + else MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set); } + else MENU_ITEM(function, MSG_CRASHDETECT_NA, lcd_crash_mode_info); END_MENU(); }