3 #error "this file is not a public interface, it should be used *only* within temperature.cpp!"
9 #define __THERMAL_MODEL_DEF(MODEL, VAR) THERMAL_MODEL_##MODEL##_##VAR
10 #define _THERMAL_MODEL_DEF(MODEL, VAR) __THERMAL_MODEL_DEF(MODEL, VAR)
11 #define THERMAL_MODEL_DEF(VAR) _THERMAL_MODEL_DEF(THERMAL_MODEL_DEFAULT, VAR)
13 constexpr uint8_t THERMAL_MODEL_CAL_S = 60;
14 constexpr uint8_t THERMAL_MODEL_CAL_R_STEP = 4;
15 constexpr
float THERMAL_MODEL_fE = 0.05;
18 constexpr uint8_t THERMAL_MODEL_MAX_LAG_SIZE = 8;
21 constexpr uint8_t THERMAL_MODEL_R_SIZE = (1 << FAN_SOFT_PWM_BITS);
22 static const float THERMAL_MODEL_R_DEFAULT[THERMAL_MODEL_R_SIZE] PROGMEM = THERMAL_MODEL_DEF(Rv);
24 namespace thermal_model {
29 float dT_lag_buf[THERMAL_MODEL_MAX_LAG_SIZE];
30 uint8_t dT_lag_size = 0;
31 uint8_t dT_lag_idx = 0;
32 float dT_err_prev = 0;
42 float R[THERMAL_MODEL_R_SIZE];
55 bool uninitialized: 1;
67 void reset(uint8_t heater_pwm, uint8_t fan_pwm,
float heater_temp,
float ambient_temp);
68 void step(uint8_t heater_pwm, uint8_t fan_pwm,
float heater_temp,
float ambient_temp);
72 static bool warn_beep =
true;
75 static bool calibrated();
79 volatile static struct
86 static void handle_warning();
88 #ifdef THERMAL_MODEL_DEBUG
105 static void log_usr();
106 static void log_isr();
111 namespace thermal_model_cal {
120 constexpr uint16_t REC_BUFFER_SIZE = THERMAL_MODEL_CAL_S / TEMP_MGR_INTV;
122 static_assert(
sizeof(
rec_entry[REC_BUFFER_SIZE]) <=
sizeof(block_buffer),
123 "recording length too long to fit within available buffer");
Definition: thermal_model.h:27
Definition: thermal_model.h:115