From 8279aba4d7b03b2c4d5698f4da0103da2c2ec3d5 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 10 Aug 2018 16:10:49 +0200 Subject: [PATCH] Add auto deplete setting. --- Firmware/eeprom.h | 1 + Firmware/ultralcd.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 28498f13..54a21648 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -144,6 +144,7 @@ // Sound Mode //#define EEPROM_SOUND_MODE (EEPROM_EXTRUDEMULTIPLY-1) // uint8 #define EEPROM_SOUND_MODE (EEPROM_UVLO_TINY_Z_MICROSTEPS-1) // uint8 +#define EEPROM_AUTO_DEPLETE (EEPROM_SOUND_MODE-1) //bool // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 63affbaf..e3a38aa9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -88,6 +88,7 @@ unsigned long display_time; //just timer for showing pid finished message on lcd float pid_temp = DEFAULT_PID_TEMP; static bool forceMenuExpire = false; +static bool autoDeplete; static float manual_feedrate[] = MANUAL_FEEDRATE; @@ -4659,6 +4660,11 @@ do\ }\ while (0) +static void auto_deplete_switch() +{ + autoDeplete = !autoDeplete; + eeprom_update_byte((unsigned char *)EEPROM_AUTO_DEPLETE, autoDeplete); +} static void lcd_settings_menu() { EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); @@ -4673,6 +4679,9 @@ static void lcd_settings_menu() SETTINGS_FILAMENT_SENSOR; + if (autoDeplete) MENU_ITEM_FUNCTION_P(_i("Auto deplete [on]"), auto_deplete_switch); + else MENU_ITEM_FUNCTION_P(_i("Auto deplete[off]"), auto_deplete_switch); + if (fans_check_enabled == true) MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1 else @@ -7056,6 +7065,12 @@ void menu_action_sddirectory(const char* filename, char* longFilename) void ultralcd_init() { + { + uint8_t autoDepleteRaw = eeprom_read_byte(reinterpret_cast(EEPROM_AUTO_DEPLETE)); + if (0xff == autoDepleteRaw) autoDeplete = false; + else autoDeplete = autoDepleteRaw; + + } lcd_init(); lcd_refresh(); lcd_longpress_func = menu_lcd_longpress_func;