crashdetection and mode menu (PFW-85, PFW-97)

This commit is contained in:
Robert Pelnar 2017-12-27 21:43:04 +01:00
parent 546314fda7
commit cbd7f033e8
5 changed files with 39 additions and 39 deletions

View file

@ -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 = {

View file

@ -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];

View file

@ -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]"

View file

@ -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]"

View file

@ -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();
}