Skip to content

Commit f28c115

Browse files
authored
refactor(color): use LVGL styles and objects for UI, legacy cleanup (#4407)
1 parent 5ff5c2a commit f28c115

File tree

392 files changed

+18567
-19130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

392 files changed

+18567
-19130
lines changed

radio/src/bitmaps/480x272/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,22 @@ set(BITMAP_LZ4_ARGS ${BITMAP_ARGS} --lz4)
1919
set(MASK_LZ4_ARGS ${MASK_ARGS} --lz4)
2020

2121
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash_logo "${RADIO_SRC_DIR}/bitmaps/480x272/splash_logo.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
22-
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
2322
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_masks "${RADIO_SRC_DIR}/bitmaps/480x272/mask_*.png" 8bits "${MASK_LZ4_ARGS}")
2423
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_slider_masks "${RADIO_SRC_DIR}/bitmaps/480x272/slider/*.png" 8bits "${MASK_LZ4_ARGS}")
2524
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_volume_masks ${RADIO_SRC_DIR}/bitmaps/480x272/volume/*.png 8bits "${MASK_LZ4_ARGS}")
2625
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_themes_masks "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/mask_*.png" 8bits "${MASK_LZ4_ARGS}")
2726
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_themes_alpha "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/alpha_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
2827

2928
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bootloader_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/bootloader/bmp_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
30-
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bootloader_icons "${RADIO_SRC_DIR}/bitmaps/480x272/bootloader/icon_*.png" 8bits "${MASK_LZ4_ARGS}")
3129

3230
add_custom_target(${BITMAP_TARGET_PREFIX}_bitmaps)
3331

3432
add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps
3533
${BITMAP_TARGET_PREFIX}_splash_logo
36-
${BITMAP_TARGET_PREFIX}_button_bitmaps
3734
${BITMAP_TARGET_PREFIX}_masks
3835
${BITMAP_TARGET_PREFIX}_slider_masks
3936
${BITMAP_TARGET_PREFIX}_themes_masks
4037
${BITMAP_TARGET_PREFIX}_themes_alpha
4138
${BITMAP_TARGET_PREFIX}_volume_masks
4239
${BITMAP_TARGET_PREFIX}_bootloader_bitmaps
43-
${BITMAP_TARGET_PREFIX}_bootloader_icons
4440
)
Binary file not shown.
-641 Bytes
Binary file not shown.
-276 Bytes
Binary file not shown.
-696 Bytes
Binary file not shown.
-823 Bytes
Binary file not shown.
-514 Bytes
Binary file not shown.
Binary file not shown.
Loading
-251 Bytes
Binary file not shown.
-369 Bytes
Binary file not shown.
-222 Bytes
Binary file not shown.
-212 Bytes
Binary file not shown.
Loading
Loading
-2.54 KB
Binary file not shown.
Binary file not shown.
Loading
Loading
Loading
Loading
-210 Bytes
Binary file not shown.
1.15 KB
Loading
Loading
Loading
Loading
Loading
Loading
1009 Bytes
Loading
Loading

radio/src/boards/generic_stm32/switches.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "stm32_gpio_driver.h"
2525

2626
#include "definitions.h"
27-
#include "opentx_constants.h"
2827
#include "myeeprom.h"
2928

3029
// generated switch structs

radio/src/dataconstants.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
* GNU General Public License for more details.
2020
*/
2121

22-
#ifndef _DATACONSTANTS_H_
23-
#define _DATACONSTANTS_H_
22+
#pragma once
2423

2524
#include "board.h"
2625
#include "storage/yaml/yaml_defs.h"
@@ -683,5 +682,3 @@ enum PPMUnit {
683682
PPM_PERCENT_PREC1,
684683
PPM_US
685684
};
686-
687-
#endif // _DATACONSTANTS_H_

radio/src/gui/colorlcd/CMakeLists.txt

+77-90
Original file line numberDiff line numberDiff line change
@@ -17,87 +17,103 @@ file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd
1717

1818
set(GUI_SRC
1919
${GUI_SRC}
20-
colors.cpp
21-
lcd.cpp
22-
splash.cpp
23-
fonts.cpp
24-
curves.cpp
20+
${THEMES_SRC}
21+
${LAYOUTS_SRC}
22+
${WIDGETS_SRC}
2523
bitmaps.cpp
26-
lz4_bitmaps.cpp
27-
theme.cpp
28-
theme_manager.cpp
24+
channel_bar.cpp
25+
channel_range.cpp
2926
color_editor.cpp
30-
color_picker.cpp
3127
color_list.cpp
32-
preview_window.cpp
28+
color_picker.cpp
29+
colors.cpp
30+
curve.cpp
3331
file_browser.cpp
3432
file_preview.cpp
35-
file_carosell.cpp
33+
fonts.cpp
34+
fullscreen_dialog.cpp
35+
special_functions.cpp
36+
layout.cpp
37+
lcd.cpp
38+
list_line_button.cpp
3639
listbox.cpp
37-
tabsgroup.cpp
40+
LvglWrapper.cpp
41+
menu_model.cpp
42+
menu_radio.cpp
43+
menu_screen.cpp
3844
page.cpp
39-
select_fab_button.cpp
45+
popups.cpp
46+
screen_setup.cpp
47+
screen_user_interface.cpp
4048
select_fab_carousel.cpp
49+
sourcechoice.cpp
50+
startup_shutdown.cpp
51+
switch_warn_dialog.cpp
52+
switchchoice.cpp
53+
tabsgroup.cpp
54+
theme_manager.cpp
55+
theme.cpp
4156
topbar.cpp
42-
layout.cpp
43-
widget.cpp
57+
view_about.cpp
58+
view_channels.cpp
59+
view_logical_switches.cpp
60+
view_main_decoration.cpp
61+
view_main_menu.cpp
62+
view_main.cpp
63+
view_statistics.cpp
64+
view_text.cpp
4465
widget_settings.cpp
45-
${THEMES_SRC}
46-
${LAYOUTS_SRC}
47-
${WIDGETS_SRC}
48-
draw_functions.cpp
49-
menu_model.cpp
50-
model_select.cpp
51-
bind_menu_d16.cpp
52-
trainer_setup.cpp
53-
custom_failsafe.cpp
54-
ppm_settings.cpp
55-
channel_range.cpp
56-
module_setup.cpp
57-
timer_setup.cpp
58-
trims_setup.cpp
59-
throttle_params.cpp
60-
preflight_checks.cpp
61-
model_setup.cpp
66+
widget.cpp
67+
widgets_setup.cpp
68+
curve_param.cpp
69+
curveedit.cpp
70+
fm_matrix.cpp
71+
gvar_numberedit.cpp
72+
input_edit_adv.cpp
73+
input_edit.cpp
74+
input_mix_button.cpp
75+
input_mix_group.cpp
76+
input_source.cpp
77+
mixer_edit_adv.cpp
78+
mixer_edit.cpp
79+
model_curves.cpp
6280
model_flightmodes.cpp
81+
model_gvars.cpp
6382
model_inputs.cpp
83+
model_logical_switches.cpp
6484
model_mixes.cpp
6585
model_outputs.cpp
66-
model_curves.cpp
67-
model_gvars.cpp
68-
model_templates.cpp
69-
model_logical_switches.cpp
70-
special_functions.cpp
86+
model_select.cpp
87+
model_setup.cpp
7188
model_telemetry.cpp
72-
menu_radio.cpp
73-
radio_setup.cpp
74-
radio_sdmanager.cpp
75-
radio_tools.cpp
76-
radio_trainer.cpp
77-
radio_version.cpp
78-
hw_intmodule.cpp
89+
model_templates.cpp
90+
output_edit.cpp
91+
preflight_checks.cpp
92+
throttle_params.cpp
93+
timeedit.cpp
94+
timer_setup.cpp
95+
trainer_setup.cpp
96+
trims_setup.cpp
97+
bind_menu_d16.cpp
98+
custom_failsafe.cpp
7999
hw_extmodule.cpp
100+
hw_intmodule.cpp
101+
module_setup.cpp
102+
ppm_settings.cpp
103+
file_carosell.cpp
80104
hw_inputs.cpp
81105
hw_serial.cpp
82-
radio_hardware.cpp
83-
radio_diagkeys.cpp
106+
preview_window.cpp
107+
radio_calibration.cpp
84108
radio_diaganas.cpp
109+
radio_diagkeys.cpp
110+
radio_hardware.cpp
111+
radio_sdmanager.cpp
112+
radio_setup.cpp
85113
radio_theme.cpp
86-
radio_calibration.cpp
87-
view_about.cpp
88-
view_main.cpp
89-
view_main_menu.cpp
90-
view_main_decoration.cpp
91-
view_channels.cpp
92-
view_logical_switches.cpp
93-
view_statistics.cpp
94-
view_text.cpp
95-
menu_screen.cpp
96-
screen_user_interface.cpp
97-
widgets_setup.cpp
98-
screen_setup.cpp
99-
switch_warn_dialog.cpp
100-
LvglWrapper.cpp
114+
radio_tools.cpp
115+
radio_trainer.cpp
116+
radio_version.cpp
101117
)
102118

103119
macro(add_gui_src src)
@@ -124,10 +140,6 @@ if(HELI)
124140
add_gui_src(model_heli.cpp)
125141
endif()
126142

127-
if(PXX2 OR LUA OR MULTIMODULE)
128-
add_gui_src(radio_tools.cpp)
129-
endif()
130-
131143
if(PXX2 OR MULTIMODULE)
132144
add_gui_src(radio_spectrum_analyser.cpp)
133145
endif()
@@ -193,31 +205,6 @@ set(SRC ${SRC} ${LVGL_FONT_SOURCES})
193205

194206
add_definitions(-DLIBOPENUI)
195207

196-
add_gui_src(fullscreen_dialog.cpp)
197-
add_gui_src(message_dialog.cpp)
198-
add_gui_src(confirm_dialog.cpp)
199-
add_gui_src(popups.cpp)
200-
add_gui_src(timeedit.cpp)
201-
add_gui_src(curve.cpp)
202-
add_gui_src(sourcechoice.cpp)
203-
add_gui_src(switchchoice.cpp)
204-
add_gui_src(curveedit.cpp)
205-
add_gui_src(gvar_numberedit.cpp)
206-
add_gui_src(curve_param.cpp)
207-
add_gui_src(fm_matrix.cpp)
208-
add_gui_src(input_source.cpp)
209-
add_gui_src(input_edit.cpp)
210-
add_gui_src(input_edit_adv.cpp)
211-
add_gui_src(mixer_edit.cpp)
212-
add_gui_src(mixer_edit_adv.cpp)
213-
add_gui_src(output_edit.cpp)
214-
add_gui_src(input_mix_group.cpp)
215-
add_gui_src(input_mix_button.cpp)
216-
add_gui_src(channel_bar.cpp)
217-
218-
add_gui_src(list_line_button.cpp)
219-
220208
if(USBJ_EX)
221209
add_gui_src(model_usbjoystick.cpp)
222210
endif()
223-

radio/src/gui/colorlcd/LvglWrapper.cpp

+3-26
Original file line numberDiff line numberDiff line change
@@ -306,32 +306,6 @@ int8_t rotaryEncoderGetAccel() { return 0; }
306306

307307
#endif // defined(ROTARY_ENCODER_NAVIGATION)
308308

309-
// Return 32 bit version of color (for recolor of buttons)
310-
uint32_t makeLvColor32(uint32_t colorFlags)
311-
{
312-
auto color = COLOR_VAL(colorFlags);
313-
return (GET_RED(color) << 16u) | (GET_GREEN(color) << 8) | GET_BLUE(color);
314-
}
315-
316-
// Create recolor version of string value
317-
std::string makeRecolor(std::string value, uint32_t colorFlags)
318-
{
319-
char s[32];
320-
snprintf(s, 32, "#%06" PRIx32 " %s#", makeLvColor32(colorFlags), value.c_str());
321-
return std::string(s);
322-
}
323-
324-
/**
325-
* Helper function to translate a colorFlags value to a lv_color_t suitable
326-
* for passing to an lv_obj function
327-
* @param colorFlags a textFlags value. This value will contain the color shifted by 16 bits.
328-
*/
329-
lv_color_t makeLvColor(uint32_t colorFlags)
330-
{
331-
auto color = COLOR_VAL(colorFlags);
332-
return lv_color_make(GET_RED(color), GET_GREEN(color), GET_BLUE(color));
333-
}
334-
335309
static void init_lvgl_drivers()
336310
{
337311
// Register the driver and save the created display object
@@ -371,6 +345,9 @@ LvglWrapper::LvglWrapper()
371345
{
372346
init_lvgl_drivers();
373347

348+
extern void lv_stb_init();
349+
lv_stb_init();
350+
374351
// Create main window and load that screen
375352
auto window = MainWindow::instance();
376353
window->setActiveScreen();

radio/src/gui/colorlcd/LvglWrapper.h

+1-8
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@
1919
* GNU General Public License for more details.
2020
*/
2121

22-
#ifndef _LVGLWRAPPER_H_
23-
#define _LVGLWRAPPER_H_
22+
#pragma once
2423

2524
#include <lvgl/lvgl.h>
2625
#include "opentx_types.h"
2726

2827
void initLvglTheme();
2928

30-
uint32_t makeLvColor32(uint32_t colorFlags);
31-
std::string makeRecolor(std::string value, uint32_t colorFlags);
32-
lv_color_t makeLvColor(uint32_t colorFlags);
33-
3429
typedef std::function<lv_obj_t *(lv_obj_t *parent)> LvObjConstructor;
3530

3631
class LvglWrapper
@@ -57,5 +52,3 @@ class LvglWrapper
5752

5853
// multiplication factor between 0 and 25
5954
int8_t rotaryEncoderGetAccel();
60-
61-
#endif // _LVGLWRAPPER_H_

0 commit comments

Comments
 (0)