add tui and persistent targets

This commit is contained in:
2026-07-05 14:11:57 +02:00
parent 2e11b41855
commit f8f5167af5
11 changed files with 960 additions and 63 deletions

View File

@@ -5,6 +5,7 @@
#include "config.h"
#include "pid_autotuner.h"
#include "pid_controller.h"
#include "settings_store.h"
#include "tuning_store.h"
class ThermalController {
@@ -54,6 +55,12 @@ public:
Serial.println(F("Loaded learned PID from EEPROM"));
printTuning();
}
SettingsData settings;
if (settingsLoad(settings) && settings.targetC >= TARGET_MIN_C &&
settings.targetC <= TARGET_MAX_C) {
setTarget(settings.targetC, false);
}
}
void applyTuning(const TuningData &data) {
@@ -122,7 +129,7 @@ public:
return true;
}
void setTarget(float targetC) {
void setTarget(float targetC, bool persist = true) {
targetTempC_ = targetC;
pid_.setSetpoint(targetC);
pid_.reset();
@@ -134,6 +141,9 @@ public:
fanIdleOverride_ = false;
}
applyFan();
if (persist && targetC >= TARGET_MIN_C && targetC <= TARGET_MAX_C) {
settingsSaveTarget(targetC);
}
}
void noteSensorMax(float maxTempC) {