From 9038745b6fad1f64e02587be249e64059cdeea42 Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Tue, 31 May 2022 10:00:15 +1000 Subject: [PATCH] extracted logic for testing if the function key is latched into its own function for readability. --- openrtx/src/ui/ui.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 2b2065f7..e30e8262 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -107,7 +107,10 @@ static void SetFunctionLatchTimer() { functionLatchTimer= getTick() + FUNCTION_LATCH_TIMEOUT; } - +static bool FunctionKeyIsLatched() +{ + return (functionLatchTimer > 0) && (getTick() < functionLatchTimer); +} /* UI main screen functions, their implementation is in "ui_main.c" */ extern void _ui_drawMainBackground(); extern void _ui_drawMainTop(); @@ -1100,8 +1103,8 @@ void ui_updateFSM(bool *sync_rtx) // If MONI is pressed, activate MACRO functions bool moniPressed=(msg.keys & KEY_MONI) ? true : false; - if(moniPressed || ((functionLatchTimer > 0) && (getTick() < functionLatchTimer) )) - { + if(moniPressed || FunctionKeyIsLatched()) + { macro_menu = true; // long press moni on its own latches function. if (moniPressed && msg.long_press && !input_getPressedNumber(msg))