TM: future-proofing for incompatible model upgrades
Introduce a model version. This is initialized at "1" and doesn't require any upgrade/downgrade checks since it's currently retro-compatible.
This commit is contained in:
parent
4a4be21374
commit
4b499583b5
@ -594,9 +594,10 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
|
||||
#define EEPROM_TEMP_MODEL_V (EEPROM_TEMP_MODEL_U-4) //float
|
||||
#define EEPROM_TEMP_MODEL_D (EEPROM_TEMP_MODEL_V-4) //float
|
||||
#define EEPROM_TEMP_MODEL_L (EEPROM_TEMP_MODEL_D-2) //uint16_t
|
||||
#define EEPROM_TEMP_MODEL_VER (EEPROM_TEMP_MODEL_L-1) //uint8_t
|
||||
|
||||
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
||||
#define EEPROM_LAST_ITEM EEPROM_TEMP_MODEL_L
|
||||
#define EEPROM_LAST_ITEM EEPROM_TEMP_MODEL_VER
|
||||
// !!!!!
|
||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||
// !!!!!
|
||||
|
@ -2633,13 +2633,13 @@ void temp_model_load_settings()
|
||||
static_assert(TEMP_MODEL_R_SIZE == 16); // ensure we don't desync with the eeprom table
|
||||
TempMgrGuard temp_mgr_guard;
|
||||
|
||||
// handle upgrade from a model without UVDL (FW<3.13)
|
||||
// WARNING: this only works as long as UVDL are the same constants/model type as FW 3.12,
|
||||
// it needs to consider the upgrading FW version otherwise!
|
||||
// handle upgrade from a model without UVDL (FW<3.13, TM VER<1): model is retro-compatible,
|
||||
// reset UV to an identity without doing any special handling
|
||||
eeprom_init_default_float((float*)EEPROM_TEMP_MODEL_U, TEMP_MODEL_U);
|
||||
eeprom_init_default_float((float*)EEPROM_TEMP_MODEL_V, TEMP_MODEL_V);
|
||||
eeprom_init_default_float((float*)EEPROM_TEMP_MODEL_D, TEMP_MODEL_fS);
|
||||
eeprom_init_default_word((uint16_t*)EEPROM_TEMP_MODEL_L, TEMP_MODEL_LAG);
|
||||
eeprom_init_default_byte((uint8_t*)EEPROM_TEMP_MODEL_VER, TEMP_MODEL_VER);
|
||||
|
||||
temp_model::enabled = eeprom_read_byte((uint8_t*)EEPROM_TEMP_MODEL_ENABLE);
|
||||
temp_model::data.P = eeprom_read_float((float*)EEPROM_TEMP_MODEL_P);
|
||||
|
@ -412,6 +412,7 @@
|
||||
|
||||
// model-based temperature check
|
||||
#define TEMP_MODEL 1 // enable model-based temperature checks
|
||||
#define TEMP_MODEL_VER 1 // model parameters version
|
||||
#define TEMP_MODEL_DEBUG 1 // extended runtime logging
|
||||
|
||||
#define TEMP_MODEL_P 38. // heater power (W)
|
||||
|
@ -416,6 +416,7 @@
|
||||
|
||||
// model-based temperature check
|
||||
#define TEMP_MODEL 1 // enable model-based temperature checks
|
||||
#define TEMP_MODEL_VER 1 // model parameters version
|
||||
#define TEMP_MODEL_DEBUG 1 // extended runtime logging
|
||||
|
||||
#define TEMP_MODEL_P 38. // heater power (W)
|
||||
|
Loading…
Reference in New Issue
Block a user