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
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <CayenneLPP.h>
|
||||
#include <stdio.h>
|
||||
#include "sensors/LocationProvider.h"
|
||||
|
||||
#define TELEM_PERM_BASE 0x01 // 'base' permission includes battery
|
||||
@@ -60,6 +61,15 @@ public:
|
||||
// With a periodic collector that costs one cycle and needs no scheduling.
|
||||
virtual void requestLocationRefresh() { }
|
||||
|
||||
// CUSTOM (TeTeHacko): the INA shunt (mOhm) from prefs back into the driver
|
||||
// after boot; 0 = keep the build's value. A no-op without an INA chip.
|
||||
void applyInaShunt(float mohm) {
|
||||
if (mohm <= 0) return;
|
||||
char v[16];
|
||||
snprintf(v, sizeof(v), "%.3f", mohm);
|
||||
setSettingValue("ina.shunt", v);
|
||||
}
|
||||
|
||||
// Live I2C scan, written into dest as text. Returns the number of devices
|
||||
// that answered, or -1 when the platform has no bus to scan.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user