Rename upper case `TEMP_MODEL` to `THERMAL_MODEL`
This commit is contained in:
parent
dac07d11ba
commit
44ae8033eb
|
|
@ -103,7 +103,7 @@ void Config_PrintSettings(uint8_t level)
|
|||
printf_P(PSTR(
|
||||
"%SArc Settings: P:Max length(mm) S:Min length (mm) N:Corrections R:Min segments F:Segments/sec.\n%S M214 P%.2f S%.2f N%d R%d F%d\n"),
|
||||
echomagic, echomagic, cs.mm_per_arc_segment, cs.min_mm_per_arc_segment, cs.n_arc_correction, cs.min_arc_segments, cs.arc_segments_per_sec);
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model_report_settings();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ void Config_StoreSettings()
|
|||
{
|
||||
strcpy_P(cs.version, default_conf.version);
|
||||
eeprom_update_block(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model_save_settings();
|
||||
#endif
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ bool Config_RetrieveSettings()
|
|||
|
||||
// Call updatePID (similar to when we have processed M301)
|
||||
updatePID();
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model_load_settings();
|
||||
#endif
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ void Config_ResetDefault()
|
|||
#ifdef PIDTEMP
|
||||
updatePID();
|
||||
#endif//PIDTEMP
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model_reset_settings();
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1550,10 +1550,10 @@ void setup()
|
|||
// warn about other important steps individually
|
||||
if (!calibration_status_get(CALIBRATION_STATUS_LIVE_ADJUST))
|
||||
lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
|
||||
#ifdef TEMP_MODEL
|
||||
if (!calibration_status_get(CALIBRATION_STATUS_TEMP_MODEL) && thermal_model_enabled())
|
||||
#ifdef THERMAL_MODEL
|
||||
if (!calibration_status_get(CALIBRATION_STATUS_THERMAL_MODEL) && thermal_model_enabled())
|
||||
lcd_show_fullscreen_message_and_wait_P(_T(MSG_TM_NOT_CAL));
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7330,7 +7330,7 @@ Sigma_Exit:
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
/*!
|
||||
### M310 - Temperature model settings <a href="https://reprap.org/wiki/G-code#M310:_Temperature_model_settings">M310: Temperature model settings</a>
|
||||
#### Usage
|
||||
|
|
@ -8878,7 +8878,7 @@ Sigma_Exit:
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef TEMP_MODEL_DEBUG
|
||||
#ifdef THERMAL_MODEL_DEBUG
|
||||
/*!
|
||||
## D70 - Enable low-level temperature model logging for offline simulation
|
||||
#### Usage
|
||||
|
|
|
|||
|
|
@ -336,14 +336,14 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
| ^ | ^ | ^ | 03h 3 | ^ | bad_isr | ^ | ^
|
||||
| ^ | ^ | ^ | 04h 4 | ^ | bad_pullup_temp_isr | ^ | ^
|
||||
| ^ | ^ | ^ | 05h 5 | ^ | bad_pullup_step_isr | ^ | ^
|
||||
| 0x0D02 3330 | uint8 | EEPROM_TEMP_MODEL_ENABLE | 00h 0 | ff/00 | Temp model deactivated | Temp model | D3 Ax0d02 C1
|
||||
| 0x0D02 3330 | uint8 | EEPROM_THERMAL_MODEL_ENABLE | 00h 0 | ff/00 | Temp model deactivated | Temp model | D3 Ax0d02 C1
|
||||
| ^ | ^ | ^ | 01h 1 | ^ | Temp model activated | ^ | ^
|
||||
| 0x0CFE 3326 | float | EEPROM_TEMP_MODEL_P | ??? | ff ff ff ffh | Temp model power (W) | Temp model | D3 Ax0cfe C4
|
||||
| 0x0CFA 3322 | float | EEPROM_TEMP_MODEL_C | ??? | ff ff ff ffh | Temp model capacitance (J/K) | Temp model | D3 Ax0cfa C4
|
||||
| 0x0CBA 3258 |float[16]| EEPROM_TEMP_MODEL_R | ??? | ff ff ff ffh | Temp model resistance (K/W) | Temp model | D3 Ax0cba C64
|
||||
| 0x0CB6 3254 | float | EEPROM_TEMP_MODEL_Ta_corr | ??? | ff ff ff ffh | Temp model ambient temperature correction (K) | Temp model | D3 Ax0cb6 C4
|
||||
| 0x0CB2 3250 | float | EEPROM_TEMP_MODEL_W | ??? | ff ff ff ffh | Temp model warning threshold (K/s) | Temp model | D3 Ax0cb2 C4
|
||||
| 0x0CAE 3246 | float | EEPROM_TEMP_MODEL_E | ??? | ff ff ff ffh | Temp model error threshold (K/s) | Temp model | D3 Ax0cae C4
|
||||
| 0x0CFE 3326 | float | EEPROM_THERMAL_MODEL_P | ??? | ff ff ff ffh | Temp model power (W) | Temp model | D3 Ax0cfe C4
|
||||
| 0x0CFA 3322 | float | EEPROM_THERMAL_MODEL_C | ??? | ff ff ff ffh | Temp model capacitance (J/K) | Temp model | D3 Ax0cfa C4
|
||||
| 0x0CBA 3258 |float[16]| EEPROM_THERMAL_MODEL_R | ??? | ff ff ff ffh | Temp model resistance (K/W) | Temp model | D3 Ax0cba C64
|
||||
| 0x0CB6 3254 | float | EEPROM_THERMAL_MODEL_Ta_corr | ??? | ff ff ff ffh | Temp model ambient temperature correction (K) | Temp model | D3 Ax0cb6 C4
|
||||
| 0x0CB2 3250 | float | EEPROM_THERMAL_MODEL_W | ??? | ff ff ff ffh | Temp model warning threshold (K/s) | Temp model | D3 Ax0cb2 C4
|
||||
| 0x0CAE 3246 | float | EEPROM_THERMAL_MODEL_E | ??? | ff ff ff ffh | Temp model error threshold (K/s) | Temp model | D3 Ax0cae C4
|
||||
| 0x0CAD 3245 | uint8 | EEPROM_FSENSOR_JAM_DETECTION | 01h 1 | ff/01 | fsensor pat9125 jam detection feature | LCD menu | D3 Ax0cad C1
|
||||
| 0x0CAC 3244 | uint8 | EEPROM_MMU_ENABLED | 00h 0 | ff/00 | MMU enabled | LCD menu | D3 Ax0cac C1
|
||||
| 0x0CA8 3240 | uint32 | EEPROM_MMU_MATERIAL_CHANGES | ??? | ff ff ff ffh | MMU toolchange counter over printers lifetime | LCD statistic| D3 Ax0ca8 C4
|
||||
|
|
@ -359,11 +359,11 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
| ^ | ^ | ^ | 20h 32 | ^ | Free bit | ^ | ^
|
||||
| ^ | ^ | ^ | 40h 64 | ^ | Free bit | ^ | ^
|
||||
| ^ | ^ | ^ | 80h 128 | ^ | Unknown | ^ | ^
|
||||
| 0x0CA2 3234 | float | EEPROM_TEMP_MODEL_U | ??? | ff ff ff ffh | Temp model linear temperature coefficient (W/K/W) | Temp model | D3 Ax0ca2 C4
|
||||
| 0x0C9E 3230 | float | EEPROM_TEMP_MODEL_V | ??? | ff ff ff ffh | Temp model linear temperature intercept (W/W) | Temp model | D3 Ax0c9e C4
|
||||
| 0x0C9A 3226 | float | EEPROM_TEMP_MODEL_D | ??? | ff ff ff ffh | Temp model sim. 1st order IIR filter factor | Temp model | D3 Ax0c9a C4
|
||||
| 0x0C98 3224 | uint16 | EEPROM_TEMP_MODEL_L | 0-2160 | ff ffh | Temp model sim. response lag (ms) | Temp model | D3 Ax0c98 C2
|
||||
| 0x0C97 3223 | uint8 | EEPROM_TEMP_MODEL_VER | 0-255 | ffh | Temp model Version | Temp model | D3 Ax0c97 C1
|
||||
| 0x0CA2 3234 | float | EEPROM_THERMAL_MODEL_U | ??? | ff ff ff ffh | Temp model linear temperature coefficient (W/K/W) | Temp model | D3 Ax0ca2 C4
|
||||
| 0x0C9E 3230 | float | EEPROM_THERMAL_MODEL_V | ??? | ff ff ff ffh | Temp model linear temperature intercept (W/W) | Temp model | D3 Ax0c9e C4
|
||||
| 0x0C9A 3226 | float | EEPROM_THERMAL_MODEL_D | ??? | ff ff ff ffh | Temp model sim. 1st order IIR filter factor | Temp model | D3 Ax0c9a C4
|
||||
| 0x0C98 3224 | uint16 | EEPROM_THERMAL_MODEL_L | 0-2160 | ff ffh | Temp model sim. response lag (ms) | Temp model | D3 Ax0c98 C2
|
||||
| 0x0C97 3223 | uint8 | EEPROM_THERMAL_MODEL_VER | 0-255 | ffh | Temp model Version | Temp model | D3 Ax0c97 C1
|
||||
| 0x0C95 3221 | PGM_P | EEPROM_KILL_MESSAGE | 0-65535 | ff ffh | Kill message PGM pointer | kill() | D3 Ax0c95 C2
|
||||
| 0x0C94 3220 | uint8 | EEPROM_KILL_PENDING_FLAG | 42h, ffh | ffh | Kill pending flag (0x42 magic value) | kill() | D3 Ax0c94 C1
|
||||
|
||||
|
|
@ -581,27 +581,27 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
|
|||
#define EEPROM_ECOOL_ENABLE (EEPROM_JOB_ID-1) // uint8_t
|
||||
#define EEPROM_FW_CRASH_FLAG (EEPROM_ECOOL_ENABLE-1) // uint8_t
|
||||
|
||||
#define EEPROM_TEMP_MODEL_ENABLE (EEPROM_FW_CRASH_FLAG-1) // uint8_t
|
||||
#define EEPROM_TEMP_MODEL_P (EEPROM_TEMP_MODEL_ENABLE-4) // float
|
||||
#define EEPROM_TEMP_MODEL_C (EEPROM_TEMP_MODEL_P-4) // float
|
||||
#define EEPROM_TEMP_MODEL_R (EEPROM_TEMP_MODEL_C-4*16) // float[16]
|
||||
#define EEPROM_TEMP_MODEL_Ta_corr (EEPROM_TEMP_MODEL_R-4) // float
|
||||
#define EEPROM_TEMP_MODEL_W (EEPROM_TEMP_MODEL_Ta_corr-4) // float
|
||||
#define EEPROM_TEMP_MODEL_E (EEPROM_TEMP_MODEL_W-4) // float
|
||||
#define EEPROM_THERMAL_MODEL_ENABLE (EEPROM_FW_CRASH_FLAG-1) // uint8_t
|
||||
#define EEPROM_THERMAL_MODEL_P (EEPROM_THERMAL_MODEL_ENABLE-4) // float
|
||||
#define EEPROM_THERMAL_MODEL_C (EEPROM_THERMAL_MODEL_P-4) // float
|
||||
#define EEPROM_THERMAL_MODEL_R (EEPROM_THERMAL_MODEL_C-4*16) // float[16]
|
||||
#define EEPROM_THERMAL_MODEL_Ta_corr (EEPROM_THERMAL_MODEL_R-4) // float
|
||||
#define EEPROM_THERMAL_MODEL_W (EEPROM_THERMAL_MODEL_Ta_corr-4) // float
|
||||
#define EEPROM_THERMAL_MODEL_E (EEPROM_THERMAL_MODEL_W-4) // float
|
||||
|
||||
#define EEPROM_FSENSOR_JAM_DETECTION (EEPROM_TEMP_MODEL_E-1) // uint8_t
|
||||
#define EEPROM_FSENSOR_JAM_DETECTION (EEPROM_THERMAL_MODEL_E-1) // uint8_t
|
||||
#define EEPROM_MMU_ENABLED (EEPROM_FSENSOR_JAM_DETECTION-1) // uint8_t
|
||||
#define EEPROM_MMU_MATERIAL_CHANGES (EEPROM_MMU_ENABLED-4) // uint32_t
|
||||
#define EEPROM_HEAT_BED_ON_LOAD_FILAMENT (EEPROM_MMU_MATERIAL_CHANGES-1) //uint8
|
||||
#define EEPROM_CALIBRATION_STATUS_V2 (EEPROM_HEAT_BED_ON_LOAD_FILAMENT-1) //uint8
|
||||
|
||||
#define EEPROM_TEMP_MODEL_U (EEPROM_CALIBRATION_STATUS_V2-4) //float
|
||||
#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
|
||||
#define EEPROM_THERMAL_MODEL_U (EEPROM_CALIBRATION_STATUS_V2-4) //float
|
||||
#define EEPROM_THERMAL_MODEL_V (EEPROM_THERMAL_MODEL_U-4) //float
|
||||
#define EEPROM_THERMAL_MODEL_D (EEPROM_THERMAL_MODEL_V-4) //float
|
||||
#define EEPROM_THERMAL_MODEL_L (EEPROM_THERMAL_MODEL_D-2) //uint16_t
|
||||
#define EEPROM_THERMAL_MODEL_VER (EEPROM_THERMAL_MODEL_L-1) //uint8_t
|
||||
|
||||
#define EEPROM_KILL_MESSAGE (EEPROM_TEMP_MODEL_VER-2) //PGM_P
|
||||
#define EEPROM_KILL_MESSAGE (EEPROM_THERMAL_MODEL_VER-2) //PGM_P
|
||||
#define EEPROM_KILL_PENDING_FLAG (EEPROM_KILL_MESSAGE-1) //uint8
|
||||
|
||||
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ extern uint8_t menu_depth;
|
|||
enum ESeriousErrors {
|
||||
MENU_BLOCK_NONE = 0,
|
||||
MENU_BLOCK_THERMAL_ERROR = 0x01,
|
||||
#ifdef TEMP_MODEL
|
||||
MENU_BLOCK_TEMP_MODEL_AUTOTUNE = 0x02,
|
||||
#ifdef THERMAL_MODEL
|
||||
MENU_BLOCK_THERMAL_MODEL_AUTOTUNE = 0x02,
|
||||
#endif
|
||||
MENU_BLOCK_STATUS_SCREEN_M0 = 0x04,
|
||||
}; // and possibly others in the future.
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ const char MSG_IR_03_OR_OLDER[] PROGMEM_I1 = ISTR(" 0.3 or older");////MSG_IR_03
|
|||
const char MSG_IR_UNKNOWN[] PROGMEM_I1 = ISTR("unknown state");////MSG_IR_UNKNOWN c=18
|
||||
#endif
|
||||
extern const char MSG_PAUSED_THERMAL_ERROR[] PROGMEM_I1 = ISTR("PAUSED THERMAL ERROR");////MSG_PAUSED_THERMAL_ERROR c=20
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
extern const char MSG_THERMAL_ANOMALY[] PROGMEM_I1 = ISTR("THERMAL ANOMALY");////MSG_THERMAL_ANOMALY c=20
|
||||
extern const char MSG_TM_NOT_CAL[] PROGMEM_I1 = ISTR("Thermal model not calibrated yet.");////MSG_TM_NOT_CAL c=20 r=4
|
||||
extern const char MSG_TM_ACK_ERROR[] PROGMEM_I1 = ISTR("Clear TM error");////MSG_TM_ACK_ERROR c=18
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ extern const char MSG_IR_03_OR_OLDER[];
|
|||
extern const char MSG_IR_UNKNOWN[];
|
||||
#endif
|
||||
extern const char MSG_PAUSED_THERMAL_ERROR[];
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
extern const char MSG_THERMAL_ANOMALY[];
|
||||
extern const char MSG_TM_NOT_CAL[];
|
||||
extern const char MSG_TM_ACK_ERROR[];
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
#define ENABLE_TEMP_MGR_INTERRUPT() TIMSKx |= (1<<OCIExA)
|
||||
#define DISABLE_TEMP_MGR_INTERRUPT() TIMSKx &= ~(1<<OCIExA)
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
// temperature model interface
|
||||
#include "thermal_model.h"
|
||||
#endif
|
||||
|
|
@ -486,7 +486,7 @@ enum class TempErrorType : uint8_t
|
|||
min,
|
||||
preheat,
|
||||
runaway,
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
model,
|
||||
#endif
|
||||
};
|
||||
|
|
@ -554,7 +554,7 @@ void manage_heater()
|
|||
// syncronize temperatures with isr
|
||||
updateTemperatures();
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
// handle model warnings first, so not to override the error handler
|
||||
if(thermal_model::warning_state.warning)
|
||||
thermal_model::handle_warning();
|
||||
|
|
@ -567,7 +567,7 @@ void manage_heater()
|
|||
// periodically check fans
|
||||
checkFans();
|
||||
|
||||
#ifdef TEMP_MODEL_DEBUG
|
||||
#ifdef THERMAL_MODEL_DEBUG
|
||||
thermal_model::log_usr();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1539,7 +1539,7 @@ void handle_temp_error()
|
|||
#endif
|
||||
}
|
||||
break;
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
case TempErrorType::model:
|
||||
if(temp_error_state.assert) {
|
||||
if(IsStopped() == false) {
|
||||
|
|
@ -1961,9 +1961,9 @@ static void temp_mgr_isr()
|
|||
temp_error_state.assert = false;
|
||||
check_temp_raw(); // check min/max temp using raw values
|
||||
check_temp_runaway(); // classic temperature hysteresis check
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model::check(); // model-based heater check
|
||||
#ifdef TEMP_MODEL_DEBUG
|
||||
#ifdef THERMAL_MODEL_DEBUG
|
||||
thermal_model::log_isr();
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -2078,7 +2078,7 @@ static void check_temp_raw()
|
|||
check_min_temp_raw();
|
||||
}
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
namespace thermal_model {
|
||||
|
||||
void model_data::reset(uint8_t heater_pwm _UNUSED, uint8_t fan_pwm _UNUSED,
|
||||
|
|
@ -2091,7 +2091,7 @@ void model_data::reset(uint8_t heater_pwm _UNUSED, uint8_t fan_pwm _UNUSED,
|
|||
dT_lag_size = L / (uint16_t)(TEMP_MGR_INTV * 1000);
|
||||
|
||||
// initial values
|
||||
for(uint8_t i = 0; i != TEMP_MODEL_MAX_LAG_SIZE; ++i)
|
||||
for(uint8_t i = 0; i != THERMAL_MODEL_MAX_LAG_SIZE; ++i)
|
||||
dT_lag_buf[i] = NAN;
|
||||
dT_lag_idx = 0;
|
||||
dT_err_prev = 0;
|
||||
|
|
@ -2132,7 +2132,7 @@ void model_data::step(uint8_t heater_pwm, uint8_t fan_pwm, float heater_temp, fl
|
|||
|
||||
// calculate and filter dT_err
|
||||
float dT_err = (cur_heater_temp - T_prev) - dT_lag;
|
||||
float dT_err_f = iir_mul(dT_err_prev, dT_err, TEMP_MODEL_fE, 0.);
|
||||
float dT_err_f = iir_mul(dT_err_prev, dT_err, THERMAL_MODEL_fE, 0.);
|
||||
T_prev = cur_heater_temp;
|
||||
dT_err_prev = dT_err_f;
|
||||
|
||||
|
|
@ -2164,7 +2164,7 @@ static bool calibrated()
|
|||
if(isnan(data.fS)) return false;
|
||||
if(!(data.L > 0)) return false;
|
||||
if(!(data.Ta_corr != NAN)) return false;
|
||||
for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i) {
|
||||
for(uint8_t i = 0; i != THERMAL_MODEL_R_SIZE; ++i) {
|
||||
if(!(thermal_model::data.R[i] >= 0))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2234,7 +2234,7 @@ static void handle_warning()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TEMP_MODEL_DEBUG
|
||||
#ifdef THERMAL_MODEL_DEBUG
|
||||
static void log_usr()
|
||||
{
|
||||
if(!log_buf.enabled) return;
|
||||
|
|
@ -2324,8 +2324,8 @@ static void thermal_model_set_lag(uint16_t ms)
|
|||
// ensure we do not exceed the maximum lag buffer and have at least one lag sample for filtering
|
||||
if(samples < 1)
|
||||
samples = 1;
|
||||
else if(samples > TEMP_MODEL_MAX_LAG_SIZE)
|
||||
samples = TEMP_MODEL_MAX_LAG_SIZE;
|
||||
else if(samples > THERMAL_MODEL_MAX_LAG_SIZE)
|
||||
samples = THERMAL_MODEL_MAX_LAG_SIZE;
|
||||
|
||||
// round back to ms
|
||||
thermal_model::data.L = samples * intv_ms;
|
||||
|
|
@ -2354,7 +2354,7 @@ void thermal_model_set_params(float P, float U, float V, float C, float D, int16
|
|||
|
||||
void thermal_model_set_resistance(uint8_t index, float R)
|
||||
{
|
||||
if(index >= TEMP_MODEL_R_SIZE || R <= 0)
|
||||
if(index >= THERMAL_MODEL_R_SIZE || R <= 0)
|
||||
return;
|
||||
|
||||
TempMgrGuard temp_mgr_guard;
|
||||
|
|
@ -2366,7 +2366,7 @@ void thermal_model_report_settings()
|
|||
{
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Temperature Model settings:");
|
||||
for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i)
|
||||
for(uint8_t i = 0; i != THERMAL_MODEL_R_SIZE; ++i)
|
||||
printf_P(PSTR("%S M310 I%u R%.2f\n"), echomagic, (unsigned)i, (double)thermal_model::data.R[i]);
|
||||
printf_P(PSTR("%S M310 P%.2f U%.4f V%.2f C%.2f D%.4f L%u S%u B%u E%.2f W%.2f T%.2f\n"),
|
||||
echomagic, (double)thermal_model::data.P, (double)thermal_model::data.U, (double)thermal_model::data.V,
|
||||
|
|
@ -2380,17 +2380,17 @@ void thermal_model_reset_settings()
|
|||
{
|
||||
TempMgrGuard temp_mgr_guard;
|
||||
|
||||
thermal_model::data.P = TEMP_MODEL_DEF(P);
|
||||
thermal_model::data.U = TEMP_MODEL_DEF(U);
|
||||
thermal_model::data.V = TEMP_MODEL_DEF(V);
|
||||
thermal_model::data.C = TEMP_MODEL_DEF(C);
|
||||
thermal_model::data.fS = TEMP_MODEL_DEF(fS);
|
||||
thermal_model::data.L = (uint16_t)(TEMP_MODEL_DEF(LAG) / (TEMP_MGR_INTV * 1000) + 0.5) * (uint16_t)(TEMP_MGR_INTV * 1000);
|
||||
for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i)
|
||||
thermal_model::data.R[i] = pgm_read_float(TEMP_MODEL_R_DEFAULT + i);
|
||||
thermal_model::data.Ta_corr = TEMP_MODEL_Ta_corr;
|
||||
thermal_model::data.warn = TEMP_MODEL_DEF(W);
|
||||
thermal_model::data.err = TEMP_MODEL_DEF(E);
|
||||
thermal_model::data.P = THERMAL_MODEL_DEF(P);
|
||||
thermal_model::data.U = THERMAL_MODEL_DEF(U);
|
||||
thermal_model::data.V = THERMAL_MODEL_DEF(V);
|
||||
thermal_model::data.C = THERMAL_MODEL_DEF(C);
|
||||
thermal_model::data.fS = THERMAL_MODEL_DEF(fS);
|
||||
thermal_model::data.L = (uint16_t)(THERMAL_MODEL_DEF(LAG) / (TEMP_MGR_INTV * 1000) + 0.5) * (uint16_t)(TEMP_MGR_INTV * 1000);
|
||||
for(uint8_t i = 0; i != THERMAL_MODEL_R_SIZE; ++i)
|
||||
thermal_model::data.R[i] = pgm_read_float(THERMAL_MODEL_R_DEFAULT + i);
|
||||
thermal_model::data.Ta_corr = THERMAL_MODEL_Ta_corr;
|
||||
thermal_model::data.warn = THERMAL_MODEL_DEF(W);
|
||||
thermal_model::data.err = THERMAL_MODEL_DEF(E);
|
||||
thermal_model::warn_beep = true;
|
||||
thermal_model::enabled = true;
|
||||
thermal_model::reinitialize();
|
||||
|
|
@ -2398,29 +2398,29 @@ void thermal_model_reset_settings()
|
|||
|
||||
void thermal_model_load_settings()
|
||||
{
|
||||
static_assert(TEMP_MODEL_R_SIZE == 16); // ensure we don't desync with the eeprom table
|
||||
static_assert(THERMAL_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, 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_DEF(U));
|
||||
eeprom_init_default_float((float*)EEPROM_TEMP_MODEL_V, TEMP_MODEL_DEF(V));
|
||||
eeprom_init_default_float((float*)EEPROM_TEMP_MODEL_D, TEMP_MODEL_DEF(fS));
|
||||
eeprom_init_default_word((uint16_t*)EEPROM_TEMP_MODEL_L, TEMP_MODEL_DEF(LAG));
|
||||
eeprom_init_default_byte((uint8_t*)EEPROM_TEMP_MODEL_VER, TEMP_MODEL_DEF(VER));
|
||||
eeprom_init_default_float((float*)EEPROM_THERMAL_MODEL_U, THERMAL_MODEL_DEF(U));
|
||||
eeprom_init_default_float((float*)EEPROM_THERMAL_MODEL_V, THERMAL_MODEL_DEF(V));
|
||||
eeprom_init_default_float((float*)EEPROM_THERMAL_MODEL_D, THERMAL_MODEL_DEF(fS));
|
||||
eeprom_init_default_word((uint16_t*)EEPROM_THERMAL_MODEL_L, THERMAL_MODEL_DEF(LAG));
|
||||
eeprom_init_default_byte((uint8_t*)EEPROM_THERMAL_MODEL_VER, THERMAL_MODEL_DEF(VER));
|
||||
|
||||
thermal_model::enabled = eeprom_read_byte((uint8_t*)EEPROM_TEMP_MODEL_ENABLE);
|
||||
thermal_model::data.P = eeprom_read_float((float*)EEPROM_TEMP_MODEL_P);
|
||||
thermal_model::data.U = eeprom_read_float((float*)EEPROM_TEMP_MODEL_U);
|
||||
thermal_model::data.V = eeprom_read_float((float*)EEPROM_TEMP_MODEL_V);
|
||||
thermal_model::data.C = eeprom_read_float((float*)EEPROM_TEMP_MODEL_C);
|
||||
thermal_model::data.fS = eeprom_read_float((float*)EEPROM_TEMP_MODEL_D);
|
||||
thermal_model_set_lag(eeprom_read_word((uint16_t*)EEPROM_TEMP_MODEL_L));
|
||||
for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i)
|
||||
thermal_model::data.R[i] = eeprom_read_float((float*)EEPROM_TEMP_MODEL_R + i);
|
||||
thermal_model::data.Ta_corr = eeprom_read_float((float*)EEPROM_TEMP_MODEL_Ta_corr);
|
||||
thermal_model::data.warn = eeprom_read_float((float*)EEPROM_TEMP_MODEL_W);
|
||||
thermal_model::data.err = eeprom_read_float((float*)EEPROM_TEMP_MODEL_E);
|
||||
thermal_model::enabled = eeprom_read_byte((uint8_t*)EEPROM_THERMAL_MODEL_ENABLE);
|
||||
thermal_model::data.P = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_P);
|
||||
thermal_model::data.U = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_U);
|
||||
thermal_model::data.V = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_V);
|
||||
thermal_model::data.C = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_C);
|
||||
thermal_model::data.fS = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_D);
|
||||
thermal_model_set_lag(eeprom_read_word((uint16_t*)EEPROM_THERMAL_MODEL_L));
|
||||
for(uint8_t i = 0; i != THERMAL_MODEL_R_SIZE; ++i)
|
||||
thermal_model::data.R[i] = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_R + i);
|
||||
thermal_model::data.Ta_corr = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_Ta_corr);
|
||||
thermal_model::data.warn = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_W);
|
||||
thermal_model::data.err = eeprom_read_float((float*)EEPROM_THERMAL_MODEL_E);
|
||||
|
||||
if(!thermal_model::calibrated()) {
|
||||
SERIAL_ECHOLNPGM("TM: stored calibration invalid, resetting");
|
||||
|
|
@ -2431,18 +2431,18 @@ void thermal_model_load_settings()
|
|||
|
||||
void thermal_model_save_settings()
|
||||
{
|
||||
eeprom_update_byte((uint8_t*)EEPROM_TEMP_MODEL_ENABLE, thermal_model::enabled);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_P, thermal_model::data.P);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_U, thermal_model::data.U);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_V, thermal_model::data.V);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_C, thermal_model::data.C);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_D, thermal_model::data.fS);
|
||||
eeprom_update_word((uint16_t*)EEPROM_TEMP_MODEL_L, thermal_model::data.L);
|
||||
for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i)
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_R + i, thermal_model::data.R[i]);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_Ta_corr, thermal_model::data.Ta_corr);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_W, thermal_model::data.warn);
|
||||
eeprom_update_float((float*)EEPROM_TEMP_MODEL_E, thermal_model::data.err);
|
||||
eeprom_update_byte((uint8_t*)EEPROM_THERMAL_MODEL_ENABLE, thermal_model::enabled);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_P, thermal_model::data.P);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_U, thermal_model::data.U);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_V, thermal_model::data.V);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_C, thermal_model::data.C);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_D, thermal_model::data.fS);
|
||||
eeprom_update_word((uint16_t*)EEPROM_THERMAL_MODEL_L, thermal_model::data.L);
|
||||
for(uint8_t i = 0; i != THERMAL_MODEL_R_SIZE; ++i)
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_R + i, thermal_model::data.R[i]);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_Ta_corr, thermal_model::data.Ta_corr);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_W, thermal_model::data.warn);
|
||||
eeprom_update_float((float*)EEPROM_THERMAL_MODEL_E, thermal_model::data.err);
|
||||
}
|
||||
|
||||
namespace thermal_model_cal {
|
||||
|
|
@ -2618,10 +2618,10 @@ static bool autotune(int16_t cal_temp)
|
|||
for(uint8_t i = 0; i != 2; ++i) {
|
||||
const char* PROGMEM verb = (i == 0? PSTR("initial"): PSTR("refine"));
|
||||
target_temperature[0] = 0;
|
||||
if(current_temperature[0] >= TEMP_MODEL_CAL_T_low) {
|
||||
sprintf_P(tm_message, PSTR("TM: cool down <%dC"), TEMP_MODEL_CAL_T_low);
|
||||
if(current_temperature[0] >= THERMAL_MODEL_CAL_T_low) {
|
||||
sprintf_P(tm_message, PSTR("TM: cool down <%dC"), THERMAL_MODEL_CAL_T_low);
|
||||
lcd_setstatus_serial(tm_message);
|
||||
cooldown(TEMP_MODEL_CAL_T_low);
|
||||
cooldown(THERMAL_MODEL_CAL_T_low);
|
||||
wait(10000);
|
||||
}
|
||||
|
||||
|
|
@ -2634,11 +2634,11 @@ static bool autotune(int16_t cal_temp)
|
|||
|
||||
// we need a high R value for the initial C guess
|
||||
if(isnan(thermal_model::data.R[0]))
|
||||
thermal_model::data.R[0] = TEMP_MODEL_CAL_R_high;
|
||||
thermal_model::data.R[0] = THERMAL_MODEL_CAL_R_high;
|
||||
|
||||
e = estimate(samples, &thermal_model::data.C,
|
||||
TEMP_MODEL_CAL_C_low, TEMP_MODEL_CAL_C_high,
|
||||
TEMP_MODEL_CAL_C_thr, TEMP_MODEL_CAL_C_itr,
|
||||
THERMAL_MODEL_CAL_C_low, THERMAL_MODEL_CAL_C_high,
|
||||
THERMAL_MODEL_CAL_C_thr, THERMAL_MODEL_CAL_C_itr,
|
||||
0, current_temperature_ambient);
|
||||
if(isnan(e))
|
||||
return true;
|
||||
|
|
@ -2654,8 +2654,8 @@ static bool autotune(int16_t cal_temp)
|
|||
return true;
|
||||
|
||||
e = estimate(samples, &thermal_model::data.R[0],
|
||||
TEMP_MODEL_CAL_R_low, TEMP_MODEL_CAL_R_high,
|
||||
TEMP_MODEL_CAL_R_thr, TEMP_MODEL_CAL_R_itr,
|
||||
THERMAL_MODEL_CAL_R_low, THERMAL_MODEL_CAL_R_high,
|
||||
THERMAL_MODEL_CAL_R_thr, THERMAL_MODEL_CAL_R_itr,
|
||||
0, current_temperature_ambient);
|
||||
if(isnan(e))
|
||||
return true;
|
||||
|
|
@ -2668,12 +2668,12 @@ static bool autotune(int16_t cal_temp)
|
|||
set_fan_speed(255);
|
||||
wait(30000);
|
||||
|
||||
for(int8_t i = TEMP_MODEL_R_SIZE - 1; i > 0; i -= TEMP_MODEL_CAL_R_STEP) {
|
||||
for(int8_t i = THERMAL_MODEL_R_SIZE - 1; i > 0; i -= THERMAL_MODEL_CAL_R_STEP) {
|
||||
// always disable the checker while estimating fan resistance as the difference
|
||||
// (esp with 3rd-party blowers) can be massive
|
||||
thermal_model::data.R[i] = NAN;
|
||||
|
||||
uint8_t speed = 256 / TEMP_MODEL_R_SIZE * (i + 1) - 1;
|
||||
uint8_t speed = 256 / THERMAL_MODEL_R_SIZE * (i + 1) - 1;
|
||||
set_fan_speed(speed);
|
||||
wait(10000);
|
||||
|
||||
|
|
@ -2686,7 +2686,7 @@ static bool autotune(int16_t cal_temp)
|
|||
// a fixed fan pwm (the norminal value) is used here, as soft_pwm_fan will be modified
|
||||
// during fan measurements and we'd like to include that skew during normal operation.
|
||||
e = estimate(samples, &thermal_model::data.R[i],
|
||||
TEMP_MODEL_CAL_R_low, thermal_model::data.R[0], TEMP_MODEL_CAL_R_thr, TEMP_MODEL_CAL_R_itr,
|
||||
THERMAL_MODEL_CAL_R_low, thermal_model::data.R[0], THERMAL_MODEL_CAL_R_thr, THERMAL_MODEL_CAL_R_itr,
|
||||
i, current_temperature_ambient);
|
||||
if(isnan(e))
|
||||
return true;
|
||||
|
|
@ -2694,15 +2694,15 @@ static bool autotune(int16_t cal_temp)
|
|||
|
||||
// interpolate remaining steps to speed-up calibration
|
||||
// TODO: verify that the sampled values are monotically increasing?
|
||||
int8_t next = TEMP_MODEL_R_SIZE - 1;
|
||||
for(uint8_t i = TEMP_MODEL_R_SIZE - 2; i != 0; --i) {
|
||||
if(!((TEMP_MODEL_R_SIZE - i - 1) % TEMP_MODEL_CAL_R_STEP)) {
|
||||
int8_t next = THERMAL_MODEL_R_SIZE - 1;
|
||||
for(uint8_t i = THERMAL_MODEL_R_SIZE - 2; i != 0; --i) {
|
||||
if(!((THERMAL_MODEL_R_SIZE - i - 1) % THERMAL_MODEL_CAL_R_STEP)) {
|
||||
next = i;
|
||||
continue;
|
||||
}
|
||||
int8_t prev = next - TEMP_MODEL_CAL_R_STEP;
|
||||
int8_t prev = next - THERMAL_MODEL_CAL_R_STEP;
|
||||
if(prev < 0) prev = 0;
|
||||
float f = (float)(i - prev) / TEMP_MODEL_CAL_R_STEP;
|
||||
float f = (float)(i - prev) / THERMAL_MODEL_CAL_R_STEP;
|
||||
float d = (thermal_model::data.R[next] - thermal_model::data.R[prev]);
|
||||
thermal_model::data.R[i] = thermal_model::data.R[prev] + d * f;
|
||||
}
|
||||
|
|
@ -2716,7 +2716,7 @@ static bool thermal_model_autotune_err = true;
|
|||
|
||||
void thermal_model_autotune(int16_t temp, bool selftest)
|
||||
{
|
||||
float orig_C, orig_R[TEMP_MODEL_R_SIZE];
|
||||
float orig_C, orig_R[THERMAL_MODEL_R_SIZE];
|
||||
bool orig_enabled;
|
||||
static_assert(sizeof(orig_R) == sizeof(thermal_model::data.R));
|
||||
|
||||
|
|
@ -2732,7 +2732,7 @@ void thermal_model_autotune(int16_t temp, bool selftest)
|
|||
|
||||
// lockout the printer during calibration
|
||||
KEEPALIVE_STATE(IN_PROCESS);
|
||||
menu_set_block(MENU_BLOCK_TEMP_MODEL_AUTOTUNE);
|
||||
menu_set_block(MENU_BLOCK_THERMAL_MODEL_AUTOTUNE);
|
||||
lcd_return_to_status();
|
||||
|
||||
// save the original model data and set the model checking state during self-calibration
|
||||
|
|
@ -2743,7 +2743,7 @@ void thermal_model_autotune(int16_t temp, bool selftest)
|
|||
|
||||
// autotune
|
||||
SERIAL_ECHOLNPGM("TM: calibration start");
|
||||
thermal_model_autotune_err = thermal_model_cal::autotune(temp > 0 ? temp : TEMP_MODEL_CAL_T_high);
|
||||
thermal_model_autotune_err = thermal_model_cal::autotune(temp > 0 ? temp : THERMAL_MODEL_CAL_T_high);
|
||||
|
||||
// always reset temperature
|
||||
disable_heater();
|
||||
|
|
@ -2762,7 +2762,7 @@ void thermal_model_autotune(int16_t temp, bool selftest)
|
|||
memcpy(thermal_model::data.R, orig_R, sizeof(thermal_model::data.R));
|
||||
thermal_model_set_enabled(orig_enabled);
|
||||
} else {
|
||||
calibration_status_set(CALIBRATION_STATUS_TEMP_MODEL);
|
||||
calibration_status_set(CALIBRATION_STATUS_THERMAL_MODEL);
|
||||
lcd_setstatuspgm(MSG_WELCOME);
|
||||
thermal_model_cal::set_fan_speed(0);
|
||||
thermal_model_set_enabled(orig_enabled);
|
||||
|
|
@ -2770,7 +2770,7 @@ void thermal_model_autotune(int16_t temp, bool selftest)
|
|||
}
|
||||
|
||||
lcd_consume_click();
|
||||
menu_unset_block(MENU_BLOCK_TEMP_MODEL_AUTOTUNE);
|
||||
menu_unset_block(MENU_BLOCK_THERMAL_MODEL_AUTOTUNE);
|
||||
}
|
||||
|
||||
bool thermal_model_autotune_result()
|
||||
|
|
@ -2778,7 +2778,7 @@ bool thermal_model_autotune_result()
|
|||
return !thermal_model_autotune_err;
|
||||
}
|
||||
|
||||
#ifdef TEMP_MODEL_DEBUG
|
||||
#ifdef THERMAL_MODEL_DEBUG
|
||||
void thermal_model_log_enable(bool enable)
|
||||
{
|
||||
if(enable) {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ FORCE_INLINE void autotempShutdown(){
|
|||
|
||||
void PID_autotune(float temp, int extruder, int ncycles);
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
bool thermal_model_enabled(); // return temperature model state
|
||||
void thermal_model_set_enabled(bool enabled);
|
||||
void thermal_model_set_warn_beep(bool enabled);
|
||||
|
|
@ -190,7 +190,7 @@ void thermal_model_save_settings();
|
|||
void thermal_model_autotune(int16_t temp = 0, bool selftest = false);
|
||||
bool thermal_model_autotune_result(); // return true if the last autotune was complete and successful
|
||||
|
||||
#ifdef TEMP_MODEL_DEBUG
|
||||
#ifdef THERMAL_MODEL_DEBUG
|
||||
void thermal_model_log_enable(bool enable);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -887,7 +887,7 @@ void lcd_commands()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
if (lcd_commands_type == LcdCommands::TempModel && cmd_buffer_empty())
|
||||
{
|
||||
switch (lcd_commands_step)
|
||||
|
|
@ -931,15 +931,15 @@ void lcd_commands()
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
|
||||
if (lcd_commands_type == LcdCommands::NozzleCNG)
|
||||
{
|
||||
if (!blocks_queued() && cmd_buffer_empty() && !saved_printing)
|
||||
{
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
static bool was_enabled;
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
switch(lcd_commands_step)
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -953,10 +953,10 @@ void lcd_commands()
|
|||
enquecommand_P(G28W);
|
||||
enquecommand_P(PSTR("G1 X125 Z200 F1000"));
|
||||
enquecommand_P(PSTR("M109 S280"));
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
was_enabled = thermal_model_enabled();
|
||||
thermal_model_set_enabled(false);
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
lcd_commands_step = 2;
|
||||
break;
|
||||
case 2:
|
||||
|
|
@ -969,9 +969,9 @@ void lcd_commands()
|
|||
lcd_update_enabled = false; //hack to avoid lcd_update recursion.
|
||||
if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_NOZZLE_CNG_CHANGED), false) == LCD_LEFT_BUTTON_CHOICE) {
|
||||
setTargetHotend(0);
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model_set_enabled(was_enabled);
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
lcd_commands_step = 1;
|
||||
}
|
||||
lcd_update_enabled = true;
|
||||
|
|
@ -3802,10 +3802,10 @@ void lcd_wizard(WizState state)
|
|||
state = S::Xyz;
|
||||
} else if (!calibration_status_get(CALIBRATION_STATUS_Z)) {
|
||||
state = S::Z;
|
||||
#ifdef TEMP_MODEL
|
||||
} else if (!calibration_status_get(CALIBRATION_STATUS_TEMP_MODEL)) {
|
||||
#ifdef THERMAL_MODEL
|
||||
} else if (!calibration_status_get(CALIBRATION_STATUS_THERMAL_MODEL)) {
|
||||
state = S::TempModel;
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
} else if (!calibration_status_get(CALIBRATION_STATUS_LIVE_ADJUST)) {
|
||||
state = S::IsFil;
|
||||
} else {
|
||||
|
|
@ -3847,13 +3847,13 @@ void lcd_wizard(WizState state)
|
|||
state = S::Restore;
|
||||
}
|
||||
break;
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
case S::TempModel:
|
||||
lcd_show_fullscreen_message_and_wait_P(_i("Thermal model cal. takes approx. 12 mins. See\nprusa.io/tm-cal"));////MSG_TM_CAL c=20 r=4
|
||||
lcd_commands_type = LcdCommands::TempModel;
|
||||
end = true; // Leave wizard temporarily for TM cal.
|
||||
break;
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
case S::IsFil:
|
||||
//start to preheat nozzle and bed to save some time later
|
||||
setTargetHotend(PLA_PREHEAT_HOTEND_TEMP);
|
||||
|
|
@ -4551,9 +4551,9 @@ static void lcd_calibration_menu()
|
|||
MENU_ITEM_FUNCTION_P(_T(MSG_PINDA_CALIBRATION), lcd_calibrate_pinda);
|
||||
#endif
|
||||
}
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
MENU_ITEM_SUBMENU_P(_n("Thermal Model cal."), lcd_thermal_model_cal);
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
|
||||
MENU_END();
|
||||
}
|
||||
|
|
@ -5173,7 +5173,7 @@ static void lcd_main_menu()
|
|||
if((printJobOngoing() || isPrintPaused) && (custom_message_type != CustomMsg::MeshBedLeveling) && !processing_tcode) {
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
|
||||
}
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
else if(Stopped) {
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_TM_ACK_ERROR), lcd_print_stop);
|
||||
}
|
||||
|
|
@ -5591,13 +5591,13 @@ void lcd_print_stop()
|
|||
print_stop(true);
|
||||
}
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
void lcd_thermal_model_cal()
|
||||
{
|
||||
lcd_commands_type = LcdCommands::TempModel;
|
||||
lcd_return_to_status();
|
||||
}
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
|
||||
void lcd_sdcard_stop()
|
||||
{
|
||||
|
|
@ -6447,10 +6447,10 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
|
|||
|
||||
target_temperature[0] = (_isbed) ? 0 : 200;
|
||||
target_temperature_bed = (_isbed) ? 100 : 0;
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
bool tm_was_enabled = thermal_model_enabled();
|
||||
thermal_model_set_enabled(false);
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
|
||||
|
|
@ -6499,9 +6499,9 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
|
|||
lcd_selftest_error(TestError::Bed, "", "");
|
||||
}
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
thermal_model_set_enabled(tm_was_enabled);
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
return _stepresult;
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ void lcd_pause_usb_print();
|
|||
void lcd_resume_print();
|
||||
void lcd_print_stop(); // interactive print stop
|
||||
void print_stop(bool interactive=false);
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
void lcd_thermal_model_cal();
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
void lcd_load_filament_color_check();
|
||||
|
||||
extern void lcd_belttest();
|
||||
|
|
@ -117,9 +117,9 @@ enum class LcdCommands : uint_least8_t
|
|||
LongPause,
|
||||
PidExtruder,
|
||||
Layer1Cal,
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
TempModel,
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
NozzleCNG,
|
||||
};
|
||||
|
||||
|
|
@ -225,9 +225,9 @@ enum class WizState : uint8_t
|
|||
Selftest, //!< self test
|
||||
Xyz, //!< xyz calibration
|
||||
Z, //!< z calibration
|
||||
#ifdef TEMP_MODEL
|
||||
#ifdef THERMAL_MODEL
|
||||
TempModel, //!< Temp model calibration
|
||||
#endif //TEMP_MODEL
|
||||
#endif //THERMAL_MODEL
|
||||
IsFil, //!< Is filament loaded? First step of 1st layer calibration
|
||||
Preheat, //!< Preheat for any material
|
||||
LoadFilCold, //!< Load filament for MMU
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ typedef uint8_t CalibrationStatus;
|
|||
const CalibrationStatus CALIBRATION_STATUS_SELFTEST = 0b00000001; // Selftest
|
||||
const CalibrationStatus CALIBRATION_STATUS_XYZ = 0b00000010; // XYZ calibration
|
||||
const CalibrationStatus CALIBRATION_STATUS_Z = 0b00000100; // Z calibration
|
||||
#ifdef TEMP_MODEL
|
||||
const CalibrationStatus CALIBRATION_STATUS_TEMP_MODEL = 0b00001000; // Temperature model calibration
|
||||
#ifdef THERMAL_MODEL
|
||||
const CalibrationStatus CALIBRATION_STATUS_THERMAL_MODEL = 0b00001000; // Temperature model calibration
|
||||
#endif
|
||||
const CalibrationStatus CALIBRATION_STATUS_LIVE_ADJUST = 0b00010000; // 1st layer calibration
|
||||
const CalibrationStatus CALIBRATION_STATUS_UNKNOWN = 0b10000000; // Freshly assembled or unknown status
|
||||
|
|
@ -117,8 +117,8 @@ const CalibrationStatus CALIBRATION_WIZARD_STEPS =
|
|||
CALIBRATION_STATUS_SELFTEST |
|
||||
CALIBRATION_STATUS_XYZ |
|
||||
CALIBRATION_STATUS_Z |
|
||||
#ifdef TEMP_MODEL
|
||||
CALIBRATION_STATUS_TEMP_MODEL |
|
||||
#ifdef THERMAL_MODEL
|
||||
CALIBRATION_STATUS_THERMAL_MODEL |
|
||||
#endif
|
||||
CALIBRATION_STATUS_LIVE_ADJUST;
|
||||
|
||||
|
|
|
|||
|
|
@ -384,26 +384,26 @@
|
|||
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
|
||||
|
||||
// model-based temperature check
|
||||
#define TEMP_MODEL 1 // enable model-based temperature checks
|
||||
#define TEMP_MODEL_DEBUG 1 // extended runtime logging
|
||||
#define THERMAL_MODEL 1 // enable model-based temperature checks
|
||||
#define THERMAL_MODEL_DEBUG 1 // extended runtime logging
|
||||
|
||||
#define TEMP_MODEL_CAL_C_low 5 // C estimation lower limit
|
||||
#define TEMP_MODEL_CAL_C_high 20 // C estimation upper limit
|
||||
#define TEMP_MODEL_CAL_C_thr 0.01 // C estimation iteration threshold
|
||||
#define TEMP_MODEL_CAL_C_itr 30 // C estimation iteration limit
|
||||
#define THERMAL_MODEL_CAL_C_low 5 // C estimation lower limit
|
||||
#define THERMAL_MODEL_CAL_C_high 20 // C estimation upper limit
|
||||
#define THERMAL_MODEL_CAL_C_thr 0.01 // C estimation iteration threshold
|
||||
#define THERMAL_MODEL_CAL_C_itr 30 // C estimation iteration limit
|
||||
|
||||
#define TEMP_MODEL_CAL_R_low 5 // R estimation lower limit
|
||||
#define TEMP_MODEL_CAL_R_high 50 // R estimation upper limit
|
||||
#define TEMP_MODEL_CAL_R_thr 0.01 // R estimation iteration threshold
|
||||
#define TEMP_MODEL_CAL_R_itr 30 // R estimation iteration limit
|
||||
#define THERMAL_MODEL_CAL_R_low 5 // R estimation lower limit
|
||||
#define THERMAL_MODEL_CAL_R_high 50 // R estimation upper limit
|
||||
#define THERMAL_MODEL_CAL_R_thr 0.01 // R estimation iteration threshold
|
||||
#define THERMAL_MODEL_CAL_R_itr 30 // R estimation iteration limit
|
||||
|
||||
#define TEMP_MODEL_CAL_T_low 50 // Default calibration cooling temperature (C)
|
||||
#define TEMP_MODEL_CAL_T_high 230 // Default calibration working temperature (C)
|
||||
#define THERMAL_MODEL_CAL_T_low 50 // Default calibration cooling temperature (C)
|
||||
#define THERMAL_MODEL_CAL_T_high 230 // Default calibration working temperature (C)
|
||||
|
||||
#define TEMP_MODEL_Ta_corr -7 // Default ambient temperature correction
|
||||
#define THERMAL_MODEL_Ta_corr -7 // Default ambient temperature correction
|
||||
|
||||
#include "thermal_model/e3d_v6.h"
|
||||
#define TEMP_MODEL_DEFAULT E3D_V6 // Default model parameters
|
||||
#define THERMAL_MODEL_DEFAULT E3D_V6 // Default model parameters
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
|
|
|
|||
|
|
@ -388,26 +388,26 @@
|
|||
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
|
||||
|
||||
// model-based temperature check
|
||||
#define TEMP_MODEL 1 // enable model-based temperature checks
|
||||
#define TEMP_MODEL_DEBUG 1 // extended runtime logging
|
||||
#define THERMAL_MODEL 1 // enable model-based temperature checks
|
||||
#define THERMAL_MODEL_DEBUG 1 // extended runtime logging
|
||||
|
||||
#define TEMP_MODEL_CAL_C_low 5 // C estimation lower limit
|
||||
#define TEMP_MODEL_CAL_C_high 20 // C estimation upper limit
|
||||
#define TEMP_MODEL_CAL_C_thr 0.01 // C estimation iteration threshold
|
||||
#define TEMP_MODEL_CAL_C_itr 30 // C estimation iteration limit
|
||||
#define THERMAL_MODEL_CAL_C_low 5 // C estimation lower limit
|
||||
#define THERMAL_MODEL_CAL_C_high 20 // C estimation upper limit
|
||||
#define THERMAL_MODEL_CAL_C_thr 0.01 // C estimation iteration threshold
|
||||
#define THERMAL_MODEL_CAL_C_itr 30 // C estimation iteration limit
|
||||
|
||||
#define TEMP_MODEL_CAL_R_low 5 // R estimation lower limit
|
||||
#define TEMP_MODEL_CAL_R_high 50 // R estimation upper limit
|
||||
#define TEMP_MODEL_CAL_R_thr 0.01 // R estimation iteration threshold
|
||||
#define TEMP_MODEL_CAL_R_itr 30 // R estimation iteration limit
|
||||
#define THERMAL_MODEL_CAL_R_low 5 // R estimation lower limit
|
||||
#define THERMAL_MODEL_CAL_R_high 50 // R estimation upper limit
|
||||
#define THERMAL_MODEL_CAL_R_thr 0.01 // R estimation iteration threshold
|
||||
#define THERMAL_MODEL_CAL_R_itr 30 // R estimation iteration limit
|
||||
|
||||
#define TEMP_MODEL_CAL_T_low 50 // Default calibration cooling temperature (C)
|
||||
#define TEMP_MODEL_CAL_T_high 230 // Default calibration working temperature (C)
|
||||
#define THERMAL_MODEL_CAL_T_low 50 // Default calibration cooling temperature (C)
|
||||
#define THERMAL_MODEL_CAL_T_high 230 // Default calibration working temperature (C)
|
||||
|
||||
#define TEMP_MODEL_Ta_corr -7 // Default ambient temperature correction
|
||||
#define THERMAL_MODEL_Ta_corr -7 // Default ambient temperature correction
|
||||
|
||||
#include "thermal_model/e3d_v6.h"
|
||||
#define TEMP_MODEL_DEFAULT E3D_V6 // Default model parameters
|
||||
#define THERMAL_MODEL_DEFAULT E3D_V6 // Default model parameters
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue