From fcd61a378d2f58514b87f88f60ad50733f2b9e7a Mon Sep 17 00:00:00 2001 From: gudnimg Date: Sun, 1 Oct 2023 12:44:49 +0000 Subject: [PATCH] power panic: save print type in EEPROM The printer should know whether it is recovering a SD print or a USB print PFW-1543 --- Firmware/eeprom.h | 8 +++++--- Firmware/power_panic.cpp | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index cc6546b6f..e73c2e80e 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -134,7 +134,9 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP | 0x0F95 3989 | char | EEPROM_FILENAME | ??? | ffh 255 | Power Panic Filename | ??? | D3 Ax0f95 C8 | 0x0F91 3985 | unint32 | EEPROM_FILE_POSITION | ??? | ff ff ff ffh | Power Panic File Position | ??? | D3 Ax0f91 C4 | 0x0F8D 3981 | float | EEPROM_UVLO_CURRENT_POSITION_Z | ??? | ff ff ff ffh | Power Panic Z Position | ^ | D3 Ax0f8d C4 -| 0x0F8C 3980 | ??? | EEPROM_UVLO_UNUSED_001 | ??? | ffh 255 | Power Panic _unused_ | ^ | D3 Ax0f8c C1 +| 0x0F8C 3980 | uint8 | EEPROM_UVLO_PRINT_TYPE | 00h 0 | ffh 255 | Power Panic print type: SD | ??? | D3 Ax0f8c C1 +| ^ | ^ | ^ | 01h 1 | ffh 255 | Power Panic print type: USB | ^ | ^ +| ^ | ^ | ^ | 02h 2 | ffh 255 | Power Panic print type: None | ^ | ^ | 0x0F8B 3979 | uint8 | EEPROM_UVLO_TARGET_BED | ??? | ffh 255 | Power Panic Bed temperature | ^ | D3 Ax0f8b C1 | 0x0F89 3977 | uint16 | EEPROM_UVLO_FEEDRATE | ??? | ff ffh 65535 | Power Panic Feedrate | ^ | D3 Ax0f89 C2 | 0x0F88 3976 | uint8 | EEPROM_UVLO_FAN_SPEED | ??? | ffh 255 | Power Panic Fan speed | ^ | D3 Ax0f88 C1 @@ -424,8 +426,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_FILENAME (EEPROM_UVLO_CURRENT_POSITION - 8) //8chars to store filename without extension #define EEPROM_FILE_POSITION (EEPROM_FILENAME - 4) //32 bit for uint32_t file position #define EEPROM_UVLO_CURRENT_POSITION_Z (EEPROM_FILE_POSITION - 4) //float for current position in Z -#define EEPROM_UVLO_UNUSED_001 (EEPROM_UVLO_CURRENT_POSITION_Z - 1) // uint8_t (unused) -#define EEPROM_UVLO_TARGET_BED (EEPROM_UVLO_UNUSED_001 - 1) +#define EEPROM_UVLO_PRINT_TYPE (EEPROM_UVLO_CURRENT_POSITION_Z - 1) // uint8_t +#define EEPROM_UVLO_TARGET_BED (EEPROM_UVLO_PRINT_TYPE - 1) #define EEPROM_UVLO_FEEDRATE (EEPROM_UVLO_TARGET_BED - 2) //uint16_t #define EEPROM_UVLO_FAN_SPEED (EEPROM_UVLO_FEEDRATE - 1) #define EEPROM_FAN_CHECK_ENABLED (EEPROM_UVLO_FAN_SPEED - 1) diff --git a/Firmware/power_panic.cpp b/Firmware/power_panic.cpp index adf3a033d..1c7a7f928 100644 --- a/Firmware/power_panic.cpp +++ b/Firmware/power_panic.cpp @@ -189,6 +189,7 @@ void uvlo_() { eeprom_update_block(saved_start_position, (float *)EEPROM_UVLO_SAVED_START_POSITION, sizeof(saved_start_position)); eeprom_update_word((uint16_t*)EEPROM_UVLO_SAVED_SEGMENT_IDX, saved_segment_idx); + eeprom_update_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE, saved_printing_type); #ifdef LIN_ADVANCE eeprom_update_float((float*)(EEPROM_UVLO_LA_K), extruder_advance_K);