diff --git a/radio/src/gui/colorlcd/model/function_switches.cpp b/radio/src/gui/colorlcd/model/function_switches.cpp index 5ed3f019a..8728258a5 100644 --- a/radio/src/gui/colorlcd/model/function_switches.cpp +++ b/radio/src/gui/colorlcd/model/function_switches.cpp @@ -115,8 +115,8 @@ class FunctionSwitch : public Window #if defined(FUNCTION_SWITCHES_RGB_LEDS) #if NARROW_LAYOUT - new StaticText(this, rect_t{C1_X - C1_W - PAD_TINY, C1_Y + PAD_SMALL, C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); - new StaticText(this, rect_t{C2_X - C2_W - PAD_TINY, C2_Y + PAD_SMALL, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); + new StaticText(this, {C1_X - C1_W - PAD_TINY, C1_Y + COLLBL_YO, C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); + new StaticText(this, {C2_X - C2_W - PAD_TINY, C2_Y + COLLBL_YO, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); #endif offValue = g_model.cfsOffColor(switchIndex); @@ -158,9 +158,9 @@ class FunctionSwitch : public Window }, [=](int newValue) { previewColor(newValue); }, ETX_RGB888); - overrideLabel = new StaticText(this, {GR_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_LARGE, GR_W + ST_W - PAD_LARGE, 0}, + overrideLabel = new StaticText(this, {OVRLBL_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_LARGE, OVRLBL_W, 0}, STR_LUA_OVERRIDE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); - offOverride = new ToggleSwitch(this, {C1_X - PAD_MEDIUM * 2, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0}, + offOverride = new ToggleSwitch(this, {OVROFF_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0}, [=]() { return g_model.cfsOffColorLuaOverride(switchIndex); }, [=](bool v) { g_model.cfsSetOffColorLuaOverride(switchIndex, v); }); onOverride = new ToggleSwitch(this, {C2_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0}, @@ -183,12 +183,16 @@ class FunctionSwitch : public Window static LAYOUT_VAL_SCALED(ST_W, 60) #if NARROW_LAYOUT static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 3 + PAD_OUTLINE * 4; - static constexpr coord_t C1_X = TP_X; + static constexpr coord_t C1_X = GR_X; static constexpr coord_t C1_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE; static LAYOUT_VAL_SCALED(C1_W, 40) - static constexpr coord_t C2_X = GR_X; + static constexpr coord_t C2_X = ST_X; static constexpr coord_t C2_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE; static LAYOUT_VAL_SCALED(C2_W, 40) + static constexpr coord_t OVRLBL_X = NM_X; + static constexpr coord_t OVRLBL_W = NM_W + TP_W; + static constexpr coord_t OVROFF_X = C1_X; + static constexpr coord_t COLLBL_YO = PAD_MEDIUM; #else static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 2 + PAD_OUTLINE * 3; static constexpr coord_t C1_X = ST_X + ST_W + PAD_SMALL; @@ -197,6 +201,10 @@ class FunctionSwitch : public Window static constexpr coord_t C2_X = C1_X + C1_W + PAD_SMALL; static constexpr coord_t C2_Y = 0; static LAYOUT_VAL_SCALED(C2_W, 40) + static constexpr coord_t OVRLBL_X = GR_X; + static constexpr coord_t OVRLBL_W = GR_W + ST_W - PAD_LARGE; + static constexpr coord_t OVROFF_X = C1_X - PAD_MEDIUM * 2; + static constexpr coord_t COLLBL_YO = PAD_SMALL; #endif #else static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE * 2; @@ -350,16 +358,16 @@ ModelFunctionSwitches::ModelFunctionSwitches() : Page(ICON_MODEL_SETUP) body->setFlexLayout(LV_FLEX_FLOW_COLUMN, PAD_ZERO); auto box = new Window(body, {0, 0, LV_PCT(100), LV_SIZE_CONTENT}); - new StaticText(box, rect_t{0, 0, FunctionSwitch::SW_W, 0}, STR_SWITCHES); - new StaticText(box, rect_t{FunctionSwitch::NM_X + PAD_OUTLINE, 0, FunctionSwitch::NM_W, 0}, STR_NAME, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - new StaticText(box, rect_t{FunctionSwitch::TP_X + PAD_OUTLINE, 0, FunctionSwitch::TP_W, 0}, STR_SWITCH_TYPE, + new StaticText(box, {0, 0, FunctionSwitch::SW_W, 0}, STR_SWITCHES); + new StaticText(box, {FunctionSwitch::NM_X + PAD_OUTLINE, 0, FunctionSwitch::NM_W, 0}, STR_NAME, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); + new StaticText(box, {FunctionSwitch::TP_X + PAD_OUTLINE, 0, FunctionSwitch::TP_W, 0}, STR_SWITCH_TYPE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - new StaticText(box, rect_t{FunctionSwitch::GR_X + PAD_OUTLINE, 0, FunctionSwitch::GR_W, 0}, STR_GROUP, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - startupHeader = new StaticText(box, rect_t{FunctionSwitch::ST_X + PAD_OUTLINE, 0, FunctionSwitch::ST_W, 0}, STR_SWITCH_STARTUP, + new StaticText(box, {FunctionSwitch::GR_X + PAD_OUTLINE, 0, FunctionSwitch::GR_W, 0}, STR_GROUP, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); + startupHeader = new StaticText(box, {FunctionSwitch::ST_X + PAD_OUTLINE, 0, FunctionSwitch::ST_W, 0}, STR_SWITCH_STARTUP, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); #if defined(FUNCTION_SWITCHES_RGB_LEDS) && !NARROW_LAYOUT - new StaticText(box, rect_t{FunctionSwitch::C1_X + PAD_OUTLINE, 0, FunctionSwitch::C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - new StaticText(box, rect_t{FunctionSwitch::C2_X + PAD_OUTLINE, 0, FunctionSwitch::C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); + new StaticText(box, {FunctionSwitch::C1_X + PAD_OUTLINE, 0, FunctionSwitch::C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); + new StaticText(box, {FunctionSwitch::C2_X + PAD_OUTLINE, 0, FunctionSwitch::C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); #endif for (uint8_t i = 0; i < switchGetMaxSwitches(); i += 1) { diff --git a/radio/src/gui/colorlcd/radio/radio_cfs.cpp b/radio/src/gui/colorlcd/radio/radio_cfs.cpp index 1cf3862cd..c962c3233 100644 --- a/radio/src/gui/colorlcd/radio/radio_cfs.cpp +++ b/radio/src/gui/colorlcd/radio/radio_cfs.cpp @@ -31,23 +31,6 @@ #define SET_DIRTY() storageDirty(EE_GENERAL) -static const lv_coord_t cfs_line_col_dsc1[] = {LV_GRID_CONTENT, - LV_GRID_TEMPLATE_LAST}; - -#if defined(FUNCTION_SWITCHES_RGB_LEDS) -static const lv_coord_t cfs_line_col_dsc2[] = { - LV_GRID_FR(13), LV_GRID_FR(11), LV_GRID_FR(11), - LV_GRID_FR(12), LV_GRID_FR(10), LV_GRID_FR(7), LV_GRID_FR(7), - LV_GRID_TEMPLATE_LAST}; -#else -static const lv_coord_t cfs_line_col_dsc2[] = { - LV_GRID_FR(10), LV_GRID_FR(10), LV_GRID_FR(10), - LV_GRID_FR(12), LV_GRID_FR(8), LV_GRID_TEMPLATE_LAST}; -#endif - -static const lv_coord_t cfs_line_row_dsc[] = {LV_GRID_CONTENT, - LV_GRID_TEMPLATE_LAST}; - extern const char* _fct_sw_start[]; extern const char* edgetx_fs_manual_url; @@ -102,15 +85,15 @@ class RadioFunctionSwitch : public Window #if defined(FUNCTION_SWITCHES_RGB_LEDS) #if NARROW_LAYOUT - new StaticText(this, rect_t{C1_X - C1_W - PAD_TINY, C1_Y + PAD_SMALL, C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); - new StaticText(this, rect_t{C2_X - C2_W - PAD_TINY, C2_Y + PAD_SMALL, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); + new StaticText(this, {C1_X - C1_W - PAD_TINY, C1_Y + COLLBL_YO, C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); + new StaticText(this, {C2_X - C2_W - PAD_TINY, C2_Y + COLLBL_YO, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); #endif offValue = g_eeGeneral.switchOffColor(switchIndex); onValue = g_eeGeneral.switchOnColor(switchIndex); offColor = new ColorPicker( - this, {C1_X, 0, C1_W, 0}, + this, {C1_X, C1_Y, C1_W, 0}, [=]() -> int { // getValue return g_eeGeneral.switchOffColor(switchIndex).getColor() | RGB888_FLAG; }, @@ -128,7 +111,7 @@ class RadioFunctionSwitch : public Window [=](int newValue) { previewColor(newValue); }, ETX_RGB888); onColor = new ColorPicker( - this, {C2_X, 0, C2_W, 0}, + this, {C2_X, C2_Y, C2_W, 0}, [=]() -> int { // getValue return g_eeGeneral.switchOnColor(switchIndex).getColor() | RGB888_FLAG; }, @@ -145,9 +128,9 @@ class RadioFunctionSwitch : public Window }, [=](int newValue) { previewColor(newValue); }, ETX_RGB888); - overrideLabel = new StaticText(this, {GR_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_LARGE, GR_W + ST_W - PAD_LARGE, 0}, + overrideLabel = new StaticText(this, {OVRLBL_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_LARGE, OVRLBL_W, 0}, STR_LUA_OVERRIDE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT); - offOverride = new ToggleSwitch(this, {C1_X - PAD_MEDIUM * 2, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0}, + offOverride = new ToggleSwitch(this, {OVROFF_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0}, [=]() { return g_model.cfsOffColorLuaOverride(switchIndex); }, [=](bool v) { g_model.cfsSetOffColorLuaOverride(switchIndex, v); }); onOverride = new ToggleSwitch(this, {C2_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0}, @@ -170,12 +153,16 @@ class RadioFunctionSwitch : public Window static LAYOUT_VAL_SCALED(ST_W, 60) #if NARROW_LAYOUT static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 3 + PAD_OUTLINE * 4; - static constexpr coord_t C1_X = TP_X; + static constexpr coord_t C1_X = GR_X; static constexpr coord_t C1_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE; static LAYOUT_VAL_SCALED(C1_W, 40) - static constexpr coord_t C2_X = GR_X; + static constexpr coord_t C2_X = ST_X; static constexpr coord_t C2_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE; static LAYOUT_VAL_SCALED(C2_W, 40) + static constexpr coord_t OVRLBL_X = NM_X; + static constexpr coord_t OVRLBL_W = NM_W + TP_W; + static constexpr coord_t OVROFF_X = C1_X; + static constexpr coord_t COLLBL_YO = PAD_MEDIUM; #else static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 2 + PAD_OUTLINE * 3; static constexpr coord_t C1_X = ST_X + ST_W + PAD_SMALL; @@ -184,6 +171,10 @@ class RadioFunctionSwitch : public Window static constexpr coord_t C2_X = C1_X + C1_W + PAD_SMALL; static constexpr coord_t C2_Y = 0; static LAYOUT_VAL_SCALED(C2_W, 40) + static constexpr coord_t OVRLBL_X = GR_X; + static constexpr coord_t OVRLBL_W = GR_W + ST_W - PAD_LARGE; + static constexpr coord_t OVROFF_X = C1_X - PAD_MEDIUM * 2; + static constexpr coord_t COLLBL_YO = PAD_SMALL; #endif #else static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE * 2; @@ -262,21 +253,16 @@ RadioFunctionSwitches::RadioFunctionSwitches() : Page(ICON_RADIO_HARDWARE) body->padAll(PAD_TINY); body->setFlexLayout(LV_FLEX_FLOW_COLUMN, PAD_ZERO); - FlexGridLayout grid1(cfs_line_col_dsc1, cfs_line_row_dsc, PAD_TINY); - FlexGridLayout grid2(cfs_line_col_dsc2, cfs_line_row_dsc, PAD_TINY); - - auto line = body->newLine(grid2); - new StaticText(line, rect_t{}, STR_SWITCHES); - new StaticText(line, rect_t{}, STR_NAME, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - new StaticText(line, rect_t{}, STR_SWITCH_TYPE, + auto box = new Window(body, {0, 0, LV_PCT(100), LV_SIZE_CONTENT}); + new StaticText(box, {0, 0, RadioFunctionSwitch::SW_W, 0}, STR_SWITCHES); + new StaticText(box, {RadioFunctionSwitch::NM_X + PAD_OUTLINE, 0, RadioFunctionSwitch::NM_W, 0}, STR_NAME, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); + new StaticText(box, {RadioFunctionSwitch::TP_X + PAD_OUTLINE, 0, RadioFunctionSwitch::TP_W, 0}, STR_SWITCH_TYPE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - grid2.nextColumn(); - // new StaticText(line, rect_t{}, STR_GROUP, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - startupHeader = new StaticText(line, rect_t{}, STR_SWITCH_STARTUP, + startupHeader = new StaticText(box, {RadioFunctionSwitch::ST_X + PAD_OUTLINE, 0, RadioFunctionSwitch::ST_W, 0}, STR_SWITCH_STARTUP, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); -#if defined(FUNCTION_SWITCHES_RGB_LEDS) - new StaticText(line, rect_t{}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - new StaticText(line, rect_t{}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); +#if defined(FUNCTION_SWITCHES_RGB_LEDS) && !NARROW_LAYOUT + new StaticText(box, {RadioFunctionSwitch::C1_X + PAD_OUTLINE, 0, RadioFunctionSwitch::C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); + new StaticText(box, {RadioFunctionSwitch::C2_X + PAD_OUTLINE, 0, RadioFunctionSwitch::C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); #endif for (uint8_t i = 0; i < switchGetMaxSwitches(); i += 1) { @@ -284,20 +270,21 @@ RadioFunctionSwitches::RadioFunctionSwitches() : Page(ICON_RADIO_HARDWARE) new RadioFunctionSwitch(body, i); } - setState(); +#if defined(HARDWARE_TOUCH) + body->padBottom(PAD_LARGE); - line = body->newLine(grid1); + box = new Window(body, {0, 0, LV_PCT(100), LV_SIZE_CONTENT}); - new StaticText(line, rect_t{}, STR_MORE_INFO); + new StaticText(box, rect_t{}, STR_MORE_INFO); - line = body->newLine(grid1); - line->padBottom(PAD_LARGE); - line->padLeft((width() - 150) / 2); - - auto qr = lv_qrcode_create(line->getLvObj(), 150, + auto qr = lv_qrcode_create(box->getLvObj(), 150, makeLvColor(COLOR_THEME_SECONDARY1), makeLvColor(COLOR_THEME_SECONDARY3)); lv_qrcode_update(qr, edgetx_fs_manual_url, strlen(edgetx_fs_manual_url)); + lv_obj_set_pos(qr, (LCD_W - 150) / 2, EdgeTxStyles::STD_FONT_HEIGHT); +#endif + + setState(); } void RadioFunctionSwitches::setState() diff --git a/radio/src/targets/pa01/CMakeLists.txt b/radio/src/targets/pa01/CMakeLists.txt index 70d9276f5..5a38c632b 100644 --- a/radio/src/targets/pa01/CMakeLists.txt +++ b/radio/src/targets/pa01/CMakeLists.txt @@ -132,7 +132,6 @@ set(BOARD_COMMON_SRC # Bootloader board library add_library(board_bl OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} - ${TARGET_SRC_DIR}/system_clock.c ${TARGET_SRC_DIR}/sdram_driver.cpp ${RADIO_SRC_DIR}/gui/colorlcd/boot_menu.cpp targets/common/arm/stm32/stm32_qspi.cpp @@ -141,6 +140,8 @@ add_library(board_bl OBJECT EXCLUDE_FROM_ALL add_dependencies(board_bl minimal_board_lib) set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $) +set(CMSIS_SRC ${TARGET_SRC_DIR}/system_clock.c) + # Firmware board library add_library(board OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} diff --git a/radio/src/targets/pa01/hal.h b/radio/src/targets/pa01/hal.h index 613073a91..1ac54a595 100644 --- a/radio/src/targets/pa01/hal.h +++ b/radio/src/targets/pa01/hal.h @@ -49,8 +49,8 @@ #define KEYS_GPIO_PIN_PAGEUP #define KEYS_GPIO_REG_PAGEDN #define KEYS_GPIO_PIN_PAGEDN -#define KEYS_GPIO_REG_SYS -#define KEYS_GPIO_PIN_SYS +#define KEYS_GPIO_REG_MDL +#define KEYS_GPIO_PIN_MDL #define KEYS_GPIO_REG_EXIT #define KEYS_GPIO_PIN_EXIT @@ -360,11 +360,11 @@ // LED Strip #define LED_STRIP_LENGTH 14 -#define BLING_LED_STRIP_START 0 -#define BLING_LED_STRIP_LENGTH 10 -#define CFS_LED_STRIP_START 10 -#define CFS_LED_STRIP_LENGTH 4 -#define CFS_LEDS_PER_SWITCH 1 +#define BLING_LED_STRIP_START 10 +#define BLING_LED_STRIP_LENGTH 4 +#define CFS_LED_STRIP_START 0 +#define CFS_LED_STRIP_LENGTH 8 +#define CFS_LEDS_PER_SWITCH 2 #define LED_STRIP_GPIO GPIO_PIN(GPIOF, 06) // PF.06 / TIM16_CH1 #define LED_STRIP_GPIO_AF LL_GPIO_AF_1 // TIM1/2/16/17 #define LED_STRIP_TIMER TIM16