pi without the d
This commit is contained in:
@@ -21,73 +21,58 @@ static const uint8_t HEATER_PIN = A2; // heater via solid-state relay
|
||||
// ---------------------------------------------------------------------------
|
||||
// Temperature control
|
||||
// ---------------------------------------------------------------------------
|
||||
static const float TARGET_TEMP_C = 0.0f; // power-on default: idle (heater off)
|
||||
static const float AUTOTUNE_DEFAULT_TEMP_C = 40.0f; // autotune when no temp given and idle
|
||||
static const float TARGET_MIN_C = 0.0f; // 0 = idle (heater off, fan at idle speed)
|
||||
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 temp — heater off + full fan. Decoupled from PID target so you can
|
||||
// run target 50–55 while tuning with headroom for hot corners (ABS in chamber).
|
||||
// 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; // taper heater when max within this of emergency
|
||||
static const float CORNER_STOP_MARGIN_C = 3.0f;
|
||||
|
||||
// PID on chamber average
|
||||
static const float PID_KP = 4.0f;
|
||||
static const float PID_KI = 0.05f;
|
||||
static const float PID_KD = 6.0f;
|
||||
// Dual PI — heat on avg, mix on spread (no D term)
|
||||
static const float HEAT_PI_KP = 4.0f;
|
||||
static const float HEAT_PI_KI = 0.05f;
|
||||
static const float MIX_PI_KP = 40.0f;
|
||||
static const float MIX_PI_KI = 2.0f;
|
||||
static const float SPREAD_TARGET_C = 0.5f;
|
||||
static const float HEAT_UP_BAND_C = 8.0f;
|
||||
static const uint8_t FAN_COLD_CAP_PWM = 0;
|
||||
|
||||
// Tiered heater cap — more power when cold, gentle near setpoint
|
||||
static const float HEATER_MAX_DUTY_COLD = 85.0f; // avg >=10 °C below target
|
||||
static const float HEATER_MAX_DUTY_MID = 65.0f; // avg 3–10 °C below target
|
||||
static const float HEATER_MAX_DUTY_NEAR = 45.0f; // avg <3 °C below target
|
||||
// Legacy aliases for autotuner relay math only
|
||||
static const float PID_KP = HEAT_PI_KP;
|
||||
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
|
||||
static const float HEATER_MAX_DUTY_COLD = 85.0f;
|
||||
static const float HEATER_MAX_DUTY_MID = 65.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;
|
||||
// Below this band from target, only the hard cutoff limits max-corner (full heat-up)
|
||||
static const float CORNER_LIMIT_BAND_C = 10.0f;
|
||||
|
||||
// Ramp-up limit (% per second) — still caps sudden jumps
|
||||
static const float HEATER_SLEW_UP_PER_S = 18.0f;
|
||||
|
||||
// Hot-corner limiter: taper heater as max corner approaches stop temperature
|
||||
static const float MAX_TEMP_HEADROOM_C = 15.0f;
|
||||
|
||||
// Average-temp approach: taper only in the last few °C before setpoint
|
||||
static const float APPROACH_BAND_C = 4.0f;
|
||||
|
||||
// When spread is good, allow hottest corner slightly above target so avg can reach setpoint
|
||||
static const float GOOD_SPREAD_C = 5.0f;
|
||||
static const float BALANCED_MAX_ABOVE_TARGET_C = 2.0f;
|
||||
static const float SPREAD_HEADROOM_FACTOR = 0.5f; // extra max-corner °C per °C of spread
|
||||
|
||||
static const uint16_t HEATER_CYCLE_MS = 3000;
|
||||
|
||||
// Fan PWM (0–255)
|
||||
static const uint8_t FAN_IDLE_PWM = 77; // ~30 % — optional override via "fan on"
|
||||
static const float IDLE_AUTO_FAN_OFF_TEMP_C = 40.0f; // idle: fans off when max corner below this
|
||||
static const uint8_t FAN_MIX_MIN_PWM = 70; // ~27 % — light mixing when spread rises
|
||||
static const uint8_t FAN_HEAT_MIN_PWM = 100; // ~39 % — floor while heating (near setpoint)
|
||||
static const uint8_t FAN_HEAT_MAX_PWM = 140; // ~55 % — cap during heat-up
|
||||
static const float FAN_OFF_BELOW_TARGET_C = 8.0f; // no heat-up fan when avg this far below target
|
||||
static const float FAN_RAMP_BELOW_TARGET_C = 15.0f; // fan ramps in between this and FAN_OFF_BELOW
|
||||
static const uint8_t FAN_MIX_MAX_PWM = 200; // ~78 % — cap for spread-driven mixing
|
||||
static const uint8_t FAN_MAX_PWM = 255; // failsafe / over-temp only
|
||||
// Most 24 V MOSFET modules are active-low (pin LOW = fan on). If off/speed seem wrong,
|
||||
// try flipping this and reflash. Test: `fan test 0` (off) vs `fan test 200` vs `fan test 255`.
|
||||
// Fan PWM
|
||||
static const uint8_t FAN_IDLE_PWM = 77;
|
||||
static const float IDLE_AUTO_FAN_OFF_TEMP_C = 40.0f;
|
||||
static const uint8_t FAN_MAX_PWM = 255;
|
||||
static const bool FAN_PWM_INVERT = true;
|
||||
|
||||
// Corner mixing — moderate airflow; full speed reserved for safety
|
||||
static const float SPREAD_DEADBAND_C = 0.5f;
|
||||
static const float SPREAD_FULL_MIX_C = 8.0f;
|
||||
static const float SPREAD_EMA_ALPHA = 0.45f;
|
||||
|
||||
// PID auto-tune (relay method) — run with: autotune 45
|
||||
// PID auto-tune (relay method) — heat PI only
|
||||
static const float AUTOTUNE_HYSTERESIS_C = 0.4f;
|
||||
static const float AUTOTUNE_PREHEAT_BAND_C = 3.0f;
|
||||
static const float AUTOTUNE_PREHEAT_DUTY = 100.0f;
|
||||
static const uint8_t AUTOTUNE_PREHEAT_FAN_PWM = 0; // fan off — maximize heat-up
|
||||
static const uint8_t AUTOTUNE_PREHEAT_FAN_PWM = 0;
|
||||
static const uint8_t AUTOTUNE_CYCLES_REQUIRED = 5;
|
||||
static const uint32_t AUTOTUNE_PREHEAT_TIMEOUT_MS = 1200000UL; // 20 min
|
||||
static const uint32_t AUTOTUNE_RELAY_STALL_MS = 1500000UL; // 25 min in relay, 0 cycles
|
||||
static const uint32_t AUTOTUNE_SESSION_TIMEOUT_MS = 3600000UL; // 60 min total
|
||||
static const uint32_t AUTOTUNE_PREHEAT_TIMEOUT_MS = 1200000UL;
|
||||
static const uint32_t AUTOTUNE_RELAY_STALL_MS = 1500000UL;
|
||||
static const uint32_t AUTOTUNE_SESSION_TIMEOUT_MS = 3600000UL;
|
||||
static const uint32_t AUTOTUNE_RELAY_PERIOD_MAX_MS = 2400000UL;
|
||||
|
||||
// Fan step-response — open-loop heater, fan PWM steps (command: stepresp)
|
||||
@@ -96,9 +81,9 @@ static const float STEPRESP_DEFAULT_HEATER_PCT = 35.0f;
|
||||
static const float STEPRESP_MIN_HEATER_PCT = 10.0f;
|
||||
static const float STEPRESP_MAX_HEATER_PCT = 70.0f;
|
||||
static const float STEPRESP_PREHEAT_BAND_C = 2.0f;
|
||||
static const uint32_t STEPRESP_PREHEAT_TIMEOUT_MS = 1200000UL; // 20 min
|
||||
static const uint32_t STEPRESP_BASELINE_MS = 120000UL; // 2 min fan-off baseline
|
||||
static const uint32_t STEPRESP_STEP_HOLD_MS = 300000UL; // 5 min per fan level
|
||||
static const uint32_t STEPRESP_PREHEAT_TIMEOUT_MS = 1200000UL;
|
||||
static const uint32_t STEPRESP_BASELINE_MS = 120000UL;
|
||||
static const uint32_t STEPRESP_STEP_HOLD_MS = 300000UL;
|
||||
static const uint32_t STEPRESP_LOG_INTERVAL_MS = 1000UL;
|
||||
static const uint8_t STEPRESP_FAN_STEPS[] = {0, 77, 140, 200, 255};
|
||||
static const uint8_t STEPRESP_FAN_STEP_COUNT =
|
||||
@@ -110,4 +95,4 @@ static const uint8_t STEPRESP_FAN_STEP_COUNT =
|
||||
static const uint32_t SENSOR_READ_INTERVAL_MS = 1000;
|
||||
static const uint32_t CONTROL_INTERVAL_MS = 500;
|
||||
static const uint32_t SERIAL_REPORT_INTERVAL_MS = 2000;
|
||||
static const bool LOG_CSV_DEFAULT = false; // enable with serial command: log on
|
||||
static const bool LOG_CSV_DEFAULT = false;
|
||||
|
||||
Reference in New Issue
Block a user