Change macro latching behavior

Latch macro menu when macro button is long pressed
Unlatch macro menu when macro button is pressed again
pull/174/head
Marco 2023-08-08 20:20:14 +02:00 zatwierdzone przez Silvano Seva
rodzic 29b6eb08ff
commit 8399dcd3a3
3 zmienionych plików z 14 dodań i 6 usunięć

Wyświetl plik

@ -207,8 +207,8 @@ typedef struct ui_state_t
ui_state_t;
extern layout_t layout;
// Copy of the radio state
extern state_t last_state;
extern bool macro_latched;
extern const char *menu_items[];
extern const char *settings_items[];
extern const char *display_items[];

Wyświetl plik

@ -256,6 +256,7 @@ const color_t yellow_fab413 = {250, 180, 19, 255};
layout_t layout;
state_t last_state;
bool macro_latched;
static ui_state_t ui_state;
static bool macro_menu = false;
static bool layout_ready = false;
@ -1268,17 +1269,19 @@ void ui_updateFSM(bool *sync_rtx)
// If MONI is pressed, activate MACRO functions
bool moniPressed = (msg.keys & KEY_MONI) ? true : false;
if(moniPressed || FunctionKeyIsLatched())
if(moniPressed || macro_latched)
{
macro_menu = true;
// long press moni on its own latches function.
if (moniPressed && msg.long_press && !input_getPressedNumber(msg))
if (moniPressed && msg.long_press && !macro_latched)
{
SetFunctionLatchTimer(); // 3000 ms.
macro_latched = true;
vp_beep(BEEP_FUNCTION_LATCH_ON, LONG_BEEP);
}
else
else if (moniPressed && macro_latched)
{
ReleaseFunctionLatchIfNeeded();
macro_latched = false;
vp_beep(BEEP_FUNCTION_LATCH_OFF, LONG_BEEP);
}
_ui_fsm_menuMacro(msg, sync_rtx);
return;

Wyświetl plik

@ -877,6 +877,11 @@ bool _ui_drawMacroMenu()
// Header
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->macroMenu);
if (macro_latched)
{
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, "L");
}
// First row
if (last_state.channel.mode == OPMODE_FM)
{