kopia lustrzana https://github.com/OpenRTX/OpenRTX
Display timer UI
rodzic
269420c2be
commit
d742d027b7
|
@ -97,6 +97,7 @@ enum displayItems
|
|||
#ifdef SCREEN_CONTRAST
|
||||
,D_CONTRAST
|
||||
#endif
|
||||
,D_TIMER
|
||||
};
|
||||
|
||||
#ifdef HAS_GPS
|
||||
|
|
|
@ -137,8 +137,9 @@ const char *display_items[] =
|
|||
{
|
||||
"Brightness",
|
||||
#ifdef SCREEN_CONTRAST
|
||||
"Contrast"
|
||||
"Contrast",
|
||||
#endif
|
||||
"Timer"
|
||||
};
|
||||
|
||||
#ifdef HAS_GPS
|
||||
|
@ -644,6 +645,17 @@ void _ui_changeContrast(int variation)
|
|||
display_setContrast(state.settings.contrast);
|
||||
}
|
||||
|
||||
void _ui_changeTimer(int variation)
|
||||
{
|
||||
if ((state.settings.brightness_timer == TIMER_OFF && variation < 0) ||
|
||||
(state.settings.brightness_timer == TIMER_1H && variation > 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
state.settings.brightness_timer += variation;
|
||||
}
|
||||
|
||||
bool _ui_checkStandby(long long time_since_last_event)
|
||||
{
|
||||
if (standby)
|
||||
|
@ -1449,6 +1461,9 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
|
|||
_ui_changeContrast(-4);
|
||||
break;
|
||||
#endif
|
||||
case D_TIMER:
|
||||
_ui_changeTimer(-1);
|
||||
break;
|
||||
default:
|
||||
state.ui_screen = SETTINGS_DISPLAY;
|
||||
}
|
||||
|
@ -1466,6 +1481,9 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
|
|||
_ui_changeContrast(+4);
|
||||
break;
|
||||
#endif
|
||||
case D_TIMER:
|
||||
_ui_changeTimer(+1);
|
||||
break;
|
||||
default:
|
||||
state.ui_screen = SETTINGS_DISPLAY;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,26 @@
|
|||
/* UI main screen helper functions, their implementation is in "ui_main.c" */
|
||||
extern void _ui_drawMainBottom();
|
||||
|
||||
const char *display_timer_values[] =
|
||||
{
|
||||
"Off",
|
||||
"5 s",
|
||||
"10 s",
|
||||
"15 s",
|
||||
"20 s",
|
||||
"25 s",
|
||||
"30 s",
|
||||
"1 min",
|
||||
"2 min",
|
||||
"3 min",
|
||||
"4 min",
|
||||
"5 min",
|
||||
"15 min",
|
||||
"30 min",
|
||||
"45 min",
|
||||
"1 hour"
|
||||
};
|
||||
|
||||
void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_t max_len, uint8_t index))
|
||||
{
|
||||
point_t pos = layout.line1_pos;
|
||||
|
@ -138,6 +158,10 @@ int _ui_getDisplayValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
value = last_state.settings.contrast;
|
||||
break;
|
||||
#endif
|
||||
case D_TIMER:
|
||||
snprintf(buf, max_len, "%s",
|
||||
display_timer_values[last_state.settings.brightness_timer]);
|
||||
return 0;
|
||||
}
|
||||
snprintf(buf, max_len, "%d", value);
|
||||
return 0;
|
||||
|
|
Ładowanie…
Reference in New Issue