diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 225883bfd..995264777 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -848,6 +848,16 @@ void factory_reset(char level, bool quiet) farm_mode = false; eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode); EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no); + + eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0); + eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0); + eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_X_TOT, 0); + eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_Y_TOT, 0); + eeprom_update_word((uint16_t *)EEPROM_FERROR_COUNT_TOT, 0); + eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0); + + fsensor_enable(); + fautoload_set(true); WRITE(BEEPER, HIGH); _delay_ms(100); @@ -1142,10 +1152,6 @@ void list_sec_lang_from_external_flash() // are initialized by the main() routine provided by the Arduino framework. void setup() { -#ifdef W25X20CL - // Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. - optiboot_w25x20cl_enter(); -#endif lcd_init(); fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream @@ -1153,6 +1159,11 @@ void setup() lcd_splash(); + #ifdef W25X20CL + // Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. + optiboot_w25x20cl_enter(); + #endif + #if (LANG_MODE != 0) //secondary language support #ifdef W25X20CL if (w25x20cl_init()) @@ -3103,6 +3114,8 @@ void gcode_M701() custom_message = true; custom_message_type = 2; + if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; + lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); current_position[E_AXIS] += 70; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index bebcf8109..1e4f17d3a 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 0c5543bc3..486331a0e 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 0d3801d87..64412bc97 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" @@ -1845,8 +1846,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() @@ -2110,7 +2110,7 @@ void lcd_menu_statistics() { if (IS_SD_PRINTING) { - int _met = total_filament_used / 100000; + float _met = ((float)total_filament_used) / (100000.f); int _cm = (total_filament_used - (_met * 100000)) / 10; int _t = (millis() - starttime) / 1000; int _h = _t / 3600; @@ -2125,12 +2125,12 @@ void lcd_menu_statistics() lcd_printf_P(_N( ESC_2J "%S:" - ESC_H(6,1) "%8.2f m\n" + ESC_H(6,1) "%8.2fm \n" "%S :" ESC_H(8,3) "%2dh %02dm %02d" ), _i("Filament used"), - _met, _cm, + _met, _i("Print time"), _h, _m, _s );