kopia lustrzana https://github.com/OpenRTX/OpenRTX
Print battery voltage instead of battery icon for platform without battery
rodzic
795d8d4451
commit
2d3d932111
|
@ -695,6 +695,7 @@ void ui_saveState()
|
||||||
|
|
||||||
void ui_updateFSM(event_t event, bool *sync_rtx)
|
void ui_updateFSM(event_t event, bool *sync_rtx)
|
||||||
{
|
{
|
||||||
|
#ifndef BAT_NONE
|
||||||
// The volume knob has been set to OFF, shutdown the radio
|
// The volume knob has been set to OFF, shutdown the radio
|
||||||
if(state.v_bat <= 0)
|
if(state.v_bat <= 0)
|
||||||
{
|
{
|
||||||
|
@ -702,7 +703,7 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
|
||||||
platform_terminate();
|
platform_terminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Check if battery has enough charge to operate.
|
// Check if battery has enough charge to operate.
|
||||||
// Check is skipped if there is an ongoing transmission, since the voltage
|
// Check is skipped if there is an ongoing transmission, since the voltage
|
||||||
// drop caused by the RF PA power absorption causes spurious triggers of
|
// drop caused by the RF PA power absorption causes spurious triggers of
|
||||||
|
|
|
@ -39,14 +39,19 @@ void _ui_drawMainTop()
|
||||||
color_white, "%02d:%02d:%02d", last_state.time.hour,
|
color_white, "%02d:%02d:%02d", last_state.time.hour,
|
||||||
last_state.time.minute, last_state.time.second);
|
last_state.time.minute, last_state.time.second);
|
||||||
#endif
|
#endif
|
||||||
|
// If the radio has no built-in battery, print input voltage
|
||||||
// Print battery icon on top bar, use 4 px padding
|
#ifdef BAT_NONE
|
||||||
|
char volt_buf[6] = "";
|
||||||
|
snprintf(volt_buf, sizeof(volt_buf), "%.1fV", last_state.v_bat);
|
||||||
|
gfx_print(layout.top_pos, volt_buf, layout.top_font, TEXT_ALIGN_RIGHT, color_white);
|
||||||
|
#else
|
||||||
|
// Otherwise print battery icon on top bar, use 4 px padding
|
||||||
uint16_t bat_width = SCREEN_WIDTH / 9;
|
uint16_t bat_width = SCREEN_WIDTH / 9;
|
||||||
uint16_t bat_height = layout.top_h - (layout.status_v_pad * 2);
|
uint16_t bat_height = layout.top_h - (layout.status_v_pad * 2);
|
||||||
point_t bat_pos = {SCREEN_WIDTH - bat_width - layout.horizontal_pad,
|
point_t bat_pos = {SCREEN_WIDTH - bat_width - layout.horizontal_pad,
|
||||||
layout.status_v_pad};
|
layout.status_v_pad};
|
||||||
gfx_drawBattery(bat_pos, bat_width, bat_height, last_state.charge);
|
gfx_drawBattery(bat_pos, bat_width, bat_height, last_state.charge);
|
||||||
|
#endif
|
||||||
// Print radio mode on top bar
|
// Print radio mode on top bar
|
||||||
switch(last_state.channel.mode)
|
switch(last_state.channel.mode)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue