Merge pull request #189 from fdlamotte/t1000_sensors_disable

t1000 : power bat sensor only when necessary
This commit is contained in:
ripplebiz
2025-04-12 13:32:01 +10:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -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);