diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index f7ec8ebd..6cba6748 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -60,10 +60,10 @@ #define EEPROM_UVLO_MESH_BED_LEVELING (EEPROM_FAN_CHECK_ENABLED - 9*2) #define EEPROM_UVLO_Z_MICROSTEPS (EEPROM_UVLO_MESH_BED_LEVELING - 2) -// Crash detection mode EEPROM setting -#define EEPROM_CRASH_DET (EEPROM_UVLO_MESH_BED_LEVELING-12) -// Filament sensor on/off EEPROM setting -#define EEPROM_FSENSOR (EEPROM_UVLO_MESH_BED_LEVELING-14) +// Crash detection mode EEPROM setting +#define EEPROM_CRASH_DET (EEPROM_UVLO_MESH_BED_LEVELING-12) +// Filament sensor on/off EEPROM setting +#define EEPROM_FSENSOR (EEPROM_UVLO_MESH_BED_LEVELING-14) // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index 8f4a1289..1af8d6ff 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -79,9 +79,9 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o //DEBUG #define DEBUG_DCODES //D codes #if 1 -//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output //#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored //#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored //#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored @@ -496,7 +496,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o // At 400 microsteps per mm, a full step lifts the Z axis by 0.04mm, and a stepper driver cycle is 0.16mm. // The following example, 12 * (4 * 16 / 400) = 12 * 0.16mm = 1.92mm. #define UVLO_Z_AXIS_SHIFT 1.92 -// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. +// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. #define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 #define HEATBED_V2 diff --git a/Firmware/Dcodes.h b/Firmware/Dcodes.h index 2f8a53f4..64f64fd8 100644 --- a/Firmware/Dcodes.h +++ b/Firmware/Dcodes.h @@ -1,11 +1,11 @@ -#ifndef DCODES_H -#define DCODES_H - -extern void dcode_0(); -extern void dcode_1(); -extern void dcode_2(); -extern void dcode_3(); -extern void dcode_4(); - - -#endif //DCODES_H +#ifndef DCODES_H +#define DCODES_H + +extern void dcode_0(); +extern void dcode_1(); +extern void dcode_2(); +extern void dcode_3(); +extern void dcode_4(); + + +#endif //DCODES_H diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f1bf1f76..c79f1ced 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -572,18 +572,18 @@ extern int8_t CrashDetectMenu; void crashdet_enable() { - MYSERIAL.println("crashdet_enable"); + MYSERIAL.println("crashdet_enable"); tmc2130_sg_stop_on_crash = true; - eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0xFF); + eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0xFF); CrashDetectMenu = 1; - + } void crashdet_disable() { - MYSERIAL.println("crashdet_disable"); + MYSERIAL.println("crashdet_disable"); tmc2130_sg_stop_on_crash = false; - eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0x00); + eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0x00); CrashDetectMenu = 0; } @@ -651,7 +651,7 @@ void fsensor_enable() fsensor_enabled = true; fsensor_ignore_error = true; fsensor_M600 = false; - eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0xFF); + eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0xFF); FSensorStateMenu = 1; } @@ -659,7 +659,7 @@ void fsensor_disable() { MYSERIAL.println("fsensor_disable"); fsensor_enabled = false; - eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x00); + eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x00); FSensorStateMenu = 0; } @@ -1135,33 +1135,33 @@ void setup() lcd_setstatuspgm(WELCOME_MSG); } */ - manage_heater(); // Update temperatures -#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER - MYSERIAL.println("Power panic detected!"); - MYSERIAL.print("Current bed temp:"); - MYSERIAL.println(degBed()); - MYSERIAL.print("Saved bed temp:"); - MYSERIAL.println((float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED)); -#endif - if ( degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET) ){ - #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER - MYSERIAL.println("Automatic recovery!"); - #endif - recover_print(1); - } - else{ - #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER - MYSERIAL.println("Normal recovery!"); - #endif - if ( lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_RECOVER_PRINT, false) ) recover_print(0); - else { - eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0); - lcd_update_enable(true); - lcd_update(2); - lcd_setstatuspgm(WELCOME_MSG); - } - - } + manage_heater(); // Update temperatures +#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER + MYSERIAL.println("Power panic detected!"); + MYSERIAL.print("Current bed temp:"); + MYSERIAL.println(degBed()); + MYSERIAL.print("Saved bed temp:"); + MYSERIAL.println((float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED)); +#endif + if ( degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET) ){ + #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER + MYSERIAL.println("Automatic recovery!"); + #endif + recover_print(1); + } + else{ + #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER + MYSERIAL.println("Normal recovery!"); + #endif + if ( lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_RECOVER_PRINT, false) ) recover_print(0); + else { + eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0); + lcd_update_enable(true); + lcd_update(2); + lcd_setstatuspgm(WELCOME_MSG); + } + + } } @@ -5827,8 +5827,8 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp MYSERIAL.print("selectedSerialPort = "); MYSERIAL.println(selectedSerialPort, DEC); break; - case 10: // D10 - Tell the printer that XYZ calibration went OK - calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); + case 10: // D10 - Tell the printer that XYZ calibration went OK + calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); break; case 999: { @@ -7099,10 +7099,10 @@ void recover_print(uint8_t automatic) { recover_machine_state_after_power_panic(); - // Set the target bed and nozzle temperatures. - sprintf_P(cmd, PSTR("M104 S%d"), target_temperature[active_extruder]); - enquecommand(cmd); - sprintf_P(cmd, PSTR("M140 S%d"), target_temperature_bed); + // Set the target bed and nozzle temperatures. + sprintf_P(cmd, PSTR("M104 S%d"), target_temperature[active_extruder]); + enquecommand(cmd); + sprintf_P(cmd, PSTR("M140 S%d"), target_temperature_bed); enquecommand(cmd); // Lift the print head, so one may remove the excess priming material. @@ -7117,9 +7117,9 @@ void recover_print(uint8_t automatic) { enquecommand(cmd); enquecommand_P(PSTR("M83")); //E axis relative mode //enquecommand_P(PSTR("G1 E5 F120")); //Extrude some filament to stabilize pessure - // If not automatically recoreverd (long power loss), extrude extra filament to stabilize - if(automatic == 0){ - enquecommand_P(PSTR("G1 E5 F120")); //Extrude some filament to stabilize pessure + // If not automatically recoreverd (long power loss), extrude extra filament to stabilize + if(automatic == 0){ + enquecommand_P(PSTR("G1 E5 F120")); //Extrude some filament to stabilize pessure } enquecommand_P(PSTR("G1 E" STRINGIFY(-DEFAULT_RETRACTION)" F480")); // Mark the power panic status as inactive. diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index cc14a3b4..6c81cffb 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3873,12 +3873,12 @@ static void lcd_main_menu() MENU_ITEM(back, MSG_WATCH, lcd_status_screen); -#ifdef RESUME_DEBUG +#ifdef RESUME_DEBUG if (!saved_printing) MENU_ITEM(function, PSTR("tst - Save"), lcd_menu_test_save); else MENU_ITEM(function, PSTR("tst - Restore"), lcd_menu_test_restore); -#endif //RESUME_DEBUG +#endif //RESUME_DEBUG #ifdef TMC2130_DEBUG MENU_ITEM(function, PSTR("recover print"), recover_print);