Skip to content

Commit

Permalink
Color UI refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz committed Jan 7, 2024
1 parent 526a87e commit 254c4f4
Show file tree
Hide file tree
Showing 381 changed files with 17,708 additions and 18,326 deletions.
4 changes: 0 additions & 4 deletions radio/src/bitmaps/480x272/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,22 @@ set(BITMAP_LZ4_ARGS ${BITMAP_ARGS} --lz4)
set(MASK_LZ4_ARGS ${MASK_ARGS} --lz4)

add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash_logo "${RADIO_SRC_DIR}/bitmaps/480x272/splash_logo.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_masks "${RADIO_SRC_DIR}/bitmaps/480x272/mask_*.png" 8bits "${MASK_LZ4_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_slider_masks "${RADIO_SRC_DIR}/bitmaps/480x272/slider/*.png" 8bits "${MASK_LZ4_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_volume_masks ${RADIO_SRC_DIR}/bitmaps/480x272/volume/*.png 8bits "${MASK_LZ4_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_themes_masks "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/mask_*.png" 8bits "${MASK_LZ4_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_themes_alpha "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/alpha_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")

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

add_custom_target(${BITMAP_TARGET_PREFIX}_bitmaps)

add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps
${BITMAP_TARGET_PREFIX}_splash_logo
${BITMAP_TARGET_PREFIX}_button_bitmaps
${BITMAP_TARGET_PREFIX}_masks
${BITMAP_TARGET_PREFIX}_slider_masks
${BITMAP_TARGET_PREFIX}_themes_masks
${BITMAP_TARGET_PREFIX}_themes_alpha
${BITMAP_TARGET_PREFIX}_volume_masks
${BITMAP_TARGET_PREFIX}_bootloader_bitmaps
${BITMAP_TARGET_PREFIX}_bootloader_icons
)
Binary file removed radio/src/bitmaps/480x272/bootloader/icon_error.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/bootloader/icon_exit.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/bootloader/icon_file.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/bootloader/icon_flash.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/bootloader/icon_ok.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/bootloader/icon_sd.png
Binary file not shown.
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/mask_coord_shadow.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/mask_cvpoint.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/mask_cvpoint_center.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/mask_point.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed radio/src/bitmaps/480x272/mask_rscale.png
Binary file not shown.
Binary file removed radio/src/bitmaps/480x272/mask_shutdown_circle.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed radio/src/bitmaps/480x272/mask_trim_shadow.png
Binary file not shown.
Binary file modified radio/src/bitmaps/480x272/mask_txbat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/bitmaps/480x272/mask_txbat_charging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/bitmaps/480x272/volume/mask_volume_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/bitmaps/480x272/volume/mask_volume_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/bitmaps/480x272/volume/mask_volume_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified radio/src/bitmaps/480x272/volume/mask_volume_3.png
Binary file modified radio/src/bitmaps/480x272/volume/mask_volume_4.png
Binary file modified radio/src/bitmaps/480x272/volume/mask_volume_scale.png
1 change: 0 additions & 1 deletion radio/src/boards/generic_stm32/switches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "stm32_gpio_driver.h"

#include "definitions.h"
#include "opentx_constants.h"
#include "myeeprom.h"

// generated switch structs
Expand Down
5 changes: 1 addition & 4 deletions radio/src/dataconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _DATACONSTANTS_H_
#define _DATACONSTANTS_H_
#pragma once

#include "board.h"
#include "storage/yaml/yaml_defs.h"
Expand Down Expand Up @@ -704,5 +703,3 @@ enum PPMUnit {
PPM_PERCENT_PREC1,
PPM_US
};

#endif // _DATACONSTANTS_H_
167 changes: 77 additions & 90 deletions radio/src/gui/colorlcd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,87 +17,103 @@ file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd

set(GUI_SRC
${GUI_SRC}
colors.cpp
lcd.cpp
splash.cpp
fonts.cpp
curves.cpp
${THEMES_SRC}
${LAYOUTS_SRC}
${WIDGETS_SRC}
bitmaps.cpp
lz4_bitmaps.cpp
theme.cpp
theme_manager.cpp
channel_bar.cpp
channel_range.cpp
color_editor.cpp
color_picker.cpp
color_list.cpp
preview_window.cpp
color_picker.cpp
colors.cpp
curve.cpp
file_browser.cpp
file_preview.cpp
file_carosell.cpp
fonts.cpp
fullscreen_dialog.cpp
special_functions.cpp
layout.cpp
lcd.cpp
list_line_button.cpp
listbox.cpp
tabsgroup.cpp
LvglWrapper.cpp
menu_model.cpp
menu_radio.cpp
menu_screen.cpp
page.cpp
select_fab_button.cpp
popups.cpp
screen_setup.cpp
screen_user_interface.cpp
select_fab_carousel.cpp
sourcechoice.cpp
startup_shutdown.cpp
switch_warn_dialog.cpp
switchchoice.cpp
tabsgroup.cpp
theme_manager.cpp
theme.cpp
topbar.cpp
layout.cpp
widget.cpp
view_about.cpp
view_channels.cpp
view_logical_switches.cpp
view_main_decoration.cpp
view_main_menu.cpp
view_main.cpp
view_statistics.cpp
view_text.cpp
widget_settings.cpp
${THEMES_SRC}
${LAYOUTS_SRC}
${WIDGETS_SRC}
draw_functions.cpp
menu_model.cpp
model_select.cpp
bind_menu_d16.cpp
trainer_setup.cpp
custom_failsafe.cpp
ppm_settings.cpp
channel_range.cpp
module_setup.cpp
timer_setup.cpp
trims_setup.cpp
throttle_params.cpp
preflight_checks.cpp
model_setup.cpp
widget.cpp
widgets_setup.cpp
curve_param.cpp
curveedit.cpp
fm_matrix.cpp
gvar_numberedit.cpp
input_edit_adv.cpp
input_edit.cpp
input_mix_button.cpp
input_mix_group.cpp
input_source.cpp
mixer_edit_adv.cpp
mixer_edit.cpp
model_curves.cpp
model_flightmodes.cpp
model_gvars.cpp
model_inputs.cpp
model_logical_switches.cpp
model_mixes.cpp
model_outputs.cpp
model_curves.cpp
model_gvars.cpp
model_templates.cpp
model_logical_switches.cpp
special_functions.cpp
model_select.cpp
model_setup.cpp
model_telemetry.cpp
menu_radio.cpp
radio_setup.cpp
radio_sdmanager.cpp
radio_tools.cpp
radio_trainer.cpp
radio_version.cpp
hw_intmodule.cpp
model_templates.cpp
output_edit.cpp
preflight_checks.cpp
throttle_params.cpp
timeedit.cpp
timer_setup.cpp
trainer_setup.cpp
trims_setup.cpp
bind_menu_d16.cpp
custom_failsafe.cpp
hw_extmodule.cpp
hw_intmodule.cpp
module_setup.cpp
ppm_settings.cpp
file_carosell.cpp
hw_inputs.cpp
hw_serial.cpp
radio_hardware.cpp
radio_diagkeys.cpp
preview_window.cpp
radio_calibration.cpp
radio_diaganas.cpp
radio_diagkeys.cpp
radio_hardware.cpp
radio_sdmanager.cpp
radio_setup.cpp
radio_theme.cpp
radio_calibration.cpp
view_about.cpp
view_main.cpp
view_main_menu.cpp
view_main_decoration.cpp
view_channels.cpp
view_logical_switches.cpp
view_statistics.cpp
view_text.cpp
menu_screen.cpp
screen_user_interface.cpp
widgets_setup.cpp
screen_setup.cpp
switch_warn_dialog.cpp
LvglWrapper.cpp
radio_tools.cpp
radio_trainer.cpp
radio_version.cpp
)

macro(add_gui_src src)
Expand All @@ -124,10 +140,6 @@ if(HELI)
add_gui_src(model_heli.cpp)
endif()

if(PXX2 OR LUA OR MULTIMODULE)
add_gui_src(radio_tools.cpp)
endif()

if(PXX2 OR MULTIMODULE)
add_gui_src(radio_spectrum_analyser.cpp)
endif()
Expand Down Expand Up @@ -193,31 +205,6 @@ set(SRC ${SRC} ${LVGL_FONT_SOURCES})

add_definitions(-DLIBOPENUI)

add_gui_src(fullscreen_dialog.cpp)
add_gui_src(message_dialog.cpp)
add_gui_src(confirm_dialog.cpp)
add_gui_src(popups.cpp)
add_gui_src(timeedit.cpp)
add_gui_src(curve.cpp)
add_gui_src(sourcechoice.cpp)
add_gui_src(switchchoice.cpp)
add_gui_src(curveedit.cpp)
add_gui_src(gvar_numberedit.cpp)
add_gui_src(curve_param.cpp)
add_gui_src(fm_matrix.cpp)
add_gui_src(input_source.cpp)
add_gui_src(input_edit.cpp)
add_gui_src(input_edit_adv.cpp)
add_gui_src(mixer_edit.cpp)
add_gui_src(mixer_edit_adv.cpp)
add_gui_src(output_edit.cpp)
add_gui_src(input_mix_group.cpp)
add_gui_src(input_mix_button.cpp)
add_gui_src(channel_bar.cpp)

add_gui_src(list_line_button.cpp)

if(USBJ_EX)
add_gui_src(model_usbjoystick.cpp)
endif()

29 changes: 3 additions & 26 deletions radio/src/gui/colorlcd/LvglWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,32 +306,6 @@ int8_t rotaryEncoderGetAccel() { return 0; }

#endif // defined(ROTARY_ENCODER_NAVIGATION)

// Return 32 bit version of color (for recolor of buttons)
uint32_t makeLvColor32(uint32_t colorFlags)
{
auto color = COLOR_VAL(colorFlags);
return (GET_RED(color) << 16u) | (GET_GREEN(color) << 8) | GET_BLUE(color);
}

// Create recolor version of string value
std::string makeRecolor(std::string value, uint32_t colorFlags)
{
char s[32];
snprintf(s, 32, "#%06" PRIx32 " %s#", makeLvColor32(colorFlags), value.c_str());
return std::string(s);
}

/**
* Helper function to translate a colorFlags value to a lv_color_t suitable
* for passing to an lv_obj function
* @param colorFlags a textFlags value. This value will contain the color shifted by 16 bits.
*/
lv_color_t makeLvColor(uint32_t colorFlags)
{
auto color = COLOR_VAL(colorFlags);
return lv_color_make(GET_RED(color), GET_GREEN(color), GET_BLUE(color));
}

static void init_lvgl_drivers()
{
// Register the driver and save the created display object
Expand Down Expand Up @@ -371,6 +345,9 @@ LvglWrapper::LvglWrapper()
{
init_lvgl_drivers();

extern void lv_stb_init();
lv_stb_init();

// Create main window and load that screen
auto window = MainWindow::instance();
window->setActiveScreen();
Expand Down
9 changes: 1 addition & 8 deletions radio/src/gui/colorlcd/LvglWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@
* GNU General Public License for more details.
*/

#ifndef _LVGLWRAPPER_H_
#define _LVGLWRAPPER_H_
#pragma once

#include <lvgl/lvgl.h>
#include "opentx_types.h"

void initLvglTheme();

uint32_t makeLvColor32(uint32_t colorFlags);
std::string makeRecolor(std::string value, uint32_t colorFlags);
lv_color_t makeLvColor(uint32_t colorFlags);

typedef std::function<lv_obj_t *(lv_obj_t *parent)> LvObjConstructor;

class LvglWrapper
Expand All @@ -57,5 +52,3 @@ class LvglWrapper

// multiplication factor between 0 and 25
int8_t rotaryEncoderGetAccel();

#endif // _LVGLWRAPPER_H_
Loading

0 comments on commit 254c4f4

Please sign in to comment.