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

@@ -40,6 +40,7 @@ bool Calibration::clearCalibrated() {
printf("Error saving calibration status as false.\n");
return false;
}
nvs_commit(calibHandle);
nvs_close(calibHandle);
}
else {
@@ -56,6 +57,7 @@ bool Calibration::beginDownwardCalib(Encoder& topEnc) {
if (nvs_set_i32(calibHandle, UpTicksTag, tempUpTicks) == ESP_OK) {
printf("Saved UpTicks to NVS\n");
UpTicks = tempUpTicks;
nvs_commit(calibHandle);
}
else {
printf("Error saving UpTicks.\n");
@@ -88,6 +90,7 @@ bool Calibration::completeCalib(Encoder& topEnc) {
DownTicks = tempDownTicks;
calibrated = true;
printf("Range: %d - %d\n", UpTicks.load(), tempDownTicks);
nvs_commit(calibHandle);
nvs_close(calibHandle);
}
else {