mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-05-12 17:24:50 +00:00
t1000 : power bat sensor only when necessary
This commit is contained in:
@@ -29,9 +29,12 @@ public:
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
#ifdef BATTERY_PIN
|
||||
digitalWrite(PIN_3V3_EN, HIGH);
|
||||
analogReference(AR_INTERNAL_3_0);
|
||||
analogReadResolution(12);
|
||||
delay(10);
|
||||
float volts = (analogRead(BATTERY_PIN) * ADC_MULTIPLIER * AREF_VOLTAGE) / 4096;
|
||||
digitalWrite(PIN_3V3_EN, LOW);
|
||||
|
||||
analogReference(AR_DEFAULT); // put back to default
|
||||
analogReadResolution(10);
|
||||
|
||||
Reference in New Issue
Block a user