From a3a0e70eeb2bf9f3ad12618107f2fa22f2def9d8 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Wed, 20 Dec 2017 22:29:41 +0100 Subject: [PATCH] Fsensor autoload enabled menu and eeprom variable --- Firmware/Configuration.h | 2 ++ Firmware/Marlin_main.cpp | 13 +++++++++---- Firmware/language_all.cpp | 10 ++++++++++ Firmware/language_all.h | 4 ++++ Firmware/language_en.h | 2 ++ Firmware/temperature.cpp | 4 +++- Firmware/ultralcd.cpp | 15 ++++++++++++++- 7 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 497ab533..46e1e41d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -90,6 +90,8 @@ #define EEPROM_SD_SORT (EEPROM_DIRS - 1) //0 -time, 1-alpha, 2-none #define EEPROM_SECOND_SERIAL_ACTIVE (EEPROM_SD_SORT - 1) +#define EEPROM_FSENS_AUTOLOAD_ENABLED (EEPROM_SECOND_SERIAL_ACTIVE - 1) + //TMC2130 configuration #define EEPROM_TMC_AXIS_SIZE //axis configuration block size #define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b53ab7e6..ae0f8e2f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -586,6 +586,9 @@ static void lcd_language_menu(); void stop_and_save_print_to_ram(float z_move, float e_move); void restore_print_from_ram_and_continue(float e_move); +bool fans_check_enabled = true; +bool filament_autoload_enabled = true; + extern int8_t CrashDetectMenu; void crashdet_enable() @@ -936,6 +939,8 @@ void setup() puts_P(PSTR("DISABLED\n")); fsensor_disable(); } + filament_autoload_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED) > 0); + #endif //PAT9125 @@ -5585,14 +5590,14 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp //load_filament_time = millis(); KEEPALIVE_STATE(PAUSED_FOR_USER); #ifdef PAT9125 - if (fsensor_M600) fsensor_autoload_check_start(); + if (filament_autoload_enabled && fsensor_M600) fsensor_autoload_check_start(); #endif //PAT9125 while(!lcd_clicked()) { manage_heater(); manage_inactivity(true); #ifdef PAT9125 - if (fsensor_M600 && fsensor_check_autoload()) + if (filament_autoload_enabled && fsensor_M600 && fsensor_check_autoload()) break; #endif //PAT9125 /*#ifdef SNMM @@ -5603,7 +5608,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp } #ifdef PAT9125 - if (fsensor_M600) fsensor_autoload_check_stop(); + if (filament_autoload_enabled && fsensor_M600) fsensor_autoload_check_stop(); #endif //PAT9125 //WRITE(BEEPER, LOW); KEEPALIVE_STATE(IN_HANDLER); @@ -6378,7 +6383,7 @@ void handle_status_leds(void) { void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h { - if (fsensor_enabled && !fsensor_M600 && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && (current_temperature[0] > EXTRUDE_MINTEMP)) + if (fsensor_enabled && filament_autoload_enabled && !fsensor_M600 && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && (current_temperature[0] > EXTRUDE_MINTEMP)) { if (fsensor_autoload_enabled) { diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 4a50a301..9248baf9 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -740,6 +740,16 @@ const char * const MSG_FSENSOR_ON_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_FSENSOR_ON_CZ }; +const char MSG_FSENS_AUTOLOAD_OFF_EN[] PROGMEM = "F. autoload [off]"; +const char * const MSG_FSENS_AUTOLOAD_OFF_LANG_TABLE[1] PROGMEM = { + MSG_FSENS_AUTOLOAD_OFF_EN +}; + +const char MSG_FSENS_AUTOLOAD_ON_EN[] PROGMEM = "F. autoload [on]"; +const char * const MSG_FSENS_AUTOLOAD_ON_LANG_TABLE[1] PROGMEM = { + MSG_FSENS_AUTOLOAD_ON_EN +}; + const char MSG_HEATING_EN[] PROGMEM = "Heating"; const char MSG_HEATING_CZ[] PROGMEM = "Zahrivani"; const char * const MSG_HEATING_LANG_TABLE[LANG_NUM] PROGMEM = { diff --git a/Firmware/language_all.h b/Firmware/language_all.h index d17bf3b3..19bd0bfe 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -260,6 +260,10 @@ extern const char* const MSG_FSENSOR_OFF_LANG_TABLE[LANG_NUM]; #define MSG_FSENSOR_OFF LANG_TABLE_SELECT(MSG_FSENSOR_OFF_LANG_TABLE) extern const char* const MSG_FSENSOR_ON_LANG_TABLE[LANG_NUM]; #define MSG_FSENSOR_ON LANG_TABLE_SELECT(MSG_FSENSOR_ON_LANG_TABLE) +extern const char* const MSG_FSENS_AUTOLOAD_OFF_LANG_TABLE[1]; +#define MSG_FSENS_AUTOLOAD_OFF LANG_TABLE_SELECT_EXPLICIT(MSG_FSENS_AUTOLOAD_OFF_LANG_TABLE, 0) +extern const char* const MSG_FSENS_AUTOLOAD_ON_LANG_TABLE[1]; +#define MSG_FSENS_AUTOLOAD_ON LANG_TABLE_SELECT_EXPLICIT(MSG_FSENS_AUTOLOAD_ON_LANG_TABLE, 0) extern const char* const MSG_HEATING_LANG_TABLE[LANG_NUM]; #define MSG_HEATING LANG_TABLE_SELECT(MSG_HEATING_LANG_TABLE) extern const char* const MSG_HEATING_COMPLETE_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index c4d1e52f..227b6cf1 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -369,6 +369,8 @@ #define(length=11, lines=1) MSG_INFO_FILAMENT_YDIFF "Fil. Ydiff:" #define(length=17, lines=1) MSG_FANS_CHECK_ON "Fans check [on]" #define(length=17, lines=1) MSG_FANS_CHECK_OFF "Fans check [off]" +#define(length=17, lines=1) MSG_FSENS_AUTOLOAD_ON "F. autoload [on]" +#define(length=17, lines=1) MSG_FSENS_AUTOLOAD_OFF "F. autoload [off]" #define(length=20, lines=4) MSG_PRESS_TO_UNLOAD "Please press the knob to unload filament" #define(length=20, lines=2) MSG_UNLOAD_SUCCESSFULL "Repeat unloading filament?" #define(length=20, lines=2) MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?" diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f72fecbb..e8031e1d 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -476,9 +476,11 @@ void countFanSpeed() fan_edge_counter[1] = 0; } +extern bool fans_check_enabled; + void checkFanSpeed() { - bool fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0); + fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0); static unsigned char fan_speed_errors[2] = { 0,0 }; if (fan_speed[0] == 0 && (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)) fan_speed_errors[0]++; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f75154b9..1a48969e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -30,7 +30,8 @@ int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */ extern int lcd_change_fil_state; -extern bool fans_check_enabled = true; +extern bool fans_check_enabled; +extern bool filament_autoload_enabled; //Function pointer to menu functions. typedef void (*menuFunc_t)(); @@ -1703,6 +1704,12 @@ void lcd_set_fan_check() { lcd_goto_menu(lcd_settings_menu, 8); } +void lcd_set_filament_autoload() { + filament_autoload_enabled = !filament_autoload_enabled; + eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled); + lcd_goto_menu(lcd_settings_menu, 8); +} + void lcd_unLoadFilament() { @@ -3735,6 +3742,12 @@ static void lcd_settings_menu() } else { MENU_ITEM(function, MSG_FSENSOR_ON, lcd_fsensor_state_set); } + if (filament_autoload_enabled == true) { + MENU_ITEM(function, MSG_FSENS_AUTOLOAD_ON, lcd_set_filament_autoload); + } + else { + MENU_ITEM(function, MSG_FSENS_AUTOLOAD_OFF, lcd_set_filament_autoload); + } if (fans_check_enabled == true) { MENU_ITEM(function, MSG_FANS_CHECK_ON, lcd_set_fan_check); }