freitag
This commit is contained in:
@@ -12,6 +12,10 @@ static const uint8_t SENSOR_COUNT = sizeof(SENSOR_CHANNELS) / sizeof(SENSOR_CHAN
|
||||
// SHT31 I2C address (ADDR pin low → 0x44, high → 0x45)
|
||||
static const uint8_t SHT31_ADDRESS = 0x44;
|
||||
|
||||
// Bus timeout (Wire.setWireTimeout) — bounds a stuck I2C transaction so a
|
||||
// glitch resets the TWI hardware instead of hanging the whole sketch.
|
||||
static const uint32_t I2C_TIMEOUT_US = 25000UL;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Outputs — D5 has hardware PWM; heater on A2 uses burst control (SSR-friendly)
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -25,9 +29,22 @@ static const float TARGET_TEMP_C = 0.0f;
|
||||
static const float AUTOTUNE_DEFAULT_TEMP_C = 40.0f;
|
||||
static const float TARGET_MIN_C = 0.0f;
|
||||
static const float TARGET_MAX_C = 80.0f;
|
||||
// Absolute max corner — heater off + full fan (decoupled from PID target).
|
||||
static const float EMERGENCY_MAX_TEMP_C = 70.0f;
|
||||
static const float CORNER_STOP_MARGIN_C = 3.0f;
|
||||
// Hard ceiling (sensor / enclosure limit). Cutoff when regulating = target + CUTOFF_ABOVE_TARGET_C.
|
||||
static const float EMERGENCY_ABSOLUTE_MAX_C = 95.0f;
|
||||
static const float CUTOFF_ABOVE_TARGET_C = 12.0f;
|
||||
static const float CUTOFF_RECOVERY_BAND_C = 5.0f;
|
||||
static const float CORNER_STOP_MARGIN_C = 5.0f;
|
||||
|
||||
inline float emergencyCutoffForTarget(float targetC) {
|
||||
if (targetC <= 0.0f) {
|
||||
return EMERGENCY_ABSOLUTE_MAX_C;
|
||||
}
|
||||
float cutoff = targetC + CUTOFF_ABOVE_TARGET_C;
|
||||
if (cutoff > EMERGENCY_ABSOLUTE_MAX_C) {
|
||||
cutoff = EMERGENCY_ABSOLUTE_MAX_C;
|
||||
}
|
||||
return cutoff;
|
||||
}
|
||||
|
||||
// Heat PI on average temp (no D term)
|
||||
static const float HEAT_PI_KP = 4.0f;
|
||||
@@ -42,15 +59,8 @@ static const float PID_KI = HEAT_PI_KI;
|
||||
static const float PID_KD = 0.0f;
|
||||
static const float GOOD_SPREAD_C = 5.0f;
|
||||
|
||||
// Tiered heater cap during heat-up (100% until near target)
|
||||
static const float HEATER_MAX_DUTY_COLD = 100.0f;
|
||||
static const float HEATER_MAX_DUTY_MID = 75.0f;
|
||||
static const float HEATER_MAX_DUTY_NEAR = 45.0f;
|
||||
static const float HEATER_COLD_BELOW_C = 10.0f;
|
||||
static const float HEATER_WARM_BELOW_C = 3.0f;
|
||||
// Corner taper only within this band below target (was 10°C — blocked heat-up in uneven chambers)
|
||||
// Corner taper when avg is near target — keeps hottest sensor below emergency
|
||||
static const float CORNER_LIMIT_BAND_C = 2.0f;
|
||||
static const float HEATER_SLEW_UP_PER_S = 18.0f;
|
||||
static const float MAX_TEMP_HEADROOM_C = 15.0f;
|
||||
|
||||
static const uint16_t HEATER_CYCLE_MS = 3000;
|
||||
|
||||
Reference in New Issue
Block a user