Remove variable CrashDetectMenu. Read this state from EEPROM_CRASH_DET instead in bool lcd_crash_detect_enabled().
Rename crashdet_enable() to lcd_crash_detect_enable() and move it to ultralcd.cpp.
Rename crashdet_disable() to lcd_crash_detect_disable() and move it to ultralcd.cpp.
Rename lcd_crash_mode_set() to crash_mode_switch().
Remove forward function declarations from *.cpp file.

Saves 34B of FLASH and 2B of RAM.
This commit is contained in:
Marek Bel 2019-08-20 17:22:27 +02:00
parent f07635d08a
commit f204cdea81
3 changed files with 47 additions and 43 deletions

View file

@ -524,24 +524,6 @@ bool fans_check_enabled = true;
#ifdef TMC2130
extern int8_t CrashDetectMenu;
void crashdet_enable()
{
tmc2130_sg_stop_on_crash = true;
eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0xFF);
CrashDetectMenu = 1;
}
void crashdet_disable()
{
tmc2130_sg_stop_on_crash = false;
tmc2130_sg_crash = 0;
eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0x00);
CrashDetectMenu = 0;
}
void crashdet_stop_and_save_print()
{
stop_and_save_print_to_ram(10, -default_retraction); //XY - no change, Z 10mm up, E -1mm retract
@ -1262,15 +1244,15 @@ void setup()
uint8_t silentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
if (silentMode == 0xff) silentMode = 0;
tmc2130_mode = TMC2130_MODE_NORMAL;
uint8_t crashdet = eeprom_read_byte((uint8_t*)EEPROM_CRASH_DET);
if (crashdet && !farm_mode)
if (lcd_crash_detect_enabled() && !farm_mode)
{
crashdet_enable();
lcd_crash_detect_enable();
puts_P(_N("CrashDetect ENABLED!"));
}
else
{
crashdet_disable();
lcd_crash_detect_disable();
puts_P(_N("CrashDetect DISABLED"));
}