diff --git a/radio/src/bitmaps/480x272/CMakeLists.txt b/radio/src/bitmaps/480x272/CMakeLists.txt index 3c21c188c..958484341 100644 --- a/radio/src/bitmaps/480x272/CMakeLists.txt +++ b/radio/src/bitmaps/480x272/CMakeLists.txt @@ -8,39 +8,37 @@ elseif(PCB STREQUAL X12S) set(BITMAP_TARGET_PREFIX x12s) else() set(BITMAP_TARGET_PREFIX x10) - if(PCBREV STREQUAL T18) - # straight screen - else() -# set(BITMAP_ARGS ${BITMAP_ARGS} --reverse) -# set(MASK_ARGS ${MASK_ARGS} --reverse) - endif() endif() set(BITMAP_RLE_ARGS ${BITMAP_ARGS} --rle) set(MASK_RLE_ARGS ${MASK_ARGS} --rle) -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/bmp_*.png" "5/6/5" "${BITMAP_ARGS}") -add_png_target(${BITMAP_TARGET_PREFIX}_splash "${RADIO_SRC_DIR}/bitmaps/480x272/splash.png") -add_png_target(${BITMAP_TARGET_PREFIX}_splash_chr "${RADIO_SRC_DIR}/bitmaps/480x272/splash_chr.png") +set(BITMAP_LZ4_ARGS ${BITMAP_ARGS} --lz4) +set(MASK_LZ4_ARGS ${MASK_ARGS} --lz4) -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_calibration_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/calibration/bmp_*.png" "5/6/5" "${BITMAP_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_alpha_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_alpha_calibration_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/calibration/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_masks "${RADIO_SRC_DIR}/bitmaps/480x272/mask_*.png" 8bits "${MASK_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_slider_masks "${RADIO_SRC_DIR}/bitmaps/480x272/slider/*.png" 8bits "${MASK_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_layouts_masks "${RADIO_SRC_DIR}/gui/colorlcd/layouts/*.png" 8bits "${MASK_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_fonts ${RADIO_SRC_DIR}/fonts/truetype/*.png 8bits "${MASK_RLE_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_volume_masks ${RADIO_SRC_DIR}/bitmaps/480x272/volume/*.png 8bits "${MASK_ARGS}") +add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash "${RADIO_SRC_DIR}/bitmaps/480x272/splash.png" "5/6/5" "${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}_layouts_masks "${RADIO_SRC_DIR}/gui/colorlcd/layouts/*.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 "${BITMAP_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}_themes_masks "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/mask_*.png" 8bits "${BITMAPS_ARGS}") -add_png_target(${BITMAP_TARGET_PREFIX}_themes_alpha "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/alpha_*.png") +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_bitmaps_target(${BITMAP_TARGET_PREFIX}_bootloader_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/bootloader/bmp_*.png" "4/4/4/4" "${BITMAP_RLE_ARGS}") -add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bootloader_icons "${RADIO_SRC_DIR}/bitmaps/480x272/bootloader/icon_*.png" 8bits "${MASK_ARGS}") +add_custom_target(${BITMAP_TARGET_PREFIX}_bitmaps) -add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps ${BITMAP_TARGET_PREFIX}_calibration_bitmaps ${BITMAP_TARGET_PREFIX}_button_bitmaps ${BITMAP_TARGET_PREFIX}_alpha_bitmaps - ${BITMAP_TARGET_PREFIX}_alpha_calibration_bitmaps ${BITMAP_TARGET_PREFIX}_masks ${BITMAP_TARGET_PREFIX}_slider_masks ${BITMAP_TARGET_PREFIX}_layouts_masks - ${BITMAP_TARGET_PREFIX}_fonts ${BITMAP_TARGET_PREFIX}_themes_masks ${BITMAP_TARGET_PREFIX}_themes_alpha ${BITMAP_TARGET_PREFIX}_splash - ${BITMAP_TARGET_PREFIX}_splash_chr ${BITMAP_TARGET_PREFIX}_volume_masks - ${BITMAP_TARGET_PREFIX}_bootloader_bitmaps ${BITMAP_TARGET_PREFIX}_bootloader_icons ) +add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps + ${BITMAP_TARGET_PREFIX}_splash + ${BITMAP_TARGET_PREFIX}_button_bitmaps + ${BITMAP_TARGET_PREFIX}_masks + ${BITMAP_TARGET_PREFIX}_slider_masks + ${BITMAP_TARGET_PREFIX}_layouts_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 + ) diff --git a/radio/src/fonts/lvgl/lv_font_roboto_bl_16.c b/radio/src/fonts/lvgl/lv_font_roboto_bl_16.c index 98b60b07e..11476f578 100644 --- a/radio/src/fonts/lvgl/lv_font_roboto_bl_16.c +++ b/radio/src/fonts/lvgl/lv_font_roboto_bl_16.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 2 - * Opts: --no-prefilter --bpp 2 --size 16 --font ../Roboto/Roboto-Regular.ttf -r 0x20-0x7F --font ../../thirdparty/libopenui/thirdparty/lvgl/scripts/built_in_font/FontAwesome5-Solid+Brands+Regular.woff -r 61671,63650,63426,61453 --format lvgl -o lv_font_roboto_bl_16.c --force-fast-kern-format + * Opts: --no-prefilter --bpp 2 --size 16 --font ../Roboto/Roboto-Regular.ttf -r 0x20-0x7F --font ../../thirdparty/libopenui/thirdparty/lvgl/scripts/built_in_font/FontAwesome5-Solid+Brands+Regular.woff -r 61671,63650,63426,61453,61787,61452 --format lvgl -o lv_font_roboto_bl_16.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -495,6 +495,13 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf, 0xf5, 0xe0, 0x9e, 0xdb, 0x4e, 0xd0, 0x5f, 0x7, 0xf8, + /* U+F00C "" */ + 0xf, 0xfe, 0xd, 0x3, 0xff, 0x83, 0x7c, 0x1f, + 0xf5, 0xf4, 0x1f, 0xeb, 0xf0, 0x28, 0x1e, 0xbf, + 0x3, 0xe8, 0x35, 0xf8, 0x2b, 0xe8, 0x17, 0xe0, + 0xef, 0xd4, 0xfc, 0x1f, 0x7f, 0xd0, 0x7f, 0x7f, + 0x41, 0xff, 0x5e, 0x83, 0xff, 0x83, 0x40, 0xfe, + /* U+F00D "" */ 0xf, 0xfa, 0xf0, 0x77, 0xaf, 0xc1, 0x7e, 0x7f, 0x1f, 0x91, 0xff, 0x90, 0x9f, 0xe4, 0x3b, 0xf8, @@ -508,6 +515,11 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xdf, 0x21, 0xfb, 0xe0, 0xfc, 0xf8, 0x3f, 0xae, 0xf, 0xef, 0x7, 0xfb, 0x43, 0xc0, + /* U+F15B "" */ + 0xff, 0x8c, 0x2f, 0xf8, 0xf0, 0x3f, 0xe3, 0xe3, + 0xfe, 0x3f, 0xfe, 0xe, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0x40, + /* U+F7C2 "" */ 0xa, 0xff, 0x90, 0x5f, 0xfc, 0x5c, 0x64, 0x9e, 0xbd, 0x19, 0x27, 0xf4, 0x64, 0x9f, 0xff, 0xff, @@ -623,10 +635,12 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 1915, .adv_w = 62, .box_w = 2, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, {.bitmap_index = 1918, .adv_w = 87, .box_w = 5, .box_h = 17, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 1939, .adv_w = 174, .box_w = 9, .box_h = 5, .ofs_x = 1, .ofs_y = 3}, - {.bitmap_index = 1949, .adv_w = 176, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1978, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 2016, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 2037, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 1949, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1989, .adv_w = 176, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2018, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 2056, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 2074, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 2095, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -634,7 +648,7 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { *--------------------*/ static const uint16_t unicode_list_1[] = { - 0x0, 0xda, 0x7b5, 0x895 + 0x0, 0x1, 0xdb, 0x14f, 0x7b6, 0x896 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -645,8 +659,8 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY }, { - .range_start = 61453, .range_length = 2198, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 4, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .range_start = 61452, .range_length = 2199, .glyph_id_start = 96, + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 6, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -670,7 +684,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 31, 0, 0, 32, 0, 31, 31, 33, 27, 0, 34, 0, 35, 0, 36, 37, 38, 36, 39, 40, 0, 0, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -688,7 +702,7 @@ static const uint8_t kern_right_class_mapping[] = 23, 0, 0, 0, 0, 0, 25, 25, 26, 25, 23, 27, 28, 29, 30, 31, 32, 33, 31, 34, 0, 0, 35, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/radio/src/fonts/lvgl/make_fonts.sh b/radio/src/fonts/lvgl/make_fonts.sh index d2bcd1919..94a16cbfb 100755 --- a/radio/src/fonts/lvgl/make_fonts.sh +++ b/radio/src/fonts/lvgl/make_fonts.sh @@ -43,7 +43,8 @@ function make_font_no_sym() { } # LV_SYMBOL_CHARGE, LV_SYMBOL_NEW_LINE, LV_SYMBOL_SD_CARD, LV_SYMBOL_CLOSE -BL_SYMBOLS="61671,63650,63426,61453" +# LV_SYMBOL_FILE, LV_SYMBOL_OK +BL_SYMBOLS="61671,63650,63426,61453,61787,61452" function make_bootloader_font() { local name=$1 diff --git a/radio/src/gui/colorlcd/CMakeLists.txt b/radio/src/gui/colorlcd/CMakeLists.txt index 259305550..fd2c97cae 100644 --- a/radio/src/gui/colorlcd/CMakeLists.txt +++ b/radio/src/gui/colorlcd/CMakeLists.txt @@ -24,6 +24,7 @@ set(GUI_SRC fonts.cpp curves.cpp bitmaps.cpp + lz4_bitmaps.cpp theme.cpp theme_manager.cpp color_editor_popup.cpp diff --git a/radio/src/gui/colorlcd/bitmaps.cpp b/radio/src/gui/colorlcd/bitmaps.cpp index 6e0cc55c5..6178e9036 100644 --- a/radio/src/gui/colorlcd/bitmaps.cpp +++ b/radio/src/gui/colorlcd/bitmaps.cpp @@ -21,188 +21,236 @@ #include "opentx.h" -/* - * Header bitmaps - */ - -const uint8_t LBM_DOT[] = { -#include "mask_dot.lbm" -}; - -/* - * Main view bitmaps - */ - -const uint8_t LBM_TOPMENU_GPS[] = { -#include "mask_topmenu_gps_18.lbm" -}; - -const uint8_t LBM_TOPMENU_USB[] = { -#include "mask_topmenu_usb.lbm" -}; - -const uint8_t LBM_TOPMENU_VOLUME_0[] = { -#include "mask_volume_0.lbm" -}; - -const uint8_t LBM_TOPMENU_VOLUME_1[] = { -#include "mask_volume_1.lbm" -}; - -const uint8_t LBM_TOPMENU_VOLUME_2[] = { -#include "mask_volume_2.lbm" -}; - -const uint8_t LBM_TOPMENU_VOLUME_3[] = { -#include "mask_volume_3.lbm" -}; - -const uint8_t LBM_TOPMENU_VOLUME_4[] = { -#include "mask_volume_4.lbm" -}; - -const uint8_t LBM_TOPMENU_VOLUME_SCALE[] = { -#include "mask_volume_scale.lbm" -}; - -const uint8_t LBM_TOPMENU_TXBATT[] = { -#include "mask_txbat.lbm" -}; - -const uint8_t LBM_TOPMENU_TXBATT_CHARGING[] = { -#include "mask_txbat_charging.lbm" -}; - -const uint8_t LBM_TOPMENU_ANTENNA[] = { -#include "mask_antenna.lbm" -}; - -const uint8_t LBM_HTRIM_FRAME[] = { -#include "mask_htrim_frame.lbm" -}; - -const uint8_t LBM_VTRIM_FRAME[] = { -#include "mask_vtrim_frame.lbm" -}; - -const uint8_t LBM_TRIM_SHADOW[] = { -#include "mask_trim_shadow.lbm" -}; - -const uint8_t LBM_TIMER_BACKGROUND[] = { -#include "mask_timer_bg.lbm" -}; - -const uint8_t LBM_TIMER[] = { -#include "mask_timer.lbm" -}; - -const uint8_t LBM_RSCALE[] = { -#include "mask_rscale.lbm" -}; - -/* - * Model selection screen bitmaps - */ - -const uint8_t LBM_LIBRARY_SLOT[] = { -#include "mask_library_slot.lbm" -}; - -const uint8_t LBM_ACTIVE_MODEL[] = { -#include "mask_library_active_model.lbm" -}; - -const uint8_t LBM_SCORE0[] = { -#include "mask_library_score_0.lbm" -}; - -const uint8_t LBM_SCORE1[] = { -#include "mask_library_score_1.lbm" -}; - -const uint8_t LBM_STAR0[] = { -#include "mask_library_star_0.lbm" -}; - -const uint8_t LBM_STAR1[] = { -#include "mask_library_star_1.lbm" -}; - -/* - * Other - */ - -const uint8_t LBM_POINT[] = { +const uint8_t _LBM_POINT[] = { #include "mask_point.lbm" }; +IMPL_LZ4_BITMAP(LBM_POINT); -const uint8_t LBM_CURVE_POINT[] = { -#include "mask_cvpoint.lbm" +static const uint8_t mask_next[] = { +#include "mask_next.lbm" }; - -const uint8_t LBM_CURVE_POINT_CENTER[] = { -#include "mask_cvpoint_center.lbm" +static const uint8_t mask_back[] = { +#include "mask_back.lbm" }; - -const uint8_t LBM_CURVE_COORD_SHADOW[] = { -#include "mask_coord_shadow.lbm" +static const uint8_t mask_menu_model[] = { +#include "mask_menu_model.lbm" }; - -const uint8_t LBM_SHUTDOWN_CIRCLE[] = { -#include "mask_shutdown_circle.lbm" +static const uint8_t mask_menu_notes[] = { +#include "mask_menu_notes.lbm" }; - -const uint8_t LBM_SLIDER_BAR_LEFT[] __ALIGNED(4) = { -#include "bar_left.lbm" +static const uint8_t mask_menu_radio[] = { +#include "mask_menu_radio.lbm" }; - -const uint8_t LBM_SLIDER_BAR_RIGHT[] __ALIGNED(4) = { -#include "bar_right.lbm" +static const uint8_t mask_menu_stats[] = { +#include "mask_menu_stats.lbm" }; - -const uint8_t LBM_SLIDER_POINT_OUT[] __ALIGNED(4) = { -#include "point_out.lbm" +static const uint8_t mask_menu_theme[] = { +#include "mask_menu_theme.lbm" }; - -const uint8_t LBM_SLIDER_POINT_MID[] __ALIGNED(4) = { -#include "point_mid.lbm" +static const uint8_t mask_model_curves[] = { +#include "mask_model_curves.lbm" }; - -const uint8_t LBM_SLIDER_POINT_IN[] __ALIGNED(4) = { -#include "point_in.lbm" +static const uint8_t mask_model_flight_modes[] = { +#include "mask_model_flight_modes.lbm" }; - -const uint8_t LBM_CARROUSSEL_LEFT[] = { -#include "mask_carroussel_left.lbm" +static const uint8_t mask_model_gvars[] = { +#include "mask_model_gvars.lbm" }; - -const uint8_t LBM_CARROUSSEL_RIGHT[] = { -#include "mask_carroussel_right.lbm" +static const uint8_t mask_model_heli[] = { +#include "mask_model_heli.lbm" }; - -const uint8_t LBM_SWIPE_CIRCLE[] = { - #include "mask_swipe_circle.lbm" +static const uint8_t mask_model_inputs[] = { +#include "mask_model_inputs.lbm" }; - -const uint8_t LBM_SWIPE_LEFT[] = { - #include "mask_swipe_left.lbm" +static const uint8_t mask_model_logical_switches[] = { +#include "mask_model_logical_switches.lbm" }; - -const uint8_t LBM_SWIPE_RIGHT[] = { - #include "mask_swipe_right.lbm" +static const uint8_t mask_model_lua_scripts[] = { +#include "mask_model_lua_scripts.lbm" +}; +static const uint8_t mask_model_mixer[] = { +#include "mask_model_mixer.lbm" +}; +static const uint8_t mask_model_outputs[] = { +#include "mask_model_outputs.lbm" +}; +static const uint8_t mask_model_setup[] = { +#include "mask_model_setup.lbm" +}; +static const uint8_t mask_model_special_functions[] = { +#include "mask_model_special_functions.lbm" +}; +static const uint8_t mask_model_telemetry[] = { +#include "mask_model_telemetry.lbm" +}; +static const uint8_t mask_menu_model_select[] = { +#include "mask_menu_model_select.lbm" //TODO: someone may want to make proper icon +}; +static const uint8_t mask_model_select_category[] = { +#include "mask_model_select_category.lbm" //TODO: someone should make proper icon +}; +static const uint8_t mask_monitor[] = { +#include "mask_monitor.lbm" +}; +static const uint8_t mask_monitor_channels1[] = { +#include "mask_monitor_channels1.lbm" +}; +static const uint8_t mask_monitor_channels2[] = { +#include "mask_monitor_channels2.lbm" +}; +static const uint8_t mask_monitor_channels3[] = { +#include "mask_monitor_channels3.lbm" +}; +static const uint8_t mask_monitor_channels4[] = { +#include "mask_monitor_channels4.lbm" +}; +// static const uint8_t mask_monitor_gvars[] = { +// #include "mask_monitor_gvars.lbm" +// }; +static const uint8_t mask_monitor_inver[] = { +#include "mask_monitor_inver.lbm" +}; +static const uint8_t mask_monitor_lockch[] = { +#include "mask_monitor_lockch.lbm" +}; +static const uint8_t mask_monitor_logsw[] = { +#include "mask_monitor_logsw.lbm" +}; +static const uint8_t mask_mplex_add[] = { +#include "mask_mplex_add.lbm" +}; +static const uint8_t mask_mplex_multi[] = { +#include "mask_mplex_multi.lbm" +}; +static const uint8_t mask_mplex_replace[] = { +#include "mask_mplex_replace.lbm" +}; +static const uint8_t mask_edgetx[] = { +#include "mask_edgetx.lbm" +}; +static const uint8_t mask_radio_calibration[] = { +#include "mask_radio_calibration.lbm" +}; +static const uint8_t mask_radio_global_functions[] = { +#include "mask_radio_global_functions.lbm" +}; +static const uint8_t mask_radio_hardware[] = { +#include "mask_radio_hardware.lbm" +}; +static const uint8_t mask_radio_sd_browser[] = { +#include "mask_radio_sd_browser.lbm" +}; +static const uint8_t mask_radio_setup[] = { +#include "mask_radio_setup.lbm" +}; +static const uint8_t mask_radio_tools[] = { +#include "mask_radio_tools.lbm" +}; +static const uint8_t mask_radio_edit_theme[] = { +#include "mask_radio_edit_theme.lbm" +}; +static const uint8_t mask_radio_trainer[] = { +#include "mask_radio_trainer.lbm" +}; +static const uint8_t mask_radio_version[] = { +#include "mask_radio_version.lbm" +}; +static const uint8_t mask_sbar_mixer[] = { +#include "mask_sbar_mixer.lbm" +}; +static const uint8_t mask_sbar_output[] = { +#include "mask_sbar_output.lbm" +}; +static const uint8_t mask_sbar_to[] = { +#include "mask_sbar_to.lbm" +}; +static const uint8_t mask_stats_analogs[] = { +#include "mask_stats_analogs.lbm" +}; +static const uint8_t mask_stats_debug[] = { +#include "mask_stats_debug.lbm" +}; +static const uint8_t mask_stats_throttle_graph[] = { +#include "mask_stats_throttle_graph.lbm" +}; +static const uint8_t mask_stats_timers[] = { +#include "mask_stats_timers.lbm" +}; +static const uint8_t mask_textline_curve[] = { +#include "mask_textline_curve.lbm" +}; +static const uint8_t mask_textline_delay[] = { +#include "mask_textline_delay.lbm" +}; +static const uint8_t mask_textline_delayslow[] = { +#include "mask_textline_delayslow.lbm" +}; +static const uint8_t mask_textline_fm[] = { +#include "mask_textline_fm.lbm" +}; +static const uint8_t mask_textline_label[] = { +#include "mask_textline_label.lbm" +}; +static const uint8_t mask_textline_slow[] = { +#include "mask_textline_slow.lbm" +}; +static const uint8_t mask_textline_switch[] = { +#include "mask_textline_switch.lbm" +}; +static const uint8_t mask_theme_add_view[] = { +#include "mask_theme_add_view.lbm" +}; +static const uint8_t mask_theme_setup[] = { +#include "mask_theme_setup.lbm" +}; +static const uint8_t mask_theme_view1[] = { +#include "mask_theme_view1.lbm" +}; +static const uint8_t mask_theme_view2[] = { +#include "mask_theme_view2.lbm" +}; +static const uint8_t mask_theme_view3[] = { +#include "mask_theme_view3.lbm" +}; +static const uint8_t mask_theme_view4[] = { +#include "mask_theme_view4.lbm" +}; +static const uint8_t mask_theme_view5[] = { +#include "mask_theme_view5.lbm" +}; +static const uint8_t stick_pointer[] = { +#include "alpha_stick_pointer.lbm" +}; +static const uint8_t stick_background[] = { +#include "alpha_stick_background.lbm" +}; +static const uint8_t trackp_background[] = { +#include "alpha_trackp_background.lbm" +}; +static const uint8_t mask_sdfree[] = { +#include "mask_sdfree.lbm" +}; +static const uint8_t mask_modelqty[] = { +#include "mask_modelqty.lbm" +}; +static const uint8_t mask_modelname[] = { +#include "mask_modelname.lbm" +}; +static const uint8_t mask_moveback[] = { +#include "mask_moveback.lbm" +}; +static const uint8_t mask_moveico[] = { +#include "mask_moveico.lbm" }; BitmapBuffer * calibStick = nullptr; BitmapBuffer * calibStickBackground = nullptr; BitmapBuffer * calibTrackpBackground = nullptr; -//BitmapBuffer * modelselIconBitmap = nullptr; BitmapBuffer * modelselSdFreeBitmap = nullptr; BitmapBuffer * modelselModelQtyBitmap = nullptr; BitmapBuffer * modelselModelNameBitmap = nullptr; BitmapBuffer * modelselModelMoveBackground = nullptr; BitmapBuffer * modelselModelMoveIcon = nullptr; -BitmapBuffer * modelselWizardBackground = nullptr; BitmapBuffer * chanMonLockedBitmap = nullptr; BitmapBuffer * chanMonInvertedBitmap = nullptr; BitmapBuffer * mixerSetupMixerBitmap = nullptr; @@ -218,3 +266,123 @@ BitmapBuffer * mixerSetupDelayIcon = nullptr; BitmapBuffer * mixerSetupSlowIcon = nullptr; BitmapBuffer * mixerSetupDelaySlowIcon = nullptr; BitmapBuffer * mixerSetupFlightmodeIcon = nullptr; + +struct _BuiltinBitmap { + + BitmapFormats type; + const uint8_t* lz4_compressed_bitmap; + BitmapBuffer** uncompressed_bitmap; +}; + +static const _BuiltinBitmap _builtinBitmaps[] = { + {BMP_ARGB4444, stick_pointer, &calibStick}, + {BMP_ARGB4444, stick_background, &calibStickBackground}, + {BMP_ARGB4444, trackp_background, &calibTrackpBackground}, + + {BMP_8BIT, mask_sdfree, &modelselSdFreeBitmap}, + + {BMP_8BIT, mask_modelqty, &modelselModelQtyBitmap}, + {BMP_8BIT, mask_modelname, &modelselModelNameBitmap}, + + {BMP_8BIT, mask_moveback, &modelselModelMoveBackground}, + {BMP_8BIT, mask_moveico, &modelselModelMoveIcon}, + {BMP_8BIT, mask_moveico, &modelselModelMoveIcon}, + + {BMP_8BIT, mask_monitor_lockch, &chanMonLockedBitmap}, + {BMP_8BIT, mask_monitor_inver, &chanMonInvertedBitmap}, + + {BMP_8BIT, mask_sbar_mixer, &mixerSetupMixerBitmap}, + {BMP_8BIT, mask_sbar_to, &mixerSetupToBitmap}, + {BMP_8BIT, mask_sbar_output, &mixerSetupOutputBitmap}, + + {BMP_8BIT, mask_mplex_add, &mixerSetupAddBitmap}, + {BMP_8BIT, mask_mplex_multi, &mixerSetupMultiBitmap}, + {BMP_8BIT, mask_mplex_replace, &mixerSetupReplaceBitmap}, + + {BMP_8BIT, mask_textline_label, &mixerSetupLabelIcon}, + {BMP_8BIT, mask_textline_curve, &mixerSetupCurveIcon}, + {BMP_8BIT, mask_textline_switch, &mixerSetupSwitchIcon}, + {BMP_8BIT, mask_textline_fm, &mixerSetupFlightmodeIcon}, + {BMP_8BIT, mask_textline_slow, &mixerSetupSlowIcon}, + {BMP_8BIT, mask_textline_delay, &mixerSetupDelayIcon}, + {BMP_8BIT, mask_textline_delayslow, &mixerSetupDelaySlowIcon}, +}; + +void loadBuiltinBitmaps() +{ + for (const auto& bm : _builtinBitmaps) { + + delete *bm.uncompressed_bitmap; + *bm.uncompressed_bitmap = nullptr; + + if (bm.type == BMP_ARGB4444 || + bm.type == BMP_RGB565) { + *bm.uncompressed_bitmap = new LZ4Bitmap(bm.type, bm.lz4_compressed_bitmap); + } else if (bm.type == BMP_8BIT) { + *bm.uncompressed_bitmap = BitmapBuffer::load8bitMaskLZ4(bm.lz4_compressed_bitmap); + } + } +} + +struct _BuiltinIcon { + MenuIcons id; + const uint8_t* lz4_compressed_bitmap; +}; + +static const _BuiltinIcon _builtinIcons[] = { + {ICON_OPENTX, mask_edgetx}, +#if defined(HARDWARE_TOUCH) + {ICON_NEXT, mask_next}, + {ICON_BACK, mask_back}, +#endif + {ICON_RADIO, mask_menu_radio}, + {ICON_RADIO_SETUP, mask_radio_setup}, + {ICON_RADIO_SD_MANAGER, mask_radio_sd_browser}, + {ICON_RADIO_TOOLS, mask_radio_tools}, + {ICON_RADIO_GLOBAL_FUNCTIONS, mask_radio_global_functions}, + {ICON_RADIO_TRAINER, mask_radio_trainer}, + {ICON_RADIO_HARDWARE, mask_radio_hardware}, + {ICON_RADIO_CALIBRATION, mask_radio_calibration}, + {ICON_RADIO_EDIT_THEME, mask_radio_edit_theme}, + {ICON_RADIO_VERSION, mask_radio_version}, + {ICON_MODEL, mask_menu_model}, + {ICON_MODEL_SETUP, mask_model_setup}, + {ICON_MODEL_HELI, mask_model_heli}, + {ICON_MODEL_FLIGHT_MODES, mask_model_flight_modes}, + {ICON_MODEL_INPUTS, mask_model_inputs}, + {ICON_MODEL_MIXER, mask_model_mixer}, + {ICON_MODEL_NOTES, mask_menu_notes}, + {ICON_MODEL_OUTPUTS, mask_model_outputs}, + {ICON_MODEL_CURVES, mask_model_curves}, + {ICON_MODEL_GVARS, mask_model_gvars}, + {ICON_MODEL_LOGICAL_SWITCHES, mask_model_logical_switches}, + {ICON_MODEL_SPECIAL_FUNCTIONS, mask_model_special_functions}, + {ICON_MODEL_LUA_SCRIPTS, mask_model_lua_scripts}, + {ICON_MODEL_TELEMETRY, mask_model_telemetry}, + {ICON_MODEL_SELECT, mask_menu_model_select}, + {ICON_MODEL_SELECT_CATEGORY, mask_model_select_category}, + {ICON_THEME, mask_menu_theme}, + {ICON_THEME_SETUP, mask_theme_setup}, + {ICON_THEME_VIEW1, mask_theme_view1}, + {ICON_THEME_VIEW2, mask_theme_view2}, + {ICON_THEME_VIEW3, mask_theme_view3}, + {ICON_THEME_VIEW4, mask_theme_view4}, + {ICON_THEME_VIEW5, mask_theme_view5}, + {ICON_THEME_ADD_VIEW, mask_theme_add_view}, + {ICON_STATS, mask_menu_stats}, + {ICON_STATS_THROTTLE_GRAPH, mask_stats_throttle_graph}, + {ICON_STATS_TIMERS, mask_stats_timers}, + {ICON_STATS_ANALOGS, mask_stats_analogs}, + {ICON_STATS_DEBUG, mask_stats_debug}, + {ICON_MONITOR, mask_monitor}, + {ICON_MONITOR_CHANNELS1, mask_monitor_channels1}, + {ICON_MONITOR_CHANNELS2, mask_monitor_channels2}, + {ICON_MONITOR_CHANNELS3, mask_monitor_channels3}, + {ICON_MONITOR_CHANNELS4, mask_monitor_channels4}, + {ICON_MONITOR_LOGICAL_SWITCHES, mask_monitor_logsw}, +}; + +const uint8_t* getBuiltinIcon(MenuIcons id) +{ + return _builtinIcons[id].lz4_compressed_bitmap; +} diff --git a/radio/src/gui/colorlcd/bitmaps.h b/radio/src/gui/colorlcd/bitmaps.h index 872f00b76..947a4aa0f 100644 --- a/radio/src/gui/colorlcd/bitmaps.h +++ b/radio/src/gui/colorlcd/bitmaps.h @@ -19,63 +19,13 @@ * GNU General Public License for more details. */ -#ifndef _BITMAPS_H_ -#define _BITMAPS_H_ +#pragma once -// Header bitmaps -extern const uint8_t LBM_DOT[]; +#include "lz4_bitmaps.h" -// Main view icons -extern const uint8_t LBM_TOPMENU_GPS[]; -extern const uint8_t LBM_TOPMENU_USB[]; -extern const uint8_t LBM_TOPMENU_ANTENNA[]; -extern const uint8_t LBM_TOPMENU_VOLUME_0[]; -extern const uint8_t LBM_TOPMENU_VOLUME_1[]; -extern const uint8_t LBM_TOPMENU_VOLUME_2[]; -extern const uint8_t LBM_TOPMENU_VOLUME_3[]; -extern const uint8_t LBM_TOPMENU_VOLUME_4[]; -extern const uint8_t LBM_TOPMENU_VOLUME_SCALE[]; -extern const uint8_t LBM_TOPMENU_TXBATT[]; -extern const uint8_t LBM_TOPMENU_TXBATT_CHARGING[]; -extern const uint8_t LBM_HTRIM_FRAME[]; -extern const uint8_t LBM_VTRIM_FRAME[]; -extern const uint8_t LBM_TRIM_SHADOW[]; -extern const uint8_t LBM_TIMER_BACKGROUND[]; -extern const uint8_t LBM_TIMER[]; -extern const uint8_t LBM_RSCALE[]; +DEFINE_LZ4_BITMAP(LBM_POINT); -// Model selection icons -extern const uint8_t LBM_LIBRARY_SLOT[]; -extern const uint8_t LBM_ACTIVE_MODEL[]; -extern const uint8_t LBM_SCORE0[]; -extern const uint8_t LBM_SCORE1[]; -extern const uint8_t LBM_STAR0[]; -extern const uint8_t LBM_STAR1[]; - -// Other icons -extern const uint8_t LBM_SPLASH[]; -extern const uint8_t LBM_POINT[]; -extern const uint8_t LBM_CURVE_POINT[]; -extern const uint8_t LBM_CURVE_POINT_CENTER[]; -extern const uint8_t LBM_CURVE_COORD_SHADOW[]; -extern const uint8_t LBM_SHUTDOWN_CIRCLE[]; - -// Slider bitmaps -extern const uint8_t LBM_SLIDER_BAR_LEFT[]; -extern const uint8_t LBM_SLIDER_BAR_RIGHT[]; -extern const uint8_t LBM_SLIDER_POINT_OUT[]; -extern const uint8_t LBM_SLIDER_POINT_MID[]; -extern const uint8_t LBM_SLIDER_POINT_IN[]; - -// Carroussel bitmaps -extern const uint8_t LBM_CARROUSSEL_LEFT[]; -extern const uint8_t LBM_CARROUSSEL_RIGHT[]; - -extern const uint8_t LBM_SWIPE_CIRCLE[]; -extern const uint8_t LBM_SWIPE_LEFT[]; -extern const uint8_t LBM_SWIPE_RIGHT[]; - -//extern BitmapBuffer * modelselIconBitmap; +// Model selection bitmaps extern BitmapBuffer * modelselSdFreeBitmap; extern BitmapBuffer * modelselModelQtyBitmap; extern BitmapBuffer * modelselModelNameBitmap; @@ -107,4 +57,5 @@ extern BitmapBuffer * mixerSetupDelayIcon; extern BitmapBuffer * mixerSetupSlowIcon; extern BitmapBuffer * mixerSetupDelaySlowIcon; -#endif // _BITMAPS_H_ +void loadBuiltinBitmaps(); +const uint8_t* getBuiltinIcon(MenuIcons id); diff --git a/radio/src/gui/colorlcd/curve.cpp b/radio/src/gui/colorlcd/curve.cpp index fdb5199c1..5aa6b64c5 100644 --- a/radio/src/gui/colorlcd/curve.cpp +++ b/radio/src/gui/colorlcd/curve.cpp @@ -26,6 +26,22 @@ #include "strhelpers.h" #include "font.h" +const uint8_t _LBM_CURVE_POINT[] = { +#include "mask_cvpoint.lbm" +}; + +const uint8_t _LBM_CURVE_POINT_CENTER[] = { +#include "mask_cvpoint_center.lbm" +}; + +const uint8_t _LBM_CURVE_COORD_SHADOW[] = { +#include "mask_coord_shadow.lbm" +}; + +IMPL_LZ4_BITMAP(LBM_CURVE_POINT); +IMPL_LZ4_BITMAP(LBM_CURVE_POINT_CENTER); +IMPL_LZ4_BITMAP(LBM_CURVE_COORD_SHADOW); + void Curve::drawBackground(BitmapBuffer * dc) { dc->clear(COLOR_THEME_PRIMARY2); diff --git a/radio/src/gui/colorlcd/curve.h b/radio/src/gui/colorlcd/curve.h index 6b3673d23..44854944a 100644 --- a/radio/src/gui/colorlcd/curve.h +++ b/radio/src/gui/colorlcd/curve.h @@ -75,3 +75,8 @@ class Curve: public Window coord_t getPointY(int y) const; }; +#include "lz4_bitmaps.h" + +DEFINE_LZ4_BITMAP(LBM_CURVE_POINT); +DEFINE_LZ4_BITMAP(LBM_CURVE_POINT_CENTER); +DEFINE_LZ4_BITMAP(LBM_CURVE_COORD_SHADOW); diff --git a/radio/src/gui/colorlcd/draw_functions.cpp b/radio/src/gui/colorlcd/draw_functions.cpp index 4fd19aa9a..4f4a61bd3 100644 --- a/radio/src/gui/colorlcd/draw_functions.cpp +++ b/radio/src/gui/colorlcd/draw_functions.cpp @@ -52,6 +52,11 @@ void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, u } } +const uint8_t _LBM_TRIM_SHADOW[] = { +#include "mask_trim_shadow.lbm" +}; +STATIC_LZ4_BITMAP(LBM_TRIM_SHADOW); + void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color) { dc->drawSolidFilledRect(x, y, 15, 15, color); @@ -104,7 +109,13 @@ void drawSleepBitmap() lcdRefresh(); } -#define SHUTDOWN_CIRCLE_DIAMETER 150 +#define SHUTDOWN_CIRCLE_DIAMETER 150 + +const uint8_t _LBM_SHUTDOWN_CIRCLE[] = { +#include "mask_shutdown_circle.lbm" +}; +STATIC_LZ4_BITMAP(LBM_SHUTDOWN_CIRCLE); + class ShutdownAnimation: public FormGroup { public: diff --git a/radio/src/gui/colorlcd/draw_functions.h b/radio/src/gui/colorlcd/draw_functions.h index be10b52d1..bd376e112 100644 --- a/radio/src/gui/colorlcd/draw_functions.h +++ b/radio/src/gui/colorlcd/draw_functions.h @@ -68,11 +68,6 @@ void drawStatusText(BitmapBuffer * dc, const char * text); void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible); void drawProgressScreen(BitmapBuffer * dc, const char * title, const char * message, int num, int den); void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color = COLOR_THEME_FOCUS); -void drawHorizontalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir); -void drawVerticalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir); -void drawVerticalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options); -void drawHorizontalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options); -void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options); void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, gvar_t vmin, gvar_t vmax, LcdFlags flags = 0, const char* suffix = "%", gvar_t offset = 0); void drawGVarValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags = 0); void drawTimer(BitmapBuffer * dc, coord_t x, coord_t y, int32_t tme, LcdFlags flags = 0); diff --git a/radio/src/gui/colorlcd/fab_button.cpp b/radio/src/gui/colorlcd/fab_button.cpp index fe6646ee0..b1ac0563f 100644 --- a/radio/src/gui/colorlcd/fab_button.cpp +++ b/radio/src/gui/colorlcd/fab_button.cpp @@ -27,12 +27,12 @@ const uint8_t __alpha_button_on[] { #include "alpha_button_on.lbm" }; -Bitmap ALPHA_BUTTON_ON(BMP_ARGB4444, (const uint16_t*)__alpha_button_on); +LZ4Bitmap ALPHA_BUTTON_ON(BMP_ARGB4444, __alpha_button_on); const uint8_t __alpha_button_off[] { #include "alpha_button_off.lbm" }; -Bitmap ALPHA_BUTTON_OFF(BMP_ARGB4444, (const uint16_t*)__alpha_button_off); +LZ4Bitmap ALPHA_BUTTON_OFF(BMP_ARGB4444, __alpha_button_off); FabButton::FabButton(FormGroup* parent, coord_t x, coord_t y, uint8_t icon, std::function pressHandler, @@ -53,7 +53,7 @@ FabButton::FabButton(FormGroup* parent, uint8_t icon, void FabButton::paint(BitmapBuffer * dc) { - auto bitmap = checked() ? &ALPHA_BUTTON_ON : &ALPHA_BUTTON_OFF; + const BitmapBuffer* bitmap = checked() ? &ALPHA_BUTTON_ON : &ALPHA_BUTTON_OFF; dc->drawBitmap((width() - bitmap->width()) / 2, (FAB_BUTTON_SIZE - bitmap->height()) / 2, bitmap); diff --git a/radio/src/gui/colorlcd/layouts/topbar_impl.cpp b/radio/src/gui/colorlcd/layouts/topbar_impl.cpp index 64236543c..bd1702523 100644 --- a/radio/src/gui/colorlcd/layouts/topbar_impl.cpp +++ b/radio/src/gui/colorlcd/layouts/topbar_impl.cpp @@ -25,6 +25,67 @@ const char * const STR_MONTHS[] = TR_MONTHS; constexpr uint32_t TOPBAR_REFRESH = 1000 / 10; // 10 Hz +static const uint8_t _LBM_DOT[] = { +#include "mask_dot.lbm" +}; + +static const uint8_t _LBM_TOPMENU_GPS[] = { +#include "mask_topmenu_gps_18.lbm" +}; + +static const uint8_t _LBM_TOPMENU_USB[] = { +#include "mask_topmenu_usb.lbm" +}; + +static const uint8_t _LBM_TOPMENU_VOLUME_0[] = { +#include "mask_volume_0.lbm" +}; + +static const uint8_t _LBM_TOPMENU_VOLUME_1[] = { +#include "mask_volume_1.lbm" +}; + +static const uint8_t _LBM_TOPMENU_VOLUME_2[] = { +#include "mask_volume_2.lbm" +}; + +static const uint8_t _LBM_TOPMENU_VOLUME_3[] = { +#include "mask_volume_3.lbm" +}; + +static const uint8_t _LBM_TOPMENU_VOLUME_4[] = { +#include "mask_volume_4.lbm" +}; + +static const uint8_t _LBM_TOPMENU_VOLUME_SCALE[] = { +#include "mask_volume_scale.lbm" +}; + +static const uint8_t _LBM_TOPMENU_TXBATT[] = { +#include "mask_txbat.lbm" +}; + +static const uint8_t _LBM_TOPMENU_TXBATT_CHARGING[] = { +#include "mask_txbat_charging.lbm" +}; + +static const uint8_t _LBM_TOPMENU_ANTENNA[] = { +#include "mask_antenna.lbm" +}; + +STATIC_LZ4_BITMAP(LBM_DOT); +STATIC_LZ4_BITMAP(LBM_TOPMENU_GPS); +STATIC_LZ4_BITMAP(LBM_TOPMENU_USB); +STATIC_LZ4_BITMAP(LBM_TOPMENU_VOLUME_0); +STATIC_LZ4_BITMAP(LBM_TOPMENU_VOLUME_1); +STATIC_LZ4_BITMAP(LBM_TOPMENU_VOLUME_2); +STATIC_LZ4_BITMAP(LBM_TOPMENU_VOLUME_3); +STATIC_LZ4_BITMAP(LBM_TOPMENU_VOLUME_4); +STATIC_LZ4_BITMAP(LBM_TOPMENU_VOLUME_SCALE); +STATIC_LZ4_BITMAP(LBM_TOPMENU_TXBATT); +STATIC_LZ4_BITMAP(LBM_TOPMENU_TXBATT_CHARGING); +STATIC_LZ4_BITMAP(LBM_TOPMENU_ANTENNA); + TopbarImpl::TopbarImpl(Window * parent) : TopbarImplBase(parent, {0, 0, LCD_W, MENU_HEADER_HEIGHT}, &g_model.topbarData) { diff --git a/radio/src/gui/colorlcd/lz4_bitmaps.cpp b/radio/src/gui/colorlcd/lz4_bitmaps.cpp new file mode 100644 index 000000000..dfa8594fd --- /dev/null +++ b/radio/src/gui/colorlcd/lz4_bitmaps.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "lz4_bitmaps.h" +#include "libopenui/thirdparty/lz4/lz4.h" +#include "libopenui_helpers.h" + +const uint8_t* _decompressed_mask(const uint8_t* lz4_compressed, uint8_t** raw) +{ + if (*raw == nullptr) { + const uint16_t* hdr = (const uint16_t*)lz4_compressed; + uint16_t width = hdr[0]; + uint16_t height = hdr[1]; + + size_t len = *(uint32_t*)&hdr[2]; + + // skip 8 bytes header + lz4_compressed += 8; + + uint32_t pixels = width * height; + *raw = (uint8_t*)malloc(align32(pixels + 4)); + + uint16_t* raw_hdr = (uint16_t*)*raw; + raw_hdr[0] = width; + raw_hdr[1] = height; + + char* data = (char*)&raw_hdr[2]; + LZ4_decompress_safe((const char *)lz4_compressed, data, len, pixels); + } + + return *raw; +} diff --git a/radio/src/gui/colorlcd/lz4_bitmaps.h b/radio/src/gui/colorlcd/lz4_bitmaps.h new file mode 100644 index 000000000..2cbf991e7 --- /dev/null +++ b/radio/src/gui/colorlcd/lz4_bitmaps.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include + +// +// LZ4 bitmaps definitions +// + +#define DEFINE_LZ4_BITMAP(name) \ + struct _uncomp_##name { \ + static uint8_t* raw; \ + operator const uint8_t*(); \ + }; \ + extern _uncomp_##name name + +#define IMPL_LZ4_BITMAP(name) \ + _uncomp_##name::operator const uint8_t*() \ + { \ + return _decompressed_mask( _##name, &raw); \ + }; \ + uint8_t* _uncomp_##name::raw = nullptr; \ + _uncomp_##name name + +#define STATIC_LZ4_BITMAP(name) \ + DEFINE_LZ4_BITMAP(name); \ + IMPL_LZ4_BITMAP(name) + +const uint8_t* _decompressed_mask(const uint8_t* lz4_compressed, uint8_t** raw); diff --git a/radio/src/gui/colorlcd/menus.h b/radio/src/gui/colorlcd/menus.h index 142aa5bf1..3192414e2 100644 --- a/radio/src/gui/colorlcd/menus.h +++ b/radio/src/gui/colorlcd/menus.h @@ -36,7 +36,6 @@ enum MenuIcons { ICON_RADIO_SETUP, ICON_RADIO_SD_MANAGER, ICON_RADIO_TOOLS, - ICON_RADIO_SPECTRUM_ANALYSER, ICON_RADIO_GLOBAL_FUNCTIONS, ICON_RADIO_TRAINER, ICON_RADIO_HARDWARE, diff --git a/radio/src/gui/colorlcd/preview_window.h b/radio/src/gui/colorlcd/preview_window.h index 5b2e1514b..fe84397d6 100644 --- a/radio/src/gui/colorlcd/preview_window.h +++ b/radio/src/gui/colorlcd/preview_window.h @@ -27,7 +27,6 @@ #include "opentx.h" #include "sliders.h" #include "theme_manager.h" -#include "themes/480_bitmaps.h" extern inline tmr10ms_t getTicks() { return g_tmr10ms; } @@ -307,18 +306,25 @@ class PreviewWindow : public FormGroup int width; int x = 5; // topbar icons - auto bm = getBitmap(mask_menu_radio, COLOR_THEME_SECONDARY1, COLOR_THEME_PRIMARY2, &width); + auto mask_menu_radio = getBuiltinIcon(ICON_RADIO); + auto bm = getBitmap(mask_menu_radio, COLOR_THEME_SECONDARY1, + COLOR_THEME_PRIMARY2, &width); dc->drawBitmap(x, 5, bm); x += MENU_HEADER_BUTTON_WIDTH + 2; delete bm; - dc->drawSolidFilledRect(x - 2, 0, MENU_HEADER_BUTTON_WIDTH + 2, TOPBAR_HEIGHT, COLOR_THEME_FOCUS); - bm = getBitmap(mask_radio_tools, COLOR_THEME_FOCUS, COLOR_THEME_PRIMARY2, &width); + dc->drawSolidFilledRect(x - 2, 0, MENU_HEADER_BUTTON_WIDTH + 2, + TOPBAR_HEIGHT, COLOR_THEME_FOCUS); + auto mask_radio_tools = getBuiltinIcon(ICON_RADIO_TOOLS); + bm = getBitmap(mask_radio_tools, COLOR_THEME_FOCUS, COLOR_THEME_PRIMARY2, + &width); dc->drawBitmap(x, 5, bm); x += MENU_HEADER_BUTTON_WIDTH + 2; delete bm; - bm = getBitmap(mask_radio_setup, COLOR_THEME_SECONDARY1, COLOR_THEME_PRIMARY2, &width); + auto mask_radio_setup = getBuiltinIcon(ICON_RADIO_SETUP); + bm = getBitmap(mask_radio_setup, COLOR_THEME_SECONDARY1, + COLOR_THEME_PRIMARY2, &width); dc->drawBitmap(x, 5, bm); delete bm; diff --git a/radio/src/gui/colorlcd/theme.cpp b/radio/src/gui/colorlcd/theme.cpp index cf3f5b099..e91c7f89f 100644 --- a/radio/src/gui/colorlcd/theme.cpp +++ b/radio/src/gui/colorlcd/theme.cpp @@ -30,21 +30,13 @@ const BitmapBuffer * OpenTxTheme::error = nullptr; const BitmapBuffer * OpenTxTheme::busy = nullptr; const BitmapBuffer * OpenTxTheme::shutdown = nullptr; -const uint8_t LBM_FOLDER[] = { -#include "mask_folder.lbm" -}; - -const uint8_t LBM_DROPDOWN[] = { -#include "mask_dropdown.lbm" -}; - constexpr coord_t LBM_USB_PLUGGED_W = 211; constexpr coord_t LBM_USB_PLUGGED_H = 110; -const uint8_t LBM_USB_PLUGGED[] = { +const uint8_t _LBM_USB_PLUGGED[] = { #include "mask_usb_symbol.lbm" }; - +STATIC_LZ4_BITMAP(LBM_USB_PLUGGED); const uint8_t error_bitmap[] = { #include "mask_error.lbm" @@ -86,11 +78,11 @@ void OpenTxTheme::init() const void OpenTxTheme::load() const { if (!error) - error = BitmapBuffer::load8bitMask(error_bitmap); + error = BitmapBuffer::load8bitMaskLZ4(error_bitmap); if (!busy) - busy = BitmapBuffer::load8bitMask(busy_bitmap); + busy = BitmapBuffer::load8bitMaskLZ4(busy_bitmap); if (!shutdown) - shutdown = BitmapBuffer::load8bitMask(shutdown_bitmap); + shutdown = BitmapBuffer::load8bitMaskLZ4(shutdown_bitmap); } ZoneOptionValue * OpenTxTheme::getOptionValue(unsigned int index) const @@ -182,52 +174,6 @@ void OpenTxTheme::drawCheckBox(BitmapBuffer *dc, bool checked, coord_t x, } } -void OpenTxTheme::drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char * str) const -{ - LcdFlags textColor; - if (choice->isEditMode()) - textColor = COLOR_THEME_PRIMARY2; - else if (choice->hasFocus()) - textColor = COLOR_THEME_PRIMARY2; - // else if (!str || str[0] == '\0') - // textColor = COLOR_THEME_PRIMARY2; - else - textColor = COLOR_THEME_SECONDARY1; - - dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, - str[0] == '\0' ? "---" : str, textColor); - - dc->drawBitmapPattern( - choice->getRect().w - 20, (choice->getRect().h - 11) / 2, - choice->getType() == CHOICE_TYPE_FOLDER ? LBM_FOLDER : LBM_DROPDOWN, - textColor); -} - -void OpenTxTheme::drawSlider(BitmapBuffer *dc, int vmin, int vmax, int value, - const rect_t &rect, bool edit, bool focus) const -{ - int val = limit(vmin, value, vmax); - int w = divRoundClosest((rect.w - 16) * (val - vmin), vmax - vmin); - - LcdFlags color = COLOR_THEME_SECONDARY1; - if (focus) { - color = COLOR_THEME_FOCUS; - } - - dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, color); - dc->drawSolidFilledRect(4, 11, rect.w - 8, 4, color); - dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, color); - - dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_OUT, color); - dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_MID, COLOR_THEME_PRIMARY2); - - if (edit) { - dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, COLOR_THEME_EDIT); - } else { - dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, COLOR_THEME_PRIMARY2); - } -} - void OpenTxTheme::drawUsbPluggedScreen(BitmapBuffer * dc) const { // draw USB icon diff --git a/radio/src/gui/colorlcd/theme.h b/radio/src/gui/colorlcd/theme.h index 01f318695..a701eab26 100644 --- a/radio/src/gui/colorlcd/theme.h +++ b/radio/src/gui/colorlcd/theme.h @@ -104,17 +104,8 @@ class OpenTxTheme: public Theme virtual void drawCurrentMenuBackground(BitmapBuffer *dc) const = 0; - // virtual void drawMessageBox(const char * title, const char * text, const - // char * action, uint32_t flags) const override; - // virtual void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, - // coord_t w, coord_t h, int value) const = 0; - void drawCheckBox(BitmapBuffer * dc, bool checked, coord_t x, coord_t y, bool focus) const override; - void drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char * str) const override; - - void drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const override; - virtual void drawTopLeftBitmap(BitmapBuffer * dc) const = 0; virtual void drawUsbPluggedScreen(BitmapBuffer * dc) const; @@ -138,6 +129,4 @@ void loadTheme(); std::list & getRegisteredThemes(); -extern const uint8_t LBM_DROPDOWN[]; - #endif // _COLORLCD_THEME_H_ diff --git a/radio/src/gui/colorlcd/themes/480_bitmaps.h b/radio/src/gui/colorlcd/themes/480_bitmaps.h deleted file mode 100644 index 8a7ec52e2..000000000 --- a/radio/src/gui/colorlcd/themes/480_bitmaps.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) EdgeTX - * - * Based on code named - * opentx - https://github.com/opentx/opentx - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -const uint8_t mask_next[] = { -#include "mask_next.lbm" -}; -const uint8_t mask_back[] = { -#include "mask_back.lbm" -}; -const uint8_t mask_currentmenu_bg[] = { -#include "mask_currentmenu_bg.lbm" -}; -const uint8_t mask_currentmenu_dot[] = { -#include "mask_currentmenu_dot.lbm" -}; -const uint8_t mask_currentmenu_shadow[] = { -#include "mask_currentmenu_shadow.lbm" -}; -const uint8_t mask_menu_model[] = { -#include "mask_menu_model.lbm" -}; -const uint8_t mask_menu_notes[] = { -#include "mask_menu_notes.lbm" -}; -const uint8_t mask_menu_radio[] = { -#include "mask_menu_radio.lbm" -}; -const uint8_t mask_menu_stats[] = { -#include "mask_menu_stats.lbm" -}; -const uint8_t mask_menu_theme[] = { -#include "mask_menu_theme.lbm" -}; -const uint8_t mask_model_curves[] = { -#include "mask_model_curves.lbm" -}; -const uint8_t mask_model_flight_modes[] = { -#include "mask_model_flight_modes.lbm" -}; -const uint8_t mask_model_gvars[] = { -#include "mask_model_gvars.lbm" -}; -const uint8_t mask_model_heli[] = { -#include "mask_model_heli.lbm" -}; -const uint8_t mask_model_inputs[] = { -#include "mask_model_inputs.lbm" -}; -const uint8_t mask_model_logical_switches[] = { -#include "mask_model_logical_switches.lbm" -}; -const uint8_t mask_model_lua_scripts[] = { -#include "mask_model_lua_scripts.lbm" -}; -const uint8_t mask_model_mixer[] = { -#include "mask_model_mixer.lbm" -}; -const uint8_t mask_model_outputs[] = { -#include "mask_model_outputs.lbm" -}; -const uint8_t mask_model_setup[] = { -#include "mask_model_setup.lbm" -}; -const uint8_t mask_model_special_functions[] = { -#include "mask_model_special_functions.lbm" -}; -const uint8_t mask_model_telemetry[] = { -#include "mask_model_telemetry.lbm" -}; -const uint8_t mask_menu_model_select[] = { -#include "mask_menu_model_select.lbm" //TODO: someone may want to make proper icon -}; -const uint8_t mask_model_select_category[] = { -#include "mask_model_select_category.lbm" //TODO: someone should make proper icon -}; -const uint8_t mask_monitor[] = { -#include "mask_monitor.lbm" -}; -const uint8_t mask_monitor_channels1[] = { -#include "mask_monitor_channels1.lbm" -}; -const uint8_t mask_monitor_channels2[] = { -#include "mask_monitor_channels2.lbm" -}; -const uint8_t mask_monitor_channels3[] = { -#include "mask_monitor_channels3.lbm" -}; -const uint8_t mask_monitor_channels4[] = { -#include "mask_monitor_channels4.lbm" -}; -const uint8_t mask_monitor_gvars[] = { -#include "mask_monitor_gvars.lbm" -}; -const uint8_t mask_monitor_inver[] = { -#include "mask_monitor_inver.lbm" -}; -const uint8_t mask_monitor_lockch[] = { -#include "mask_monitor_lockch.lbm" -}; -const uint8_t mask_monitor_logsw[] = { -#include "mask_monitor_logsw.lbm" -}; -const uint8_t mask_monitor_mixes1[] = { -#include "mask_monitor_mixes1.lbm" -}; -const uint8_t mask_monitor_mixes2[] = { -#include "mask_monitor_mixes2.lbm" -}; -const uint8_t mask_mplex_add[] = { -#include "mask_mplex_add.lbm" -}; -const uint8_t mask_mplex_multi[] = { -#include "mask_mplex_multi.lbm" -}; -const uint8_t mask_mplex_replace[] = { -#include "mask_mplex_replace.lbm" -}; -const uint8_t mask_topleft[] = { -#include "mask_topleft.lbm" -}; -const uint8_t mask_edgetx[] = { -#include "mask_edgetx.lbm" -}; -const uint8_t mask_opentx_testmode[] = { -#include "mask_opentx_testmode.lbm" -}; -const uint8_t mask_radio_calibration[] = { -#include "mask_radio_calibration.lbm" -}; -const uint8_t mask_radio_global_functions[] = { -#include "mask_radio_global_functions.lbm" -}; -const uint8_t mask_radio_hardware[] = { -#include "mask_radio_hardware.lbm" -}; -const uint8_t mask_radio_sd_browser[] = { -#include "mask_radio_sd_browser.lbm" -}; -const uint8_t mask_radio_setup[] = { -#include "mask_radio_setup.lbm" -}; -const uint8_t mask_radio_tools[] = { -#include "mask_radio_tools.lbm" -}; -const uint8_t mask_radio_edit_theme[] = { -#include "mask_radio_edit_theme.lbm" -}; - -const uint8_t mask_radio_trainer[] = { -#include "mask_radio_trainer.lbm" -}; -const uint8_t mask_radio_version[] = { -#include "mask_radio_version.lbm" -}; -const uint8_t mask_sbar_mixer[] = { -#include "mask_sbar_mixer.lbm" -}; -const uint8_t mask_sbar_output[] = { -#include "mask_sbar_output.lbm" -}; -const uint8_t mask_sbar_to[] = { -#include "mask_sbar_to.lbm" -}; -const uint8_t mask_stats_analogs[] = { -#include "mask_stats_analogs.lbm" -}; -const uint8_t mask_stats_debug[] = { -#include "mask_stats_debug.lbm" -}; -const uint8_t mask_stats_lua[] = { -#include "mask_stats_lua.lbm" -}; -const uint8_t mask_stats_throttle_graph[] = { -#include "mask_stats_throttle_graph.lbm" -}; -const uint8_t mask_stats_timers[] = { -#include "mask_stats_timers.lbm" -}; -const uint8_t mask_stats_value[] = { -#include "mask_stats_value.lbm" -}; -const uint8_t mask_switches[] = { -#include "mask_switches.lbm" -}; -const uint8_t mask_textline_curve[] = { -#include "mask_textline_curve.lbm" -}; -const uint8_t mask_textline_delay[] = { -#include "mask_textline_delay.lbm" -}; -const uint8_t mask_textline_delayslow[] = { -#include "mask_textline_delayslow.lbm" -}; -const uint8_t mask_textline_fm[] = { -#include "mask_textline_fm.lbm" -}; -const uint8_t mask_textline_label[] = { -#include "mask_textline_label.lbm" -}; -const uint8_t mask_textline_slow[] = { -#include "mask_textline_slow.lbm" -}; -const uint8_t mask_textline_switch[] = { -#include "mask_textline_switch.lbm" -}; -const uint8_t mask_theme_add_view[] = { -#include "mask_theme_add_view.lbm" -}; -const uint8_t mask_theme_setup[] = { -#include "mask_theme_setup.lbm" -}; -const uint8_t mask_theme_view1[] = { -#include "mask_theme_view1.lbm" -}; -const uint8_t mask_theme_view2[] = { -#include "mask_theme_view2.lbm" -}; -const uint8_t mask_theme_view3[] = { -#include "mask_theme_view3.lbm" -}; -const uint8_t mask_theme_view4[] = { -#include "mask_theme_view4.lbm" -}; -const uint8_t mask_theme_view5[] = { -#include "mask_theme_view5.lbm" -}; -const uint8_t mask_theme_view6[] = { -#include "mask_theme_view6.lbm" -}; -const uint8_t mask_theme_view7[] = { -#include "mask_theme_view7.lbm" -}; -const uint8_t mask_theme_view8[] = { -#include "mask_theme_view8.lbm" -}; -const uint8_t stick_pointer[] = { -#include "alpha_stick_pointer.lbm" -}; -const uint8_t stick_background[] = { -#include "alpha_stick_background.lbm" -}; -const uint8_t trackp_background[] = { -#include "alpha_trackp_background.lbm" -}; -const uint8_t mask_sdfree[] = { -#include "mask_sdfree.lbm" -}; -const uint8_t mask_modelqty[] = { -#include "mask_modelqty.lbm" -}; -const uint8_t mask_modelname[] = { -#include "mask_modelname.lbm" -}; -const uint8_t mask_moveback[] = { -#include "mask_moveback.lbm" -}; -const uint8_t mask_moveico[] = { -#include "mask_moveico.lbm" -}; - diff --git a/radio/src/gui/colorlcd/themes/480_default.cpp b/radio/src/gui/colorlcd/themes/480_default.cpp index 07f458127..a6be363d0 100644 --- a/radio/src/gui/colorlcd/themes/480_default.cpp +++ b/radio/src/gui/colorlcd/themes/480_default.cpp @@ -21,15 +21,31 @@ #include "opentx.h" #include "tabsgroup.h" -#include "480_bitmaps.h" +#include "bitmaps.h" #include "theme_manager.h" +#include +using std::unique_ptr; + const ZoneOption OPTIONS_THEME_DEFAULT[] = { { STR_BACKGROUND_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(COLOR_THEME_PRIMARY2) }, { STR_MAIN_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(COLOR_THEME_WARNING) }, { nullptr, ZoneOption::Bool } }; +const uint8_t mask_topleft[] = { +#include "mask_topleft.lbm" +}; +const uint8_t mask_currentmenu_bg[] = { +#include "mask_currentmenu_bg.lbm" +}; +const uint8_t mask_currentmenu_dot[] = { +#include "mask_currentmenu_dot.lbm" +}; +const uint8_t mask_currentmenu_shadow[] = { +#include "mask_currentmenu_shadow.lbm" +}; + class Theme480: public OpenTxTheme { public: @@ -64,7 +80,7 @@ class Theme480: public OpenTxTheme BitmapBuffer * mask; if (reload) { - mask = BitmapBuffer::load8bitMask(lbm); + mask = BitmapBuffer::load8bitMaskLZ4(lbm); if (mask) { delete iconMask[index]; iconMask[index] = mask; @@ -91,67 +107,18 @@ class Theme480: public OpenTxTheme void loadIcons(bool reload) const { -#if defined(LOG_TELEMETRY) || !defined(WATCHDOG) - loadMenuIcon(ICON_OPENTX, mask_opentx_testmode, reload); -#else - loadMenuIcon(ICON_OPENTX, mask_edgetx, reload); -#endif -#if defined(HARDWARE_TOUCH) //TODO: get rid of, and use a real hitbox instead... - loadMenuIcon(ICON_NEXT, mask_next, reload); - loadMenuIcon(ICON_BACK, mask_back, reload); -#endif - loadMenuIcon(ICON_RADIO, mask_menu_radio, reload); - loadMenuIcon(ICON_RADIO_SETUP, mask_radio_setup, reload); - loadMenuIcon(ICON_RADIO_SD_MANAGER, mask_radio_sd_browser, reload); - loadMenuIcon(ICON_RADIO_TOOLS, mask_radio_tools, reload); - //loadMenuIcon(ICON_RADIO_SPECTRUM_ANALYSER, mask_radio_spectrum_analyser, reload); - loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, mask_radio_global_functions, reload); - loadMenuIcon(ICON_RADIO_TRAINER, mask_radio_trainer, reload); - loadMenuIcon(ICON_RADIO_HARDWARE, mask_radio_hardware, reload); - loadMenuIcon(ICON_RADIO_CALIBRATION, mask_radio_calibration, reload); - loadMenuIcon(ICON_RADIO_EDIT_THEME, mask_radio_edit_theme, reload); - loadMenuIcon(ICON_RADIO_VERSION, mask_radio_version, reload); - loadMenuIcon(ICON_MODEL, mask_menu_model, reload); - loadMenuIcon(ICON_MODEL_SETUP, mask_model_setup, reload); - loadMenuIcon(ICON_MODEL_HELI, mask_model_heli, reload); - loadMenuIcon(ICON_MODEL_FLIGHT_MODES, mask_model_flight_modes, reload); - loadMenuIcon(ICON_MODEL_INPUTS, mask_model_inputs, reload); - loadMenuIcon(ICON_MODEL_MIXER, mask_model_mixer, reload); - loadMenuIcon(ICON_MODEL_NOTES, mask_menu_notes, reload); - loadMenuIcon(ICON_MODEL_OUTPUTS, mask_model_outputs, reload); - loadMenuIcon(ICON_MODEL_CURVES, mask_model_curves, reload); - loadMenuIcon(ICON_MODEL_GVARS, mask_model_gvars, reload); - loadMenuIcon(ICON_MODEL_LOGICAL_SWITCHES, mask_model_logical_switches, reload); - loadMenuIcon(ICON_MODEL_SPECIAL_FUNCTIONS, mask_model_special_functions, reload); - loadMenuIcon(ICON_MODEL_LUA_SCRIPTS, mask_model_lua_scripts, reload); - loadMenuIcon(ICON_MODEL_TELEMETRY, mask_model_telemetry, reload); - loadMenuIcon(ICON_MODEL_SELECT, mask_menu_model_select, reload); - loadMenuIcon(ICON_MODEL_SELECT_CATEGORY, mask_model_select_category, reload); - loadMenuIcon(ICON_STATS, mask_menu_stats, reload); - loadMenuIcon(ICON_STATS_THROTTLE_GRAPH, mask_stats_throttle_graph, reload); - loadMenuIcon(ICON_STATS_TIMERS, mask_stats_timers, reload); - loadMenuIcon(ICON_STATS_ANALOGS, mask_stats_analogs, reload); - loadMenuIcon(ICON_STATS_DEBUG, mask_stats_debug, reload); - loadMenuIcon(ICON_THEME, mask_menu_theme, reload); - loadMenuIcon(ICON_THEME_SETUP, mask_theme_setup, reload); - loadMenuIcon(ICON_THEME_VIEW1, mask_theme_view1, reload); - loadMenuIcon(ICON_THEME_VIEW2, mask_theme_view2, reload); - loadMenuIcon(ICON_THEME_VIEW3, mask_theme_view3, reload); - loadMenuIcon(ICON_THEME_VIEW4, mask_theme_view4, reload); - loadMenuIcon(ICON_THEME_VIEW5, mask_theme_view5, reload); - loadMenuIcon(ICON_THEME_ADD_VIEW, mask_theme_add_view, reload); - loadMenuIcon(ICON_MONITOR, mask_monitor, reload); - loadMenuIcon(ICON_MONITOR_CHANNELS1, mask_monitor_channels1, reload); - loadMenuIcon(ICON_MONITOR_CHANNELS2, mask_monitor_channels2, reload); - loadMenuIcon(ICON_MONITOR_CHANNELS3, mask_monitor_channels3, reload); - loadMenuIcon(ICON_MONITOR_CHANNELS4, mask_monitor_channels4, reload); - loadMenuIcon(ICON_MONITOR_LOGICAL_SWITCHES, mask_monitor_logsw, reload); + for (int id = ICON_OPENTX; id != MENUS_ICONS_COUNT; id++) { + MenuIcons icon_id = (MenuIcons)id; + loadMenuIcon(icon_id, getBuiltinIcon(icon_id), reload); + } - BitmapBuffer * background = BitmapBuffer::load8bitMask(mask_currentmenu_bg); - BitmapBuffer * shadow = BitmapBuffer::load8bitMask(mask_currentmenu_shadow); - BitmapBuffer * dot = BitmapBuffer::load8bitMask(mask_currentmenu_dot); + unique_ptr background(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_bg)); + unique_ptr shadow(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_shadow)); + unique_ptr dot(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_dot)); + unique_ptr topleft(BitmapBuffer::load8bitMaskLZ4(mask_topleft)); if (!currentMenuBackground) { + // TODO: get rid of fixed size!!! currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53); } @@ -169,21 +136,21 @@ class Theme480: public OpenTxTheme 0, MENU_TITLE_TOP, currentMenuBackground->width(), currentMenuBackground->height() - MENU_TITLE_TOP, COLOR_THEME_SECONDARY1); - currentMenuBackground->drawMask(0, 0, background, + currentMenuBackground->drawMask(0, 0, background.get(), COLOR_THEME_FOCUS); - currentMenuBackground->drawMask(0, 0, shadow, COLOR_THEME_PRIMARY1); - - currentMenuBackground->drawMask(10, 39, dot, COLOR_THEME_PRIMARY2); + currentMenuBackground->drawMask(0, 0, shadow.get(), COLOR_THEME_PRIMARY1); + currentMenuBackground->drawMask(10, 39, dot.get(), COLOR_THEME_PRIMARY2); } - delete topleftBitmap; - topleftBitmap = BitmapBuffer::load8bitMaskOnBackground( - mask_topleft, COLOR_THEME_FOCUS, COLOR_THEME_SECONDARY1); + if (!topleftBitmap) { + topleftBitmap = new BitmapBuffer(BMP_RGB565, topleft->width(), topleft->height()); + } - delete background; - delete shadow; - delete dot; + if (topleftBitmap) { + topleftBitmap->clear(COLOR_THEME_SECONDARY1); + topleftBitmap->drawMask(0, 0, topleft.get(), COLOR_THEME_FOCUS); + } } void setBackgroundImageFileName(const char *fileName) override @@ -195,100 +162,6 @@ class Theme480: public OpenTxTheme backgroundBitmap = BitmapBuffer::loadBitmap(backgroundImageFileName); } - void loadThemeBitmaps() const - { - // Calibration screen - delete calibStick; - calibStick = - BitmapBuffer::loadRamBitmap(stick_pointer, sizeof(stick_pointer)); - - delete calibStickBackground; - calibStickBackground = BitmapBuffer::loadRamBitmap( - stick_background, sizeof(stick_background)); - - delete calibTrackpBackground; - calibTrackpBackground = BitmapBuffer::loadRamBitmap( - trackp_background, sizeof(trackp_background)); - - // Model Selection screen - - // Unused: - // - // delete modelselIconBitmap; - // modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3); - // if (modelselIconBitmap) { - // BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(getFilePath("modelsel/icon_default.png")); - // modelselIconBitmap->drawBitmap(20, 8, bitmap); - // delete bitmap; - // } - - delete modelselSdFreeBitmap; - modelselSdFreeBitmap = BitmapBuffer::load8bitMask(mask_sdfree); - - delete modelselModelQtyBitmap; - modelselModelQtyBitmap = BitmapBuffer::load8bitMask(mask_modelqty); - - delete modelselModelNameBitmap; - modelselModelNameBitmap = BitmapBuffer::load8bitMask(mask_modelname); - - delete modelselModelMoveBackground; - modelselModelMoveBackground = BitmapBuffer::load8bitMask(mask_moveback); - - delete modelselModelMoveIcon; - modelselModelMoveIcon = BitmapBuffer::load8bitMask(mask_moveico); - - //TODO: should be loaded from LUA, not here!!! - delete modelselWizardBackground; - modelselWizardBackground = BitmapBuffer::loadBitmap(getFilePath("wizard/background.png")); - - // Channels monitor screen - delete chanMonLockedBitmap; - chanMonLockedBitmap = BitmapBuffer::load8bitMask(mask_monitor_lockch); - - delete chanMonInvertedBitmap; - chanMonInvertedBitmap = BitmapBuffer::load8bitMask(mask_monitor_inver); - - // Mixer setup screen - delete mixerSetupMixerBitmap; - mixerSetupMixerBitmap = BitmapBuffer::load8bitMask(mask_sbar_mixer); - - delete mixerSetupToBitmap; - mixerSetupToBitmap = BitmapBuffer::load8bitMask(mask_sbar_to); - - delete mixerSetupOutputBitmap; - mixerSetupOutputBitmap = BitmapBuffer::load8bitMask(mask_sbar_output); - - delete mixerSetupAddBitmap; - mixerSetupAddBitmap = BitmapBuffer::load8bitMask(mask_mplex_add); - - delete mixerSetupMultiBitmap; - mixerSetupMultiBitmap = BitmapBuffer::load8bitMask(mask_mplex_multi); - - delete mixerSetupReplaceBitmap; - mixerSetupReplaceBitmap = BitmapBuffer::load8bitMask(mask_mplex_replace); - - delete mixerSetupLabelIcon; - mixerSetupLabelIcon = BitmapBuffer::load8bitMask(mask_textline_label); - - delete mixerSetupCurveIcon; - mixerSetupCurveIcon = BitmapBuffer::load8bitMask(mask_textline_curve); - - delete mixerSetupSwitchIcon; - mixerSetupSwitchIcon = BitmapBuffer::load8bitMask(mask_textline_switch); - - delete mixerSetupFlightmodeIcon; - mixerSetupFlightmodeIcon = BitmapBuffer::load8bitMask(mask_textline_fm); - - delete mixerSetupSlowIcon; - mixerSetupSlowIcon = BitmapBuffer::load8bitMask(mask_textline_slow); - - delete mixerSetupDelayIcon; - mixerSetupDelayIcon = BitmapBuffer::load8bitMask(mask_textline_delay); - - delete mixerSetupDelaySlowIcon; - mixerSetupDelaySlowIcon = BitmapBuffer::load8bitMask(mask_textline_delayslow); - } - void load() const override { loadColors(); @@ -303,8 +176,7 @@ class Theme480: public OpenTxTheme void update(bool reload = true) const override { loadIcons(reload); - if (reload) - loadThemeBitmaps(); + if (reload) loadBuiltinBitmaps(); } void drawBackground(BitmapBuffer * dc) const override diff --git a/radio/src/gui/colorlcd/widgets/timer.cpp b/radio/src/gui/colorlcd/widgets/timer.cpp index e6977075b..9f11d802a 100644 --- a/radio/src/gui/colorlcd/widgets/timer.cpp +++ b/radio/src/gui/colorlcd/widgets/timer.cpp @@ -22,6 +22,22 @@ #include "opentx.h" #include "widgets_container_impl.h" +const uint8_t _LBM_TIMER[] = { +#include "mask_timer.lbm" +}; + +const uint8_t _LBM_RSCALE[] = { +#include "mask_rscale.lbm" +}; + +const uint8_t _LBM_TIMER_BACKGROUND[] = { +#include "mask_timer_bg.lbm" +}; + +STATIC_LZ4_BITMAP(LBM_TIMER); +STATIC_LZ4_BITMAP(LBM_RSCALE); +STATIC_LZ4_BITMAP(LBM_TIMER_BACKGROUND); + class TimerWidget : public Widget { public: diff --git a/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt b/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt index 0821b82aa..a73b73a38 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt @@ -117,6 +117,7 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14) ../../../../../gui/colorlcd/colors.cpp ../../../../../fonts/lvgl/lv_font_roboto_bl_16.c ../../../../../thirdparty/libopenui/src/bitmapbuffer.cpp + ../../../../../thirdparty/libopenui/thirdparty/lz4/lz4.c ../../../../../targets/${TARGET_DIR}/sdram_driver.c ../../../../../targets/common/arm/stm32/sdio_sd.c ../../../../../targets/common/arm/stm32/rtc_driver.cpp diff --git a/radio/src/targets/horus/bootloader/boot_menu.cpp b/radio/src/targets/horus/bootloader/boot_menu.cpp index 757a0550a..b979ed85e 100644 --- a/radio/src/targets/horus/bootloader/boot_menu.cpp +++ b/radio/src/targets/horus/bootloader/boot_menu.cpp @@ -28,30 +28,20 @@ #include -const uint8_t __bmp_plug_usb_rle[] { +const uint8_t __bmp_plug_usb[] { #include "bmp_plug_usb.lbm" }; -RLEBitmap BMP_PLUG_USB(BMP_ARGB4444, __bmp_plug_usb_rle); +LZ4Bitmap BMP_PLUG_USB(BMP_ARGB4444, __bmp_plug_usb); -const uint8_t __bmp_usb_plugged_rle[] { +const uint8_t __bmp_usb_plugged[] { #include "bmp_usb_plugged.lbm" }; -RLEBitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged_rle); +LZ4Bitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged); -const uint8_t __bmp_background_rle[] { +const uint8_t __bmp_background[] { #include "bmp_background.lbm" }; -RLEBitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background_rle); - -//TODO: replace with LV_SYMBOL_FILE -const uint8_t LBM_FILE[] = { -#include "icon_file.lbm" -}; - -//TODO: replace with LV_SYMBOL_OK -const uint8_t LBM_OK[] = { -#include "icon_ok.lbm" -}; +LZ4Bitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background); #define BL_GREEN COLOR2FLAGS(RGB(73, 219, 62)) #define BL_RED COLOR2FLAGS(RGB(229, 32, 30)) @@ -88,7 +78,8 @@ static void bootloaderDrawBackground() for (int i=0; idrawBitmap(i, j, &BMP_BACKGROUND); + BitmapBuffer* bg_bmp = &BMP_BACKGROUND; + _background->drawBitmap(i, j, bg_bmp); } } } @@ -121,7 +112,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) pos -= 92; lcd->drawSolidRect(92, (opt == 0) ? 72 : 107, pos, 26, 2, BL_SELECTED); - lcd->drawBitmap(60, 166, &BMP_PLUG_USB); + lcd->drawBitmap(60, 166, (const BitmapBuffer*)&BMP_PLUG_USB); lcd->drawText(195, 175, "Or plug in a USB cable", BL_FOREGROUND); lcd->drawText(195, 200, "for mass storage", BL_FOREGROUND); @@ -130,7 +121,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) } else if (st == ST_USB) { - lcd->drawBitmap(136, 98, &BMP_USB_PLUGGED); + lcd->drawBitmap(136, 98, (const BitmapBuffer*)&BMP_USB_PLUGGED); lcd->drawText(195, 128, "USB Connected", BL_FOREGROUND); } else if (st == ST_FILE_LIST || st == ST_DIR_CHECK || st == ST_FLASH_CHECK || @@ -176,7 +167,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) lcd->drawText(168, 178, "Radio:", RIGHT | BL_FOREGROUND); lcd->drawText(174, 178, tag.flavour, BL_FOREGROUND); - lcd->drawBitmapPattern(356, 158, LBM_OK, BL_GREEN); + lcd->drawText(356, 156, LV_SYMBOL_OK, BL_GREEN); } } @@ -201,7 +192,6 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) } if (st != ST_FLASHING) { - //lcd->drawBitmapPattern(305, 242, LBM_EXIT, BL_FOREGROUND); lcd->drawText(305, 244, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); lcd->drawText(335, 244, "[RTN] to exit", BL_FOREGROUND); } @@ -210,7 +200,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) void bootloaderDrawFilename(const char* str, uint8_t line, bool selected) { - lcd->drawBitmapPattern(94, 76 + (line * 25), LBM_FILE, BL_FOREGROUND); + lcd->drawText(94, 75 + (line * 25), LV_SYMBOL_FILE, BL_FOREGROUND); lcd->drawText(124, 75 + (line * 25), str, BL_FOREGROUND); if (selected) { diff --git a/radio/src/targets/nv14/bootloader/boot_menu.cpp b/radio/src/targets/nv14/bootloader/boot_menu.cpp index beea7039f..7d3badd01 100644 --- a/radio/src/targets/nv14/bootloader/boot_menu.cpp +++ b/radio/src/targets/nv14/bootloader/boot_menu.cpp @@ -33,28 +33,20 @@ #define DOUBLE_PADDING 56 #define MESSAGE_TOP (LCD_H - (2*DOUBLE_PADDING)) -const uint8_t __bmp_plug_usb_rle[] { +const uint8_t __bmp_plug_usb[] { #include "bmp_plug_usb.lbm" }; -RLEBitmap BMP_PLUG_USB(BMP_ARGB4444, __bmp_plug_usb_rle); +LZ4Bitmap BMP_PLUG_USB(BMP_ARGB4444, __bmp_plug_usb); -const uint8_t __bmp_usb_plugged_rle[] { +const uint8_t __bmp_usb_plugged[] { #include "bmp_usb_plugged.lbm" }; -RLEBitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged_rle); +LZ4Bitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged); -const uint8_t __bmp_background_rle[] { +const uint8_t __bmp_background[] { #include "bmp_background.lbm" }; -RLEBitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background_rle); - -const uint8_t LBM_FILE[] = { -#include "icon_file.lbm" -}; - -const uint8_t LBM_OK[] = { -#include "icon_ok.lbm" -}; +LZ4Bitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background); #define BL_GREEN COLOR2FLAGS(RGB(73, 219, 62)) #define BL_RED COLOR2FLAGS(RGB(229, 32, 30)) @@ -91,7 +83,8 @@ static void bootloaderDrawBackground() for (int i=0; idrawBitmap(i, j, &BMP_BACKGROUND); + BitmapBuffer* bg_bmp = &BMP_BACKGROUND; + _background->drawBitmap(i, j, bg_bmp); } } } @@ -126,7 +119,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) pos -= 79; lcd->drawSolidRect(79, (opt == 0) ? 72 : 107, pos, 26, 2, BL_SELECTED); - lcd->drawBitmap(center - 55, 165, &BMP_PLUG_USB); + lcd->drawBitmap(center - 55, 165, (const BitmapBuffer*)&BMP_PLUG_USB); lcd->drawText(center, 250, "Or plug in a USB cable", CENTERED | BL_FOREGROUND); lcd->drawText(center, 275, "for mass storage", CENTERED | BL_FOREGROUND); @@ -136,7 +129,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) lcd->drawText(center, LCD_H - DEFAULT_PADDING, getFirmwareVersion(nullptr), CENTERED | BL_FOREGROUND); } else if (st == ST_USB) { - lcd->drawBitmap(center - 26, 98, &BMP_USB_PLUGGED); + lcd->drawBitmap(center - 26, 98, (const BitmapBuffer*)&BMP_USB_PLUGGED); lcd->drawText(center, 168, "USB Connected", CENTERED | BL_FOREGROUND); } else if (st == ST_FILE_LIST || st == ST_DIR_CHECK || st == ST_FLASH_CHECK || st == ST_FLASHING || @@ -196,8 +189,8 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) MESSAGE_TOP + DEFAULT_PADDING, tag.flavour, BL_FOREGROUND); - lcd->drawBitmapPattern(LCD_W - DOUBLE_PADDING, MESSAGE_TOP - 10, - LBM_OK, BL_GREEN); + lcd->drawText(LCD_W - DOUBLE_PADDING, MESSAGE_TOP - 10, + LV_SYMBOL_OK, BL_GREEN); } } @@ -232,10 +225,12 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) void bootloaderDrawFilename(const char* str, uint8_t line, bool selected) { - lcd->drawBitmapPattern(DEFAULT_PADDING, 76 + (line * 25), LBM_FILE, BL_FOREGROUND); + lcd->drawText(DEFAULT_PADDING, 75 + (line * 25), LV_SYMBOL_FILE, BL_FOREGROUND); lcd->drawText(DEFAULT_PADDING + 30, 75 + (line * 25), str, BL_FOREGROUND); if (selected) { - lcd->drawSolidRect(DEFAULT_PADDING + 25, 72 + (line * 25), LCD_W - (DEFAULT_PADDING + 25) - 28, 26, 2, BL_SELECTED); + lcd->drawSolidRect(DEFAULT_PADDING + 25, 72 + (line * 25), + LCD_W - (DEFAULT_PADDING + 25) - 28, 26, 2, + BL_SELECTED); } } diff --git a/radio/src/targets/simu/CMakeLists.txt b/radio/src/targets/simu/CMakeLists.txt index 3af312ade..56f7f3849 100644 --- a/radio/src/targets/simu/CMakeLists.txt +++ b/radio/src/targets/simu/CMakeLists.txt @@ -44,6 +44,7 @@ if(SIMU_BOOTLOADER) ../../targets/common/arm/stm32/bootloader/bin_files.cpp ../../targets/common/arm/stm32/bootloader/boot.cpp ../../targets/${TARGET_DIR}/bootloader/boot_menu.cpp + ../../thirdparty/libopenui/thirdparty/lz4/lz4.c ) endif() diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index 21e0147c0..3d322cad3 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit 21e0147c0a550174349d7e329e6972b94d754503 +Subproject commit 3d322cad3a400976a16a9560901108288325ce02