sensors: INA shunt set at runtime -- sensor set ina.shunt <mOhm>, kept in prefs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad4f53016c
commit
507842cea2
12 files changed
+106
-7
No files matched your search
@@ -1928,6 +1928,10 @@ void MyMesh::handleCmdFrame(size_t len) {
|
||||
savePrefs();
|
||||
}
|
||||
#endif
|
||||
if (strcmp(sp, "ina.shunt") == 0) { // CUSTOM (TeTeHacko): survives a reboot
|
||||
_prefs.ina_shunt_mohm = atof(np);
|
||||
savePrefs();
|
||||
}
|
||||
writeOKFrame();
|
||||
} else {
|
||||
writeErrFrame(ERR_CODE_ILLEGAL_ARG);
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
uint8_t default_scope_key[16];
|
||||
float tz_offset = 0;
|
||||
float adc_multiplier = 0; // battery ADC multiplier, 0 = board default
|
||||
float ina_shunt_mohm = 0; // CUSTOM (TeTeHacko): INA shunt in mOhm, 0 = build default
|
||||
#ifdef ENABLE_WIFI_INTERFACE
|
||||
#ifndef WIFI_SSID
|
||||
#define WIFI_SSID ""
|
||||
@@ -225,6 +226,7 @@ private:
|
||||
def("tel_env", _parent->telemetry_mode_env);
|
||||
def("tz_offset", _parent->tz_offset);
|
||||
def("adc_mult", _parent->adc_multiplier);
|
||||
def("ina_shunt", _parent->ina_shunt_mohm);
|
||||
}
|
||||
public:
|
||||
CompanionPrefs(NodePrefs* parent) : _parent(parent) { }
|
||||
|
||||
@@ -319,6 +319,7 @@ void setup() {
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
the_mesh.applyGpsPrefs();
|
||||
#endif
|
||||
sensors.applyInaShunt(the_mesh.getNodePrefs()->ina_shunt_mohm); // CUSTOM (TeTeHacko)
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs()); // still want to pass this in as dependency, as prefs might be moved
|
||||
|
||||
@@ -1529,6 +1529,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
applyGpsPrefs();
|
||||
#endif
|
||||
sensors.applyInaShunt(_prefs.ina_shunt_mohm); // CUSTOM (TeTeHacko)
|
||||
}
|
||||
|
||||
void MyMesh::sendFloodScoped(const TransportKey& scope, mesh::Packet* pkt, uint32_t delay_millis, uint8_t path_hash_size) {
|
||||
|
||||
@@ -747,6 +747,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
applyGpsPrefs();
|
||||
#endif
|
||||
sensors.applyInaShunt(_prefs.ina_shunt_mohm); // CUSTOM (TeTeHacko)
|
||||
}
|
||||
|
||||
void MyMesh::sendFloodScoped(const TransportKey& scope, mesh::Packet* pkt, uint32_t delay_millis, uint8_t path_hash_size) {
|
||||
|
||||
@@ -873,6 +873,7 @@ void SensorMesh::begin(FILESYSTEM* fs) {
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
applyGpsPrefs();
|
||||
#endif
|
||||
sensors.applyInaShunt(_prefs.ina_shunt_mohm); // CUSTOM (TeTeHacko)
|
||||
}
|
||||
|
||||
bool SensorMesh::formatFileSystem() {
|
||||
|
||||
Reference in new issue
Block a user