Fixes #1183 — T-Echo Lite incorrect battery voltage
Battery (TechoBoard.h/cpp): Added PIN_VBAT_MEAS_EN (P0.31) — the T-Echo Lite has a gated voltage divider that must be enabled before reading. Also added pinMode(PIN_VBAT_READ, INPUT) before each ADC read to reclaim P0.02 from other peripherals. Pin definitions hardcoded from LilyGo's t_echo_lite_config.h. I2C (variant.h): Corrected SDA/SCL from P0.04/P0.02 to P1.04/P1.02 per LilyGo's IIC_1_SDA/IIC_1_SCL. The old P0.02 mapping conflicted with the battery ADC pin. GPS (variant.h): Corrected all five GPS pin assignments to match LilyGo's config — UART TX/RX, wake, PPS, and power enable were all scrambled. SPI (variant.h): Fixed SPI_INTERFACES_COUNT from _PINNUM(0, 2) to (2). Tested on T-Echo Lite Non-Shell (USB-C, no display). Battery readings match Heltec V4 reference within 10mV.
This commit is contained in:
committed by
Matthias Wientapper
parent
46b5076082
commit
8217a67f0c
@@ -4,14 +4,12 @@
|
||||
#include <Arduino.h>
|
||||
#include <helpers/NRF52Board.h>
|
||||
|
||||
// built-ins
|
||||
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
|
||||
|
||||
#define VBAT_DIVIDER (0.5F) // 150K + 150K voltage divider on VBAT
|
||||
#define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider
|
||||
|
||||
#define PIN_VBAT_READ (4)
|
||||
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
// ============================================================
|
||||
// T-Echo Lite battery pins — hardcoded from LilyGo t_echo_lite_config.h
|
||||
// NOT using any defines from variant.h for battery measurement
|
||||
// ============================================================
|
||||
#define PIN_VBAT_READ _PINNUM(0, 2) // BATTERY_ADC_DATA
|
||||
#define PIN_VBAT_MEAS_EN _PINNUM(0, 31) // BATTERY_MEASUREMENT_CONTROL
|
||||
|
||||
class TechoBoard : public NRF52BoardDCDC {
|
||||
public:
|
||||
@@ -20,10 +18,11 @@ public:
|
||||
uint16_t getBattMilliVolts() override;
|
||||
|
||||
const char* getManufacturerName() const override {
|
||||
return "LilyGo T-Echo";
|
||||
return "LilyGo T-Echo Lite";
|
||||
}
|
||||
|
||||
void powerOff() override {
|
||||
digitalWrite(PIN_VBAT_MEAS_EN, LOW);
|
||||
#ifdef LED_RED
|
||||
digitalWrite(LED_RED, LOW);
|
||||
#endif
|
||||
@@ -41,4 +40,4 @@ public:
|
||||
#endif
|
||||
sd_power_system_off();
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user