1. Ensure that recalibration doesn't cause issues with failing to pause watchdog and clear flags

2. Ensure all credentials are purged on device deletion to avoid security issues

3. Clear calibration state (set to false) on device deletion.
This commit is contained in:
2026-01-02 13:16:43 -06:00
parent c19edcc569
commit 5f64e5f395
6 changed files with 43 additions and 1 deletions

View File

@@ -66,6 +66,12 @@ void servoMainSwitch(uint8_t onOff) {
}
bool servoInitCalib() {
topEnc->pauseWatchdog();
// get ready for calibration by clearing all these listeners
bottomEnc->wandListen = false;
topEnc->wandListen = false;
topEnc->serverListen = false;
if (!calib.clearCalibrated()) return false;
if (topEnc == nullptr || bottomEnc == nullptr) {
printf("ERROR: CALIBRATION STARTED BEFORE SERVO INITIALIZATION\n");
@@ -138,6 +144,7 @@ void servoSavePos() {
if (nvs_set_i32(servoHandle, posTag, topCount) != ESP_OK)
printf("Error saving current position\n");
else printf("Success - Current position saved as: %d\n", topCount);
nvs_commit(servoHandle);
nvs_close(servoHandle);
}
else {