diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index b5f2b0ddb..aaa2089b2 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -103,8 +103,8 @@ 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 - temp_model_report_settings(); +#ifdef THERMAL_MODEL + thermal_model_report_settings(); #endif } #endif @@ -182,8 +182,8 @@ void Config_StoreSettings() { strcpy_P(cs.version, default_conf.version); eeprom_update_block(reinterpret_cast(&cs), reinterpret_cast(EEPROM_M500_base), sizeof(cs)); -#ifdef TEMP_MODEL - temp_model_save_settings(); +#ifdef THERMAL_MODEL + thermal_model_save_settings(); #endif SERIAL_ECHO_START; @@ -246,8 +246,8 @@ bool Config_RetrieveSettings() // Call updatePID (similar to when we have processed M301) updatePID(); -#ifdef TEMP_MODEL - temp_model_load_settings(); +#ifdef THERMAL_MODEL + thermal_model_load_settings(); #endif SERIAL_ECHO_START; @@ -276,8 +276,8 @@ void Config_ResetDefault() #ifdef PIDTEMP updatePID(); #endif//PIDTEMP -#ifdef TEMP_MODEL - temp_model_reset_settings(); +#ifdef THERMAL_MODEL + thermal_model_reset_settings(); #endif calculate_extruder_multipliers(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e301995bf..cb0e89102 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -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) && temp_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 } } @@ -3932,7 +3932,7 @@ extern uint8_t st_backlash_y; //!@n M302 - Allow cold extrudes, or set the minimum extrude S. //!@n M303 - PID relay autotune S sets the target temperature. (default target temperature = 150C) //!@n M304 - Set bed PID parameters P I and D -//!@n M310 - Temperature model settings +//!@n M310 - Thermal model settings //!@n M400 - Finish all moves //!@n M401 - Lower z-probe if present //!@n M402 - Raise z-probe if present @@ -7330,9 +7330,9 @@ Sigma_Exit: } break; -#ifdef TEMP_MODEL +#ifdef THERMAL_MODEL /*! - ### M310 - Temperature model settings M310: Temperature model settings + ### M310 - Thermal model settings M310: Thermal model settings #### Usage M310 ; report values @@ -7386,23 +7386,23 @@ Sigma_Exit: // report values if nothing has been requested if(isnan(R) && isnan(P) && isnan(U) && isnan(V) && isnan(C) && isnan(D) && isnan(T) && isnan(W) && isnan(E) && I < 0 && S < 0 && B < 0 && A < 0 && L < 0) { - temp_model_report_settings(); + thermal_model_report_settings(); break; } // update all parameters if(B >= 0) - temp_model_set_warn_beep(B); + thermal_model_set_warn_beep(B); if(!isnan(P) || !isnan(U) || !isnan(V) || !isnan(C) || !isnan(D) || (L >= 0) || !isnan(T) || !isnan(W) || !isnan(E)) - temp_model_set_params(P, U, V, C, D, L, T, W, E); + thermal_model_set_params(P, U, V, C, D, L, T, W, E); if(I >= 0 && !isnan(R)) - temp_model_set_resistance(I, R); + thermal_model_set_resistance(I, R); // enable the model last, if requested - if(S >= 0) temp_model_set_enabled(S); + if(S >= 0) thermal_model_set_enabled(S); // run autotune - if(A >= 0) temp_model_autotune(A, F > 0); + if(A >= 0) thermal_model_autotune(A, F > 0); } break; #endif @@ -8878,9 +8878,9 @@ Sigma_Exit: }; #endif -#ifdef TEMP_MODEL_DEBUG +#ifdef THERMAL_MODEL_DEBUG /*! - ## D70 - Enable low-level temperature model logging for offline simulation + ## D70 - Enable low-level thermal model logging for offline simulation #### Usage D70 [ S ] @@ -8890,7 +8890,7 @@ Sigma_Exit: */ case 70: { if(code_seen('S')) - temp_model_log_enable(code_value_short()); + thermal_model_log_enable(code_value_short()); break; } #endif diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index aefc50628..cc6546b6f 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -92,7 +92,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP | 0x0FF7 4087 | uint8 | EEPROM_CALIBRATION_STATUS_V1 | ffh 255 | ffh 255 | Calibration status ( 0)) return false; if(!(data.Ta_corr != NAN)) return false; - for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i) { - if(!(temp_model::data.R[i] >= 0)) + for(uint8_t i = 0; i != THERMAL_MODEL_R_SIZE; ++i) { + if(!(thermal_model::data.R[i] >= 0)) return false; } if(!(data.warn != NAN)) return false; @@ -2198,7 +2198,7 @@ static void check() warning_state.assert = data.flag_bits.warning; if(warning_state.assert) { warning_state.warning = true; - warning_state.dT_err = temp_model::data.dT_err_prev; + warning_state.dT_err = thermal_model::data.dT_err_prev; } } @@ -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; @@ -2281,42 +2281,42 @@ static void log_isr() } #endif -} // namespace temp_model +} // namespace thermal_model -static void temp_model_reset_enabled(bool enabled) +static void thermal_model_reset_enabled(bool enabled) { TempMgrGuard temp_mgr_guard; - temp_model::enabled = enabled; - temp_model::reinitialize(); + thermal_model::enabled = enabled; + thermal_model::reinitialize(); } -bool temp_model_enabled() +bool thermal_model_enabled() { - return temp_model::enabled; + return thermal_model::enabled; } -void temp_model_set_enabled(bool enabled) +void thermal_model_set_enabled(bool enabled) { // set the enabled flag { TempMgrGuard temp_mgr_guard; - temp_model::enabled = enabled; - temp_model::setup(); + thermal_model::enabled = enabled; + thermal_model::setup(); } // verify that the model has been enabled - if(enabled && !temp_model::enabled) + if(enabled && !thermal_model::enabled) SERIAL_ECHOLNPGM("TM: invalid parameters, cannot enable"); } -void temp_model_set_warn_beep(bool enabled) +void thermal_model_set_warn_beep(bool enabled) { - temp_model::warn_beep = enabled; + thermal_model::warn_beep = enabled; } // set the model lag rounding to the effective sample resolution, ensuring the reported/stored lag // matches the current model constraints (future-proofing for model changes) -static void temp_model_set_lag(uint16_t ms) +static void thermal_model_set_lag(uint16_t ms) { static const uint16_t intv_ms = (uint16_t)(TEMP_MGR_INTV * 1000); uint16_t samples = ((ms + intv_ms/2) / intv_ms); @@ -2324,128 +2324,128 @@ static void temp_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 - temp_model::data.L = samples * intv_ms; + thermal_model::data.L = samples * intv_ms; } -void temp_model_set_params(float P, float U, float V, float C, float D, int16_t L, float Ta_corr, float warn, float err) +void thermal_model_set_params(float P, float U, float V, float C, float D, int16_t L, float Ta_corr, float warn, float err) { TempMgrGuard temp_mgr_guard; - if(!isnan(P) && P > 0) temp_model::data.P = P; - if(!isnan(U)) temp_model::data.U = U; - if(!isnan(V)) temp_model::data.V = V; - if(!isnan(C) && C > 0) temp_model::data.C = C; - if(!isnan(D)) temp_model::data.fS = D; - if(L >= 0) temp_model_set_lag(L); - if(!isnan(Ta_corr)) temp_model::data.Ta_corr = Ta_corr; - if(!isnan(warn) && warn > 0) temp_model::data.warn = warn; - if(!isnan(err) && err > 0) temp_model::data.err = err; + if(!isnan(P) && P > 0) thermal_model::data.P = P; + if(!isnan(U)) thermal_model::data.U = U; + if(!isnan(V)) thermal_model::data.V = V; + if(!isnan(C) && C > 0) thermal_model::data.C = C; + if(!isnan(D)) thermal_model::data.fS = D; + if(L >= 0) thermal_model_set_lag(L); + if(!isnan(Ta_corr)) thermal_model::data.Ta_corr = Ta_corr; + if(!isnan(warn) && warn > 0) thermal_model::data.warn = warn; + if(!isnan(err) && err > 0) thermal_model::data.err = err; // ensure warn <= err - if (temp_model::data.warn > temp_model::data.err) - temp_model::data.warn = temp_model::data.err; + if (thermal_model::data.warn > thermal_model::data.err) + thermal_model::data.warn = thermal_model::data.err; - temp_model::setup(); + thermal_model::setup(); } -void temp_model_set_resistance(uint8_t index, float R) +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; - temp_model::data.R[index] = R; - temp_model::setup(); + thermal_model::data.R[index] = R; + thermal_model::setup(); } -void temp_model_report_settings() +void thermal_model_report_settings() { SERIAL_ECHO_START; - SERIAL_ECHOLNPGM("Temperature Model settings:"); - for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i) - printf_P(PSTR("%S M310 I%u R%.2f\n"), echomagic, (unsigned)i, (double)temp_model::data.R[i]); + SERIAL_ECHOLNPGM("Thermal Model settings:"); + 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)temp_model::data.P, (double)temp_model::data.U, (double)temp_model::data.V, - (double)temp_model::data.C, (double)temp_model::data.fS, (unsigned)temp_model::data.L, - (unsigned)temp_model::enabled, (unsigned)temp_model::warn_beep, - (double)temp_model::data.err, (double)temp_model::data.warn, - (double)temp_model::data.Ta_corr); + echomagic, (double)thermal_model::data.P, (double)thermal_model::data.U, (double)thermal_model::data.V, + (double)thermal_model::data.C, (double)thermal_model::data.fS, (unsigned)thermal_model::data.L, + (unsigned)thermal_model::enabled, (unsigned)thermal_model::warn_beep, + (double)thermal_model::data.err, (double)thermal_model::data.warn, + (double)thermal_model::data.Ta_corr); } -void temp_model_reset_settings() +void thermal_model_reset_settings() { TempMgrGuard temp_mgr_guard; - temp_model::data.P = TEMP_MODEL_DEF(P); - temp_model::data.U = TEMP_MODEL_DEF(U); - temp_model::data.V = TEMP_MODEL_DEF(V); - temp_model::data.C = TEMP_MODEL_DEF(C); - temp_model::data.fS = TEMP_MODEL_DEF(fS); - temp_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) - temp_model::data.R[i] = pgm_read_float(TEMP_MODEL_R_DEFAULT + i); - temp_model::data.Ta_corr = TEMP_MODEL_Ta_corr; - temp_model::data.warn = TEMP_MODEL_DEF(W); - temp_model::data.err = TEMP_MODEL_DEF(E); - temp_model::warn_beep = true; - temp_model::enabled = true; - temp_model::reinitialize(); + 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(); } -void temp_model_load_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)); - temp_model::enabled = eeprom_read_byte((uint8_t*)EEPROM_TEMP_MODEL_ENABLE); - temp_model::data.P = eeprom_read_float((float*)EEPROM_TEMP_MODEL_P); - temp_model::data.U = eeprom_read_float((float*)EEPROM_TEMP_MODEL_U); - temp_model::data.V = eeprom_read_float((float*)EEPROM_TEMP_MODEL_V); - temp_model::data.C = eeprom_read_float((float*)EEPROM_TEMP_MODEL_C); - temp_model::data.fS = eeprom_read_float((float*)EEPROM_TEMP_MODEL_D); - temp_model_set_lag(eeprom_read_word((uint16_t*)EEPROM_TEMP_MODEL_L)); - for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i) - temp_model::data.R[i] = eeprom_read_float((float*)EEPROM_TEMP_MODEL_R + i); - temp_model::data.Ta_corr = eeprom_read_float((float*)EEPROM_TEMP_MODEL_Ta_corr); - temp_model::data.warn = eeprom_read_float((float*)EEPROM_TEMP_MODEL_W); - temp_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(!temp_model::calibrated()) { + if(!thermal_model::calibrated()) { SERIAL_ECHOLNPGM("TM: stored calibration invalid, resetting"); - temp_model_reset_settings(); + thermal_model_reset_settings(); } - temp_model::setup(); + thermal_model::setup(); } -void temp_model_save_settings() +void thermal_model_save_settings() { - eeprom_update_byte((uint8_t*)EEPROM_TEMP_MODEL_ENABLE, temp_model::enabled); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_P, temp_model::data.P); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_U, temp_model::data.U); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_V, temp_model::data.V); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_C, temp_model::data.C); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_D, temp_model::data.fS); - eeprom_update_word((uint16_t*)EEPROM_TEMP_MODEL_L, temp_model::data.L); - for(uint8_t i = 0; i != TEMP_MODEL_R_SIZE; ++i) - eeprom_update_float((float*)EEPROM_TEMP_MODEL_R + i, temp_model::data.R[i]); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_Ta_corr, temp_model::data.Ta_corr); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_W, temp_model::data.warn); - eeprom_update_float((float*)EEPROM_TEMP_MODEL_E, temp_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 temp_model_cal { +namespace thermal_model_cal { // set current fan speed for both front/backend static __attribute__((noinline)) void set_fan_speed(uint8_t fan_speed) @@ -2491,7 +2491,7 @@ static void cooldown(float temp) set_fan_speed(255); while(current_temperature[0] >= temp) { if(temp_error_state.v) break; - float ambient = current_temperature_ambient + temp_model::data.Ta_corr; + float ambient = current_temperature_ambient + thermal_model::data.Ta_corr; if(current_temperature[0] < (ambient + TEMP_HYSTERESIS)) { // do not get stuck waiting very close to ambient temperature break; @@ -2539,12 +2539,12 @@ static uint16_t record(uint16_t samples = REC_BUFFER_SIZE) { static float cost_fn(uint16_t samples, float* const var, float v, uint8_t fan_pwm, float ambient) { *var = v; - temp_model::data.reset(rec_buffer[0].pwm, fan_pwm, rec_buffer[0].temp, ambient); + thermal_model::data.reset(rec_buffer[0].pwm, fan_pwm, rec_buffer[0].temp, ambient); float err = 0; uint16_t cnt = 0; for(uint16_t i = 1; i < samples; ++i) { - temp_model::data.step(rec_buffer[i].pwm, fan_pwm, rec_buffer[i].temp, ambient); - float err_v = temp_model::data.dT_err_prev; + thermal_model::data.step(rec_buffer[i].pwm, fan_pwm, rec_buffer[i].temp, ambient); + float err_v = thermal_model::data.dT_err_prev; if(!isnan(err_v)) { err += err_v * err_v; ++cnt; @@ -2569,8 +2569,8 @@ static float estimate(uint16_t samples, { // during estimation we alter the model values without an extra copy to conserve memory // so we cannot keep the main checker active until a value has been found - bool was_enabled = temp_model::enabled; - temp_model_reset_enabled(false); + bool was_enabled = thermal_model::enabled; + thermal_model_reset_enabled(false); float orig = *var; float e = NAN; @@ -2595,14 +2595,14 @@ static float estimate(uint16_t samples, } *var = x; - temp_model_reset_enabled(was_enabled); + thermal_model_reset_enabled(was_enabled); return e; } } SERIAL_ECHOLNPGM("TM estimation did not converge"); *var = orig; - temp_model_reset_enabled(was_enabled); + thermal_model_reset_enabled(was_enabled); return NAN; } @@ -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); } @@ -2633,12 +2633,12 @@ static bool autotune(int16_t cal_temp) return true; // we need a high R value for the initial C guess - if(isnan(temp_model::data.R[0])) - temp_model::data.R[0] = TEMP_MODEL_CAL_R_high; + if(isnan(thermal_model::data.R[0])) + thermal_model::data.R[0] = THERMAL_MODEL_CAL_R_high; - e = estimate(samples, &temp_model::data.C, - TEMP_MODEL_CAL_C_low, TEMP_MODEL_CAL_C_high, - TEMP_MODEL_CAL_C_thr, TEMP_MODEL_CAL_C_itr, + e = estimate(samples, &thermal_model::data.C, + 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; @@ -2653,9 +2653,9 @@ static bool autotune(int16_t cal_temp) if(temp_error_state.v || !samples) return true; - e = estimate(samples, &temp_model::data.R[0], - TEMP_MODEL_CAL_R_low, TEMP_MODEL_CAL_R_high, - TEMP_MODEL_CAL_R_thr, TEMP_MODEL_CAL_R_itr, + e = estimate(samples, &thermal_model::data.R[0], + 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 - temp_model::data.R[i] = NAN; + 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); @@ -2685,8 +2685,8 @@ 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, &temp_model::data.R[i], - TEMP_MODEL_CAL_R_low, temp_model::data.R[0], TEMP_MODEL_CAL_R_thr, TEMP_MODEL_CAL_R_itr, + e = estimate(samples, &thermal_model::data.R[i], + 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,34 +2694,34 @@ 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 d = (temp_model::data.R[next] - temp_model::data.R[prev]); - temp_model::data.R[i] = temp_model::data.R[prev] + d * f; + 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; } return false; } -} // namespace temp_model_cal +} // namespace thermal_model_cal -static bool temp_model_autotune_err = true; +static bool thermal_model_autotune_err = true; -void temp_model_autotune(int16_t temp, bool selftest) +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(temp_model::data.R)); + static_assert(sizeof(orig_R) == sizeof(thermal_model::data.R)); // fail-safe error state - temp_model_autotune_err = true; + thermal_model_autotune_err = true; char tm_message[LCD_WIDTH+1]; if(moves_planned() || printer_active()) { @@ -2732,60 +2732,60 @@ void temp_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 - orig_C = temp_model::data.C; - memcpy(orig_R, temp_model::data.R, sizeof(temp_model::data.R)); - orig_enabled = temp_model::enabled; - temp_model_reset_enabled(selftest); + orig_C = thermal_model::data.C; + memcpy(orig_R, thermal_model::data.R, sizeof(thermal_model::data.R)); + orig_enabled = thermal_model::enabled; + thermal_model_reset_enabled(selftest); // autotune SERIAL_ECHOLNPGM("TM: calibration start"); - temp_model_autotune_err = temp_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(); - if(temp_model_autotune_err) { + if(thermal_model_autotune_err) { sprintf_P(tm_message, PSTR("TM: calibr. failed!")); lcd_setstatus_serial(tm_message); if(temp_error_state.v) - temp_model_cal::set_fan_speed(255); + thermal_model_cal::set_fan_speed(255); // show calibrated values before overwriting them - temp_model_report_settings(); + thermal_model_report_settings(); // restore original state - temp_model::data.C = orig_C; - memcpy(temp_model::data.R, orig_R, sizeof(temp_model::data.R)); - temp_model_set_enabled(orig_enabled); + thermal_model::data.C = orig_C; + 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); - temp_model_cal::set_fan_speed(0); - temp_model_set_enabled(orig_enabled); - temp_model_report_settings(); + thermal_model_cal::set_fan_speed(0); + thermal_model_set_enabled(orig_enabled); + thermal_model_report_settings(); } lcd_consume_click(); - menu_unset_block(MENU_BLOCK_TEMP_MODEL_AUTOTUNE); + menu_unset_block(MENU_BLOCK_THERMAL_MODEL_AUTOTUNE); } -bool temp_model_autotune_result() +bool thermal_model_autotune_result() { - return !temp_model_autotune_err; + return !thermal_model_autotune_err; } -#ifdef TEMP_MODEL_DEBUG -void temp_model_log_enable(bool enable) +#ifdef THERMAL_MODEL_DEBUG +void thermal_model_log_enable(bool enable) { if(enable) { TempMgrGuard temp_mgr_guard; - temp_model::log_buf.entry.stamp = _millis(); + thermal_model::log_buf.entry.stamp = _millis(); } - temp_model::log_buf.enabled = enable; + thermal_model::log_buf.enabled = enable; } #endif #endif diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 1e0a5c148..e7f419a83 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -174,24 +174,24 @@ FORCE_INLINE void autotempShutdown(){ void PID_autotune(float temp, int extruder, int ncycles); -#ifdef TEMP_MODEL -bool temp_model_enabled(); // return temperature model state -void temp_model_set_enabled(bool enabled); -void temp_model_set_warn_beep(bool enabled); -void temp_model_set_params(float P=NAN, float U=NAN, float V=NAN, float C=NAN, float D=NAN, +#ifdef THERMAL_MODEL +bool thermal_model_enabled(); // return thermal model state +void thermal_model_set_enabled(bool enabled); +void thermal_model_set_warn_beep(bool enabled); +void thermal_model_set_params(float P=NAN, float U=NAN, float V=NAN, float C=NAN, float D=NAN, int16_t L=-1, float Ta_corr=NAN, float warn=NAN, float err=NAN); -void temp_model_set_resistance(uint8_t index, float R); +void thermal_model_set_resistance(uint8_t index, float R); -void temp_model_report_settings(); -void temp_model_reset_settings(); -void temp_model_load_settings(); -void temp_model_save_settings(); +void thermal_model_report_settings(); +void thermal_model_reset_settings(); +void thermal_model_load_settings(); +void thermal_model_save_settings(); -void temp_model_autotune(int16_t temp = 0, bool selftest = false); -bool temp_model_autotune_result(); // return true if the last autotune was complete and successful +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 -void temp_model_log_enable(bool enable); +#ifdef THERMAL_MODEL_DEBUG +void thermal_model_log_enable(bool enable); #endif #endif diff --git a/Firmware/temp_model.h b/Firmware/thermal_model.h similarity index 69% rename from Firmware/temp_model.h rename to Firmware/thermal_model.h index 0fb4206a3..c0162fa62 100644 --- a/Firmware/temp_model.h +++ b/Firmware/thermal_model.h @@ -6,31 +6,31 @@ #include "planner.h" // shortcuts to get model defaults -#define __TEMP_MODEL_DEF(MODEL, VAR) TEMP_MODEL_##MODEL##_##VAR -#define _TEMP_MODEL_DEF(MODEL, VAR) __TEMP_MODEL_DEF(MODEL, VAR) -#define TEMP_MODEL_DEF(VAR) _TEMP_MODEL_DEF(TEMP_MODEL_DEFAULT, VAR) +#define __THERMAL_MODEL_DEF(MODEL, VAR) THERMAL_MODEL_##MODEL##_##VAR +#define _THERMAL_MODEL_DEF(MODEL, VAR) __THERMAL_MODEL_DEF(MODEL, VAR) +#define THERMAL_MODEL_DEF(VAR) _THERMAL_MODEL_DEF(THERMAL_MODEL_DEFAULT, VAR) -constexpr uint8_t TEMP_MODEL_CAL_S = 60; // Maximum recording length during calibration (s) -constexpr uint8_t TEMP_MODEL_CAL_R_STEP = 4; // Fan interpolation steps during calibration -constexpr float TEMP_MODEL_fE = 0.05; // error filter (1st-order IIR factor) +constexpr uint8_t THERMAL_MODEL_CAL_S = 60; // Maximum recording length during calibration (s) +constexpr uint8_t THERMAL_MODEL_CAL_R_STEP = 4; // Fan interpolation steps during calibration +constexpr float THERMAL_MODEL_fE = 0.05; // error filter (1st-order IIR factor) // transport delay buffer size (samples) -constexpr uint8_t TEMP_MODEL_MAX_LAG_SIZE = 8; // * TEMP_MGR_INTV = 2160 +constexpr uint8_t THERMAL_MODEL_MAX_LAG_SIZE = 8; // * TEMP_MGR_INTV = 2160 // resistance values for all fan levels -constexpr uint8_t TEMP_MODEL_R_SIZE = (1 << FAN_SOFT_PWM_BITS); -static const float TEMP_MODEL_R_DEFAULT[TEMP_MODEL_R_SIZE] PROGMEM = TEMP_MODEL_DEF(Rv); +constexpr uint8_t THERMAL_MODEL_R_SIZE = (1 << FAN_SOFT_PWM_BITS); +static const float THERMAL_MODEL_R_DEFAULT[THERMAL_MODEL_R_SIZE] PROGMEM = THERMAL_MODEL_DEF(Rv); -namespace temp_model { +namespace thermal_model { struct model_data { // temporary buffers - float dT_lag_buf[TEMP_MODEL_MAX_LAG_SIZE]; // transport delay buffer - uint8_t dT_lag_size = 0; // transport delay buffer size - uint8_t dT_lag_idx = 0; // transport delay buffer index - float dT_err_prev = 0; // previous temperature delta error - float T_prev = 0; // last temperature extruder + float dT_lag_buf[THERMAL_MODEL_MAX_LAG_SIZE]; // transport delay buffer + uint8_t dT_lag_size = 0; // transport delay buffer size + uint8_t dT_lag_idx = 0; // transport delay buffer index + float dT_err_prev = 0; // previous temperature delta error + float T_prev = 0; // last temperature extruder // configurable parameters float P; // heater power (W) @@ -39,7 +39,7 @@ struct model_data float C; // heatblock capacitance (J/K) float fS; // sim. 1st order IIR filter factor (f=100/27) uint16_t L; // sim. response lag (ms) - float R[TEMP_MODEL_R_SIZE]; // heatblock resistance for all fan levels (K/W) + float R[THERMAL_MODEL_R_SIZE]; // heatblock resistance for all fan levels (K/W) float Ta_corr; // ambient temperature correction (K) // thresholds @@ -85,7 +85,7 @@ volatile static struct static void handle_warning(); // handle warnings from user context -#ifdef TEMP_MODEL_DEBUG +#ifdef THERMAL_MODEL_DEBUG static struct { volatile struct @@ -106,9 +106,9 @@ static void log_usr(); // user log handler static void log_isr(); // isr log handler #endif -} // namespace temp_model +} // namespace thermal_model -namespace temp_model_cal { +namespace thermal_model_cal { // recording scratch buffer struct rec_entry @@ -117,9 +117,9 @@ struct rec_entry uint8_t pwm; // heater PWM }; -constexpr uint16_t REC_BUFFER_SIZE = TEMP_MODEL_CAL_S / TEMP_MGR_INTV; +constexpr uint16_t REC_BUFFER_SIZE = THERMAL_MODEL_CAL_S / TEMP_MGR_INTV; static rec_entry* const rec_buffer = (rec_entry*)block_buffer; // oh-hey, free memory! static_assert(sizeof(rec_entry[REC_BUFFER_SIZE]) <= sizeof(block_buffer), "recording length too long to fit within available buffer"); -} // namespace temp_model_cal +} // namespace thermal_model_cal diff --git a/Firmware/thermal_model/e3d_REVO.h b/Firmware/thermal_model/e3d_REVO.h new file mode 100644 index 000000000..a4fb355d5 --- /dev/null +++ b/Firmware/thermal_model/e3d_REVO.h @@ -0,0 +1,19 @@ +#pragma once + +#define THERMAL_MODEL_E3D_REVO_VER 1 // model parameters version + +#define THERMAL_MODEL_E3D_REVO_P 40. // heater power (W) +#define THERMAL_MODEL_E3D_REVO_U -0.0014 // linear temperature coefficient (W/K/power) +#define THERMAL_MODEL_E3D_REVO_V 1.05 // linear temperature intercept (W/power) + +#define THERMAL_MODEL_E3D_REVO_C 8.77 // initial guess for heatblock capacitance (J/K) +#define THERMAL_MODEL_E3D_REVO_R 25.3 // initial guess for heatblock resistance (K/W) + +#define THERMAL_MODEL_E3D_REVO_fS 0.15 // sim. 1st order IIR filter factor (f=100/27) +#define THERMAL_MODEL_E3D_REVO_LAG 270 // sim. response lag (ms, 0-2160) + +#define THERMAL_MODEL_E3D_REVO_W 0.85 // Default warning threshold (K/s) +#define THERMAL_MODEL_E3D_REVO_E 1.23 // Default error threshold (K/s) + +// fall-back resistance vector (R0-15) +#define THERMAL_MODEL_E3D_REVO_Rv {THERMAL_MODEL_E3D_REVO_R, 23.9, 22.5, 19.6, 19.0, 18.3, 17.7, 17.1, 16.8, 16.5, 16.3, 16.0, 15.9, 15.7, 15.6, 15.4} diff --git a/Firmware/thermal_model/e3d_REVO_HF_60W.h b/Firmware/thermal_model/e3d_REVO_HF_60W.h new file mode 100644 index 000000000..95c01a294 --- /dev/null +++ b/Firmware/thermal_model/e3d_REVO_HF_60W.h @@ -0,0 +1,19 @@ +#pragma once + +#define THERMAL_MODEL_E3D_REVO_HF_60W_VER 1 // model parameters version + +#define THERMAL_MODEL_E3D_REVO_HF_60W_P 60. // heater power (W) +#define THERMAL_MODEL_E3D_REVO_HF_60W_U -0.0014 // linear temperature coefficient (W/K/power) +#define THERMAL_MODEL_E3D_REVO_HF_60W_V 1.05 // linear temperature intercept (W/power) + +#define THERMAL_MODEL_E3D_REVO_HF_60W_C 9.10 // initial guess for heatblock capacitance (J/K) +#define THERMAL_MODEL_E3D_REVO_HF_60W_R 30.6 // initial guess for heatblock resistance (K/W) + +#define THERMAL_MODEL_E3D_REVO_HF_60W_fS 0.15 // sim. 1st order IIR filter factor (f=100/27) +#define THERMAL_MODEL_E3D_REVO_HF_60W_LAG 270 // sim. response lag (ms, 0-2160) + +#define THERMAL_MODEL_E3D_REVO_HF_60W_W 0.85 // Default warning threshold (K/s) +#define THERMAL_MODEL_E3D_REVO_HF_60W_E 1.23 // Default error threshold (K/s) + +// fall-back resistance vector (R0-15) +#define THERMAL_MODEL_E3D_REVO_HF_60W_Rv {THERMAL_MODEL_E3D_REVO_HF_60W_R, 29.0, 27.5, 24.5, 23.4, 22.3, 21.2, 20.2, 19.8, 19.4, 19.0, 18.6, 18.3, 18.1, 17.9, 17.7} diff --git a/Firmware/thermal_model/e3d_v6.h b/Firmware/thermal_model/e3d_v6.h new file mode 100644 index 000000000..f034fd0c5 --- /dev/null +++ b/Firmware/thermal_model/e3d_v6.h @@ -0,0 +1,19 @@ +#pragma once + +#define THERMAL_MODEL_E3D_V6_VER 1 // model parameters version + +#define THERMAL_MODEL_E3D_V6_P 38. // heater power (W) +#define THERMAL_MODEL_E3D_V6_U 0. // linear temperature coefficient (W/K/power) +#define THERMAL_MODEL_E3D_V6_V 1. // linear temperature intercept (W/power) + +#define THERMAL_MODEL_E3D_V6_C 12.1 // initial guess for heatblock capacitance (J/K) +#define THERMAL_MODEL_E3D_V6_R 20.5 // initial guess for heatblock resistance (K/W) + +#define THERMAL_MODEL_E3D_V6_fS 0.065 // sim. 1st order IIR filter factor (f=100/27) +#define THERMAL_MODEL_E3D_V6_LAG 2100 // sim. response lag (ms, 0-2160) + +#define THERMAL_MODEL_E3D_V6_W 1.2 // Default warning threshold (K/s) +#define THERMAL_MODEL_E3D_V6_E 1.74 // Default error threshold (K/s) + +// fall-back resistance vector (R0-15) +#define THERMAL_MODEL_E3D_V6_Rv {THERMAL_MODEL_E3D_V6_R, 18.4, 16.7, 15.2, 14.1, 13.3, 12.7, 12.1, 11.7, 11.3, 11., 10.8, 10.6, 10.4, 10.2, 10.1} diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 720cd9714..18b5b8bc5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -887,8 +887,8 @@ void lcd_commands() } } -#ifdef TEMP_MODEL - if (lcd_commands_type == LcdCommands::TempModel && cmd_buffer_empty()) +#ifdef THERMAL_MODEL + if (lcd_commands_type == LcdCommands::ThermalModel && cmd_buffer_empty()) { switch (lcd_commands_step) { @@ -908,13 +908,13 @@ void lcd_commands() break; case 3: - temp_model_set_warn_beep(false); + thermal_model_set_warn_beep(false); enquecommand_P(PSTR("M310 A F1")); lcd_commands_step = 2; break; case 2: - if (temp_model_autotune_result()) + if (thermal_model_autotune_result()) enquecommand_P(MSG_M500); lcd_commands_step = 1; break; @@ -922,8 +922,8 @@ void lcd_commands() case 1: lcd_commands_step = 0; lcd_commands_type = LcdCommands::Idle; - temp_model_set_warn_beep(true); - bool res = temp_model_autotune_result(); + thermal_model_set_warn_beep(true); + bool res = thermal_model_autotune_result(); if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { // resume the wizard lcd_wizard(res ? WizState::Restore : WizState::Failed); @@ -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 - was_enabled = temp_model_enabled(); - temp_model_set_enabled(false); -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + was_enabled = thermal_model_enabled(); + thermal_model_set_enabled(false); +#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 - temp_model_set_enabled(was_enabled); -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + thermal_model_set_enabled(was_enabled); +#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)) { - state = S::TempModel; -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + } else if (!calibration_status_get(CALIBRATION_STATUS_THERMAL_MODEL)) { + state = S::ThermalModel; +#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 - case S::TempModel: +#ifdef THERMAL_MODEL + case S::ThermalModel: 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; + lcd_commands_type = LcdCommands::ThermalModel; 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 - MENU_ITEM_SUBMENU_P(_n("Thermal Model cal."), lcd_temp_model_cal); -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + MENU_ITEM_SUBMENU_P(_n("Thermal Model cal."), lcd_thermal_model_cal); +#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 -void lcd_temp_model_cal() +#ifdef THERMAL_MODEL +void lcd_thermal_model_cal() { - lcd_commands_type = LcdCommands::TempModel; + lcd_commands_type = LcdCommands::ThermalModel; 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 - bool tm_was_enabled = temp_model_enabled(); - temp_model_set_enabled(false); -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + bool tm_was_enabled = thermal_model_enabled(); + thermal_model_set_enabled(false); +#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 - temp_model_set_enabled(tm_was_enabled); -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + thermal_model_set_enabled(tm_was_enabled); +#endif //THERMAL_MODEL manage_heater(); manage_inactivity(true); return _stepresult; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 541215853..f17c5be33 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -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 -void lcd_temp_model_cal(); -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL +void lcd_thermal_model_cal(); +#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 - TempModel, -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + ThermalModel, +#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 - TempModel, //!< Temp model calibration -#endif //TEMP_MODEL +#ifdef THERMAL_MODEL + ThermalModel, //!< Thermal Model calibration +#endif //THERMAL_MODEL IsFil, //!< Is filament loaded? First step of 1st layer calibration Preheat, //!< Preheat for any material LoadFilCold, //!< Load filament for MMU diff --git a/Firmware/util.h b/Firmware/util.h index 20f03388b..0fcf76824 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -103,22 +103,22 @@ extern void ip4_to_str(char* dest, uint8_t* IP); // Calibration status of the machine // (unsigned char*)EEPROM_CALIBRATION_STATUS_V2 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 +const CalibrationStatus CALIBRATION_STATUS_SELFTEST = 0b00000001; // Selftest +const CalibrationStatus CALIBRATION_STATUS_XYZ = 0b00000010; // XYZ calibration +const CalibrationStatus CALIBRATION_STATUS_Z = 0b00000100; // Z calibration +#ifdef THERMAL_MODEL +const CalibrationStatus CALIBRATION_STATUS_THERMAL_MODEL = 0b00001000; // Thermal model calibration #endif -const CalibrationStatus CALIBRATION_STATUS_LIVE_ADJUST = 0b00010000; // 1st layer calibration -const CalibrationStatus CALIBRATION_STATUS_UNKNOWN = 0b10000000; // Freshly assembled or unknown status +const CalibrationStatus CALIBRATION_STATUS_LIVE_ADJUST = 0b00010000; // 1st layer calibration +const CalibrationStatus CALIBRATION_STATUS_UNKNOWN = 0b10000000; // Freshly assembled or unknown status // Calibration steps performed by the wizard 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; diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO.h index 084e5fc69..1deab8178 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO.h @@ -381,26 +381,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 "temp_model/e3d_REVO.h" -#define TEMP_MODEL_DEFAULT E3D_REVO // Default E3D REVO model parameters +#include "thermal_model/e3d_REVO.h" +#define THERMAL_MODEL_DEFAULT E3D_REVO // Default E3D REVO model parameters /*------------------------------------ diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO_HF_60W.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO_HF_60W.h index 1985e9132..471e6c8b7 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO_HF_60W.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3DREVO_HF_60W.h @@ -382,26 +382,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 "temp_model/e3d_REVO_HF_60W.h" -#define TEMP_MODEL_DEFAULT E3D_REVO_HF_60W // Default E3D REVO HF 60W model parameters +#include "thermal_model/e3d_REVO_HF_60W.h" +#define THERMAL_MODEL_DEFAULT E3D_REVO_HF_60W // Default E3D REVO HF 60W model parameters /*------------------------------------ diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 31ad71d38..e6ce1915d 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -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 "temp_model/e3d_v6.h" -#define TEMP_MODEL_DEFAULT E3D_V6 // Default model parameters +#include "thermal_model/e3d_v6.h" +#define THERMAL_MODEL_DEFAULT E3D_V6 // Default model parameters /*------------------------------------ diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO.h index c688ce959..2ae876f58 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO.h @@ -385,26 +385,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 "temp_model/e3d_REVO.h" -#define TEMP_MODEL_DEFAULT E3D_REVO // Default E3D REVO model parameters +#include "thermal_model/e3d_REVO.h" +#define THERMAL_MODEL_DEFAULT E3D_REVO // Default E3D REVO model parameters /*------------------------------------ diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO_HF_60W.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO_HF_60W.h index 8125b93e3..bfaae1fc9 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO_HF_60W.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3DREVO_HF_60W.h @@ -386,26 +386,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 "temp_model/e3d_REVO_HF_60W.h" -#define TEMP_MODEL_DEFAULT E3D_REVO_HF_60W // Default E3D REVO HF 60W model parameters +#include "thermal_model/e3d_REVO_HF_60W.h" +#define THERMAL_MODEL_DEFAULT E3D_REVO_HF_60W // Default E3D REVO HF 60W model parameters /*------------------------------------ diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index a7399c03a..8b9ee71e2 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -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 "temp_model/e3d_v6.h" -#define TEMP_MODEL_DEFAULT E3D_V6 // Default model parameters +#include "thermal_model/e3d_v6.h" +#define THERMAL_MODEL_DEFAULT E3D_V6 // Default model parameters /*------------------------------------ diff --git a/Firmware/variants/README.md b/Firmware/variants/README.md index 6bb981304..8b85bda16 100644 --- a/Firmware/variants/README.md +++ b/Firmware/variants/README.md @@ -65,48 +65,48 @@ Example: ... ``` 8. Prepare for new 3rd party hotend TM value file - - Search for `#include "temp_model/e3d_v6.h"` + - Search for `#include "thermal_model/e3d_v6.h"` - Change the `e3d_v6.h` to `<3rd party hotend:16>.h` - Change below the `E3D_V6` to `<3rd party hotend:16>` ``` ... - #include "temp_model/e3d_v6.h" - #define TEMP_MODEL_DEFAULT E3D_V6 // Default E3D v6 model parameters + #include "thermal_model/e3d_v6.h" + #define THERMAL_MODEL_DEFAULT E3D_V6 // Default E3D v6 model parameters ... ``` Example: ``` ... - #include "temp_model/e3d_REVO_HF_60W.h" - #define TEMP_MODEL_DEFAULT E3D_REVO_HF_60W // Default E3D REVO HF 60W model parameters + #include "thermal_model/e3d_REVO_HF_60W.h" + #define THERMAL_MODEL_DEFAULT E3D_REVO_HF_60W // Default E3D REVO HF 60W model parameters ... ``` 9. Save and close the new variant file -10. Copy/paste `Firmware/temp_model/e3d_v6.h` as `Firmware/temp_model/<3rd party hotend:16>.h` - - Example: `Firmware/temp_model/e3d_REVO_HF_60W.h` -11. Open the new file `Firmware/temp_model/<3rd party hotend:16>.h` -12. Search `E3D_V6` and replace it with what you have used in `#defined TEMP_MODEL_DEFAULT` +10. Copy/paste `Firmware/thermal_model/e3d_v6.h` as `Firmware/thermal_model/<3rd party hotend:16>.h` + - Example: `Firmware/thermal_model/e3d_REVO_HF_60W.h` +11. Open the new file `Firmware/thermal_model/<3rd party hotend:16>.h` +12. Search `E3D_V6` and replace it with what you have used in `#defined THERMAL_MODEL_DEFAULT` - Example ``` #pragma once - #define TEMP_MODEL_E3D_REVO_HF_60W_VER 1 // model parameters version + #define THERMAL_MODEL_E3D_REVO_HF_60W_VER 1 // model parameters version - #define TEMP_MODEL_E3D_REVO_HF_60W_P 60. // heater power (W) - #define TEMP_MODEL_E3D_REVO_HF_60W_U -0.0014 // linear temperature coefficient (W/K/power) - #define TEMP_MODEL_E3D_REVO_HF_60W_V 1.05 // linear temperature intercept (W/power) + #define THERMAL_MODEL_E3D_REVO_HF_60W_P 60. // heater power (W) + #define THERMAL_MODEL_E3D_REVO_HF_60W_U -0.0014 // linear temperature coefficient (W/K/power) + #define THERMAL_MODEL_E3D_REVO_HF_60W_V 1.05 // linear temperature intercept (W/power) - #define TEMP_MODEL_E3D_REVO_HF_60W_C 8.77 // initial guess for heatblock capacitance (J/K) - #define TEMP_MODEL_E3D_REVO_HF_60W_R 25.3 // initial guess for heatblock resistance (K/W) + #define THERMAL_MODEL_E3D_REVO_HF_60W_C 8.77 // initial guess for heatblock capacitance (J/K) + #define THERMAL_MODEL_E3D_REVO_HF_60W_R 25.3 // initial guess for heatblock resistance (K/W) - #define TEMP_MODEL_E3D_REVO_HF_60W_fS 0.15 // sim. 1st order IIR filter factor (f=100/27) - #define TEMP_MODEL_E3D_REVO_HF_60W_LAG 270 // sim. response lag (ms, 0-2160) + #define THERMAL_MODEL_E3D_REVO_HF_60W_fS 0.15 // sim. 1st order IIR filter factor (f=100/27) + #define THERMAL_MODEL_E3D_REVO_HF_60W_LAG 270 // sim. response lag (ms, 0-2160) - #define TEMP_MODEL_E3D_REVO_HF_60W_W 1.2 // Default warning threshold (K/s) - #define TEMP_MODEL_E3D_REVO_HF_60W_E 1.74 // Default error threshold (K/s) + #define THERMAL_MODEL_E3D_REVO_HF_60W_W 1.2 // Default warning threshold (K/s) + #define THERMAL_MODEL_E3D_REVO_HF_60W_E 1.74 // Default error threshold (K/s) // fall-back resistance vector (R0-15) - #define TEMP_MODEL_E3D_REVO_HF_60W_Rv {TEMP_MODEL_E3D_REVO_HF_60W_R, 23.9, 22.5, 19.6, 19.0, 18.3, 17.7, 17.1, 16.8, 16.5, 16.3, 16.0, 15.9, 15.7, 15.6, 15.4} + #define THERMAL_MODEL_E3D_REVO_HF_60W_Rv {THERMAL_MODEL_E3D_REVO_HF_60W_R, 23.9, 22.5, 19.6, 19.0, 18.3, 17.7, 17.1, 16.8, 16.5, 16.3, 16.0, 15.9, 15.7, 15.6, 15.4} ``` diff --git a/lang/po/Firmware_cs.po b/lang/po/Firmware_cs.po index 9e6629887..520cc667f 100644 --- a/lang/po/Firmware_cs.po +++ b/lang/po/Firmware_cs.po @@ -2614,6 +2614,3 @@ msgstr "Došlo k neočekávané chybě." #~ msgid "TM autotune failed" #~ msgstr "TM ladeni selhalo" - -#~ msgid "Temp. model autotune" -#~ msgstr "Ladeni tepl. modelu" diff --git a/lang/po/Firmware_de.po b/lang/po/Firmware_de.po index 9580a7ed6..b0f4cdbd6 100644 --- a/lang/po/Firmware_de.po +++ b/lang/po/Firmware_de.po @@ -2642,6 +2642,3 @@ msgstr "Ein unerwarteter Fehler ist aufgetreten." #~ msgid "TM autotune failed" #~ msgstr "TM kal. fehlgeschlg." - -#~ msgid "Temp. model autotune" -#~ msgstr "Temp. Model Autokal." diff --git a/lang/po/Firmware_es.po b/lang/po/Firmware_es.po index ebe25e949..d9a0ad27a 100644 --- a/lang/po/Firmware_es.po +++ b/lang/po/Firmware_es.po @@ -2638,6 +2638,3 @@ msgstr "Ocurrió un error inesperado." #~ msgid "TM autotune failed" #~ msgstr "Fallo autotune TM" - -#~ msgid "Temp. model autotune" -#~ msgstr "Autotune model temp." diff --git a/lang/po/Firmware_fr.po b/lang/po/Firmware_fr.po index a3c16dcbb..f8667dfa8 100644 --- a/lang/po/Firmware_fr.po +++ b/lang/po/Firmware_fr.po @@ -2653,6 +2653,3 @@ msgstr "Une erreur inattendue s'est produite." #~ msgid "TM autotune failed" #~ msgstr "Echec regl. auto MT" - -#~ msgid "Temp. model autotune" -#~ msgstr "Regl. auto mod temp." diff --git a/lang/po/Firmware_hr.po b/lang/po/Firmware_hr.po index dd5c271c5..1a0d02f0d 100644 --- a/lang/po/Firmware_hr.po +++ b/lang/po/Firmware_hr.po @@ -2635,9 +2635,6 @@ msgstr "Došlo je do neočekivane pogreške." #~ msgid "TM autotune failed" #~ msgstr "TM autotune nije usp" -#~ msgid "Temp. model autotune" -#~ msgstr "Temp. autptune model" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "" diff --git a/lang/po/Firmware_hu.po b/lang/po/Firmware_hu.po index d474e4a82..748e426c6 100644 --- a/lang/po/Firmware_hu.po +++ b/lang/po/Firmware_hu.po @@ -2637,9 +2637,6 @@ msgstr "Váratlan hiba történt." #~ msgid "TM autotune failed" #~ msgstr "HM kalib. sikertelen" -#~ msgid "Temp. model autotune" -#~ msgstr "Homers. modell kalib" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "XYZ kalibracio nem jo. Bal elso kal. pont nem elerheto." diff --git a/lang/po/Firmware_it.po b/lang/po/Firmware_it.po index 0c7a51b1b..a88f94c0d 100644 --- a/lang/po/Firmware_it.po +++ b/lang/po/Firmware_it.po @@ -2636,9 +2636,6 @@ msgstr "Si è verificato un errore imprevisto." #~ msgid "TM autotune failed" #~ msgstr "Autocal. MT fallita" -#~ msgid "Temp. model autotune" -#~ msgstr "Cal. modello termico" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "" diff --git a/lang/po/Firmware_nl.po b/lang/po/Firmware_nl.po index c7354246c..4cfc4672d 100644 --- a/lang/po/Firmware_nl.po +++ b/lang/po/Firmware_nl.po @@ -2641,8 +2641,5 @@ msgstr "Er is een onverwachte fout opgetreden." #~ msgid "TM autotune failed" #~ msgstr "TM autotune mislukt" -#~ msgid "Temp. model autotune" -#~ msgstr "Temp. model autotune" - #~ msgid "XYZ calibration failed. Left front calibration point not reachable." #~ msgstr "XYZ-kalibratie mislukt. Kalibratiepunt linksvoor niet bereikbaar." diff --git a/lang/po/Firmware_no.po b/lang/po/Firmware_no.po index 91f5b349d..d366ccb94 100644 --- a/lang/po/Firmware_no.po +++ b/lang/po/Firmware_no.po @@ -2613,9 +2613,6 @@ msgstr "Det oppstod en uventet feil." #~ msgid "TM autotune failed" #~ msgstr "TM autotune feilet" -#~ msgid "Temp. model autotune" -#~ msgstr "Temp. model autotune" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "XYZ kalibrasjon feilet. Fremre venstre kalibrerings kan ikke nås." diff --git a/lang/po/Firmware_pl.po b/lang/po/Firmware_pl.po index 45da80996..e11d54156 100644 --- a/lang/po/Firmware_pl.po +++ b/lang/po/Firmware_pl.po @@ -2631,6 +2631,3 @@ msgstr "Pojawił się nieoczekiwany błąd." #~ msgid "TM autotune failed" #~ msgstr "Blad TM autotune" - -#~ msgid "Temp. model autotune" -#~ msgstr "Autotune modelu temp" diff --git a/lang/po/Firmware_ro.po b/lang/po/Firmware_ro.po index 4baa82ad5..3a152f702 100644 --- a/lang/po/Firmware_ro.po +++ b/lang/po/Firmware_ro.po @@ -2633,9 +2633,6 @@ msgstr "A apărut o eroare neașteptată." #~ msgid "TM autotune failed" #~ msgstr "Autotune TM esuat" -#~ msgid "Temp. model autotune" -#~ msgstr "Temp. model autotune" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "" diff --git a/lang/po/Firmware_sk.po b/lang/po/Firmware_sk.po index e4bdbf079..457b2ba72 100644 --- a/lang/po/Firmware_sk.po +++ b/lang/po/Firmware_sk.po @@ -2616,9 +2616,6 @@ msgstr "Vyskytla sa neočakávaná chyba." #~ msgid "TM autotune failed" #~ msgstr "TM autotune failed" -#~ msgid "Temp. model autotune" -#~ msgstr "Autom. nast. teploty" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "Kalibracia XYZ je nepresna. Lavy predny bod je nedostupny." diff --git a/lang/po/Firmware_sv.po b/lang/po/Firmware_sv.po index f2285257a..d92ee3c60 100644 --- a/lang/po/Firmware_sv.po +++ b/lang/po/Firmware_sv.po @@ -2625,9 +2625,6 @@ msgstr "Ett oväntat fel inträffade." #~ msgid "TM autotune failed" #~ msgstr "TM autoinst fallerad" -#~ msgid "Temp. model autotune" -#~ msgstr "Temp modell autoinst" - #~ msgid "" #~ "XYZ calibration compromised. Left front calibration point not reachable." #~ msgstr "" diff --git a/tools/README.md b/tools/README.md index eb42a10c0..79227ad9c 100644 --- a/tools/README.md +++ b/tools/README.md @@ -67,9 +67,9 @@ Set the required TTY flags on the specified port to avoid reset-on-connect for * ### ``tml_decode`` -Decode (or plot) the temperature model trace from a serial log file. +Decode (or plot) the thermal model trace from a serial log file. -The TML trace needs to be enabled by issuing "M155 S1 C3" and "D70 S1" to the printer, generally followed by a temperature model calibration request "M310 A F0". +The TML trace needs to be enabled by issuing "M155 S1 C3" and "D70 S1" to the printer, generally followed by a thermal model calibration request "M310 A F0". The parser is not strict, and will consume most serial logs with/without timestamps.