From 4b295c4091e2dc6483ee81e12b019d0f1eac1497 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 11 Jul 2018 20:45:56 +0200 Subject: [PATCH] FilamentAutoload setting by shipping preparation --- Firmware/Marlin_main.cpp | 1 + Firmware/fsensor.cpp | 6 ++++++ Firmware/fsensor.h | 3 +++ Firmware/ultralcd.cpp | 4 ++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3499dc14..4f73e62f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -858,6 +858,7 @@ void factory_reset(char level, bool quiet) eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0); fsensor_enable(); + fautoload_set(true); WRITE(BEEPER, HIGH); _delay_ms(100); diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index bebcf810..1e4f17d3 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -86,6 +86,12 @@ void fsensor_disable() FSensorStateMenu = 0; } +void fautoload_set(bool State) +{ + filament_autoload_enabled = State; + eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled); +} + void pciSetup(byte pin) { *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin diff --git a/Firmware/fsensor.h b/Firmware/fsensor.h index 0c5543bc..486331a0 100644 --- a/Firmware/fsensor.h +++ b/Firmware/fsensor.h @@ -15,6 +15,9 @@ extern void fsensor_unblock(); extern bool fsensor_enable(); extern void fsensor_disable(); +extern bool filament_autoload_enabled; +extern void fautoload_set(bool State); + //update (perform M600 on filament runout) extern void fsensor_update(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 832ecfa7..64379b31 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1,5 +1,6 @@ #include "temperature.h" #include "ultralcd.h" +#include "fsensor.h" #ifdef ULTRA_LCD #include "MenuStack.h" #include "Marlin.h" @@ -2042,8 +2043,7 @@ void lcd_set_fan_check() { } void lcd_set_filament_autoload() { - filament_autoload_enabled = !filament_autoload_enabled; - eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled); + fautoload_set(!filament_autoload_enabled); } void lcd_unLoadFilament()