Add persistent battery ADC calibration across boards

Add meter-reference calibration with saved ADC corrections, checked persistence and rollback. Preserve existing board coefficients and nRF52 voltage policy, and merge the Mini Repeater feature gates.

Validation: 69 focused tests, hosted documentation checks, and four firmware builds passed. Mini Repeater retains calibration and its existing filesystem with 376 flash bytes free; earlier Mini Sensor size failures remain documented.
This commit is contained in:
mikecarper committed 2026-10-22 18:56:32 -07:00
1 parent 94a3b7e568
commit ab6412e73c
108 files changed
+1303 -83

No files matched your search

+11
View File
@@ -1,5 +1,6 @@
#include <helpers/RadioProfileCLI.h>
#include <helpers/BatteryChargeCLI.h>
#include <helpers/BatteryCalibrationStore.h>
#include <Arduino.h> // needed for PlatformIO
#include <Mesh.h>
#if MESH_PACKET_LOGGING
@@ -424,6 +425,10 @@ public:
mesh::setUsbLoggingEnabled(_prefs.usb_logging_enabled != 0);
#endif
if (!mesh::power::beginBatteryCalibrationStore(board, volatile_primary_fs ? nullptr : _fs)) {
MESH_DEBUG_PRINTLN("Battery calibration could not be restored; using board default");
}
loadContacts();
_public = addChannel("Public", PUBLIC_GROUP_PSK); // pre-configure Andy's public channel
}
@@ -470,6 +475,12 @@ public:
}
void handleCommand(const char* command) {
char calibration_reply[160];
if (mesh::power::handleStoredBatteryCalibrationCommand(board, command,
calibration_reply, sizeof(calibration_reply))) {
Serial.println(calibration_reply);
return;
}
#if MESH_BATTERY_CHARGE_CONTROL
char charge_reply[160];
if (mesh::power::handleBatteryChargeCommand(board, command, charge_reply,