feat: use (only) dedicated charge led on compatible Jumper handsets (#5512)
This commit is contained in:
@@ -75,6 +75,7 @@ if (PCB STREQUAL X10)
|
||||
endif()
|
||||
# Aux2 is reserved for serial gimbal on this radio
|
||||
set(AUX2_SERIAL OFF)
|
||||
set(USB_CHARGE_LED YES)
|
||||
add_definitions(-DMANUFACTURER_JUMPER)
|
||||
set(LCD_DRIVER lcd_st7796s_driver.cpp)
|
||||
elseif (PCBREV STREQUAL T16)
|
||||
@@ -341,6 +342,10 @@ if(SWSERIALPOWER)
|
||||
add_definitions(-DSWSERIALPOWER)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGE_LED)
|
||||
add_definitions(-DUSB_CHARGE_LED)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGER)
|
||||
add_definitions(-DUSB_CHARGER)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/usb_charger_driver.cpp)
|
||||
|
||||
@@ -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) && \
|
||||
|
||||
Reference in New Issue
Block a user