feat: use (only) dedicated charge led on compatible Jumper handsets (#5512)

This commit is contained in:
3djc
2024-09-11 18:50:16 +10:00
committed by GitHub
parent b78da3436e
commit f680d86034
4 changed files with 31 additions and 35 deletions
+3 -33
View File
@@ -127,46 +127,14 @@ void boardInit()
board_set_bor_level();
#endif
pwrInit();
#if defined(FUNCTION_SWITCHES) && !defined(DEBUG_SEGGER_RTT)
#if defined(RADIO_T15)
#define LEDCHARGEON(x) fsLedOff(x)
#define LEDCHARGEOFF(x) fsLedOn(x)
#else
#define LEDCHARGEON(x) fsLedOn(x)
#define LEDCHARGEOFF(x) fsLedOff(x)
#endif
#if defined(FUNCTION_SWITCHES) && !defined(DEBUG_DISABLE_USB)
// This is needed to prevent radio from starting when usb is plugged to charge
usbInit();
ledInit();
// prime debounce state...
usbPlugged();
if (usbPlugged()) {
delaysInit();
adcInit(&_adc_driver);
getADC();
pwrOn(); // required to get bat adc reads
INTERNAL_MODULE_OFF();
EXTERNAL_MODULE_OFF();
for (uint8_t i=0; i < NUM_FUNCTIONS_SWITCHES; i++)
LEDCHARGEOFF(i);
while (usbPlugged()) {
// Let it charge ...
getADC(); // Warning: the value read does not include VBAT calibration
// Also, MCU is running which create a drop vs off
if (getBatteryVoltage() >= 660)
LEDCHARGEON(0);
if (getBatteryVoltage() >= 700)
LEDCHARGEON(1);
if (getBatteryVoltage() >= 740)
LEDCHARGEON(2);
if (getBatteryVoltage() >= 780)
LEDCHARGEON(3);
if (getBatteryVoltage() >= 810)
LEDCHARGEON(4);
if (getBatteryVoltage() >= 820)
LEDCHARGEON(5);
delay_ms(1000);
}
while(1) // Wait power to drain
@@ -174,6 +142,8 @@ void boardInit()
}
#endif
pwrInit();
boardInitModulePorts();
#if defined(INTMODULE_HEARTBEAT) && \