Files
MeshCore/variants/lilygo_techo_card/TechoCardBoard.h
T
mikecarper ab6412e73c Add persistent battery ADC calibration across boards
Add meter-reference calibration with saved ADC corrections, checked persistence and rollback. Preserve existing board coefficients and nRF52 voltage policy, and merge the Mini Repeater feature gates.

Validation: 69 focused tests, hosted documentation checks, and four firmware builds passed. Mini Repeater retains calibration and its existing filesystem with 376 flash bytes free; earlier Mini Sensor size failures remain documented.
2026-10-22 18:56:32 -07:00

40 lines
1.0 KiB
C++

#pragma once
#include <MeshCore.h>
#include <Arduino.h>
#include <helpers/NRF52Board.h>
#include <Adafruit_NeoPixel.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) // Even voltage divider on VBAT
#define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider
#define PIN_VBAT_READ (2)
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
class TechoCardBoard : public NRF52BoardDCDC {
bool _torchStatus = false;
public:
TechoCardBoard() : NRF52Board("TECHO_OTA") {}
void begin();
bool supportsBatteryCalibration() const override { return true; }
uint16_t getBattMilliVolts() override;
void applyLedPolicy() override;
void onBeforeTransmit(void) override;
void onAfterTransmit(void) override;
const char* getManufacturerName() const override {
return "LilyGo T-Echo Card";
}
void shutdownPeripherals() override;
void toggleTorch();
void turnOffLeds();
};