From e54234f96818d1a205f0be936e301a1fbb608bc0 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Thu, 28 Dec 2023 10:39:32 +0100 Subject: [PATCH] Renamed UI_NO_KEYBOARD macro to CONFIG_UI_NO_KEYBOARD --- openrtx/include/ui/ui_default.h | 2 +- openrtx/src/ui/default/ui.c | 14 ++++----- openrtx/src/ui/default/ui_menu.c | 36 ++++++++++++------------ platform/targets/ttwrplus/CMakeLists.txt | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/openrtx/include/ui/ui_default.h b/openrtx/include/ui/ui_default.h index c6694a18..e83dce22 100644 --- a/openrtx/include/ui/ui_default.h +++ b/openrtx/include/ui/ui_default.h @@ -227,7 +227,7 @@ typedef struct ui_state_t freq_t new_offset; // Which state to return to when we exit menu uint8_t last_main_state; -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) uint8_t macro_menu_selected; #endif // UI_NO_KEYBOARD } diff --git a/openrtx/src/ui/default/ui.c b/openrtx/src/ui/default/ui.c index dddb220f..155b1c74 100644 --- a/openrtx/src/ui/default/ui.c +++ b/openrtx/src/ui/default/ui.c @@ -886,7 +886,7 @@ static bool _ui_exitStandby(long long now) static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) { // If there is no keyboard left and right select the menu entry to edit -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (msg.keys & KNOB_LEFT) { ui_state.macro_menu_selected--; @@ -902,9 +902,9 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) ui_state.input_number = ui_state.macro_menu_selected + 1; else ui_state.input_number = 0; -#else // UI_NO_KEYBOARD +#else // CONFIG_UI_NO_KEYBOARD ui_state.input_number = input_getPressedNumber(msg); -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD // CTCSS Encode/Decode Selection bool tone_tx_enable = state.channel.fm.txToneEn; bool tone_rx_enable = state.channel.fm.rxToneEn; @@ -1171,7 +1171,7 @@ static void _ui_numberInputKeypad(uint32_t *num, kbd_msg_t msg) { long long now = getTick(); -#ifdef UI_NO_KEYBOARD +#ifdef CONFIG_UI_NO_KEYBOARD // If knob is turned, increment or Decrement if (msg.keys & KNOB_LEFT) { @@ -2140,10 +2140,10 @@ void ui_updateFSM(bool *sync_rtx) { case R_OFFSET: // Handle offset frequency input -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if(msg.long_press && msg.keys & KEY_ENTER) { - // Long press on UI_NO_KEYBOARD causes digits to advance by one + // Long press on CONFIG_UI_NO_KEYBOARD causes digits to advance by one ui_state.new_offset /= 10; #else if(msg.keys & KEY_ENTER) @@ -2167,7 +2167,7 @@ void ui_updateFSM(bool *sync_rtx) { _ui_numberInputDel(&ui_state.new_offset); } -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) else if(msg.keys & KNOB_LEFT || msg.keys & KNOB_RIGHT || msg.keys & KEY_ENTER) #else else if(input_isNumberPressed(msg)) diff --git a/openrtx/src/ui/default/ui_menu.c b/openrtx/src/ui/default/ui_menu.c index f3d15268..29076128 100644 --- a/openrtx/src/ui/default/ui_menu.c +++ b/openrtx/src/ui/default/ui_menu.c @@ -1023,9 +1023,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) * If we have a keyboard installed draw all numbers, otherwise draw only the * currently selected number. */ -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 0) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT, yellow_fab413, "1"); gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT, @@ -1033,9 +1033,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT, color_white, " %7.1f", ctcss_tone[last_state.channel.fm.txTone]/10.0f); -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 1) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER, yellow_fab413, "2"); gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER, @@ -1050,9 +1050,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER, yellow_fab413, "2"); } -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 2) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT, yellow_fab413, "3 "); @@ -1084,9 +1084,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) point_t pos_2 = {layout.line1_pos.x, layout.line1_pos.y + (layout.line3_large_pos.y - layout.line1_pos.y)/2}; -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 3) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT, yellow_fab413, "4"); @@ -1116,9 +1116,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) } -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 4) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, yellow_fab413, "5"); @@ -1139,18 +1139,18 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, color_white, mode_str); -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 5) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT, yellow_fab413, "6 "); gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT, color_white, "%.1gW", dBmToWatt(last_state.channel.power)); // Third row -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 6) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, yellow_fab413, "7"); #ifdef CONFIG_SCREEN_BRIGHTNESS @@ -1161,9 +1161,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) state.settings.brightness); #endif -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 7) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER, yellow_fab413, "8"); #ifdef CONFIG_SCREEN_BRIGHTNESS @@ -1171,9 +1171,9 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) color_white, " B+"); #endif -#if defined(UI_NO_KEYBOARD) +#if defined(CONFIG_UI_NO_KEYBOARD) if (ui_state->macro_menu_selected == 8) -#endif // UI_NO_KEYBOARD +#endif // CONFIG_UI_NO_KEYBOARD gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT, yellow_fab413, "9 "); if( ui_state->input_locked == true ) diff --git a/platform/targets/ttwrplus/CMakeLists.txt b/platform/targets/ttwrplus/CMakeLists.txt index 7f8fbf8a..845cd7e5 100644 --- a/platform/targets/ttwrplus/CMakeLists.txt +++ b/platform/targets/ttwrplus/CMakeLists.txt @@ -35,4 +35,4 @@ target_include_directories(app ${OPENRTX_ROOT}/subprojects/XPowersLib/src/REG ) -target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS CONFIG_SCREEN_BRIGHTNESS UI_NO_KEYBOARD) +target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS CONFIG_SCREEN_BRIGHTNESS CONFIG_UI_NO_KEYBOARD)