chore(color): replace the bitmaps in the calibration pages with generated UI (#7762)

Co-authored-by: philmoz <philmoz@users.noreply.github.com>
This commit is contained in:
philmoz
2026-09-15 11:15:47 +10:00
committed by GitHub
parent ad8822a72b
commit e066572340
10 changed files with 77 additions and 97 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -1,50 +0,0 @@
<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_4671_2781)">
<path d="M82.4964 2H7.50365C4.46407 2 2 4.46407 2 7.50365V82.4964C2 85.5359 4.46407 88 7.50365 88H82.4964C85.5359 88 88 85.5359 88 82.4964V7.50365C88 4.46407 85.5359 2 82.4964 2Z" stroke="black" stroke-width="2.5"/>
<path d="M7.5542 45H82.4459" stroke="black" stroke-width="1.50284"/>
<path d="M45 81.4458V6.55414" stroke="black" stroke-width="1.50284"/>
<path d="M44.9999 78.6995C63.6117 78.6995 78.6995 63.6117 78.6995 45C78.6995 26.3882 63.6117 11.3005 44.9999 11.3005C26.3882 11.3005 11.3004 26.3882 11.3004 45C11.3004 63.6117 26.3882 78.6995 44.9999 78.6995Z" stroke="#E5201E" stroke-width="10"/>
<path d="M44.8733 81.7401V76.1657" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M44.8733 81.7401V76.1657" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M38.4954 81.16L39.4634 75.6703" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M32.3151 79.4811L34.2217 74.2429" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M26.5202 76.7545L29.3074 71.9269" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M21.2869 73.0631L24.87 68.7929" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M16.774 68.519L21.0442 64.9359" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M13.1188 63.2603L17.9463 60.4731" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M10.4322 57.4468L15.6704 55.5403" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M8.7961 51.2551L14.2858 50.2871" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M8.25988 44.8733H13.8342" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M8.84005 38.4954L14.3297 39.4633" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M10.5189 32.3152L15.7571 34.2217" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M13.2455 26.5202L18.073 29.3074" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M16.9368 21.2869L21.207 24.87" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M21.481 16.774L25.0641 21.0442" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M26.7397 13.1188L29.5269 17.9464" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M32.5532 10.4323L34.4597 15.6705" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M38.7449 8.79612L39.7129 14.2858" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M45.1267 8.25996V13.8343" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M51.5046 8.84005L50.5366 14.3297" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M57.6849 10.5189L55.7783 15.7571" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M63.4798 13.2455L60.6926 18.0731" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M68.7131 16.9369L65.13 21.2071" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M73.226 21.481L68.9558 25.0641" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M76.8812 26.7397L72.0537 29.5269" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M79.5678 32.5532L74.3296 34.4597" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M81.2039 38.7449L75.7142 39.7129" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M81.7401 45.1267H76.1658" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M81.16 51.5046L75.6703 50.5366" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M79.4811 57.6848L74.2429 55.7783" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M76.7545 63.4798L71.927 60.6926" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M73.0632 68.7131L68.793 65.1299" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M68.519 73.226L64.9359 68.9558" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M63.2603 76.8812L60.4731 72.0536" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M57.4468 79.5677L55.5403 74.3295" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
<path d="M51.2551 81.2039L50.2871 75.7142" stroke="white" stroke-width="1.50284" stroke-linecap="round"/>
</g>
<defs>
<clipPath id="clip0_4671_2781">
<rect width="90" height="90" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 4.6 KiB

@@ -1,19 +0,0 @@
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_4671_2899)">
<g opacity="0.639576" filter="url(#filter0_f_4671_2899)">
<path d="M16.2476 26.5192C21.9716 26.5192 26.6118 21.8789 26.6118 16.1549C26.6118 10.4309 21.9716 5.79071 16.2476 5.79071C10.5235 5.79071 5.8833 10.4309 5.8833 16.1549C5.8833 21.8789 10.5235 26.5192 16.2476 26.5192Z" fill="black"/>
<path d="M16.2476 26.5192C21.9716 26.5192 26.6118 21.8789 26.6118 16.1549C26.6118 10.4309 21.9716 5.79071 16.2476 5.79071C10.5235 5.79071 5.8833 10.4309 5.8833 16.1549C5.8833 21.8789 10.5235 26.5192 16.2476 26.5192Z" stroke="black" stroke-width="4.56989" stroke-linejoin="round"/>
</g>
<path d="M13.5128 23.6868C19.2368 23.6868 23.8771 19.0465 23.8771 13.3225C23.8771 7.59853 19.2368 2.95831 13.5128 2.95831C7.7888 2.95831 3.14856 7.59853 3.14856 13.3225C3.14856 19.0465 7.7888 23.6868 13.5128 23.6868Z" fill="white" stroke="#E5201E" stroke-width="4.56989" stroke-linejoin="round"/>
</g>
<defs>
<filter id="filter0_f_4671_2899" x="2.1474" y="2.05478" width="28.2003" height="28.2003" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="0.725496" result="effect1_foregroundBlur_4671_2899"/>
</filter>
<clipPath id="clip0_4671_2899">
<rect width="30" height="30" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

@@ -26,18 +26,12 @@
#include "sliders.h"
#include "view_main_decoration.h"
#include "hw_inputs.h"
#include <math.h>
#include <memory>
uint8_t menuCalibrationState;
static const uint8_t stick_pointer[] __FLASH = {
#include "bmp_radio_stick_pointer.lbm"
};
static const uint8_t stick_background[] __FLASH = {
#include "bmp_radio_stick_background.lbm"
};
class StickCalibrationWindow : public Window
{
public:
@@ -45,26 +39,89 @@ class StickCalibrationWindow : public Window
uint8_t stickY) :
Window(parent, rect), stickX(stickX), stickY(stickY)
{
new StaticLZ4Image(this, 0, 0, (LZ4Bitmap *)stick_background);
calibStick = new StaticLZ4Image(this, 0, 0, (LZ4Bitmap *)stick_pointer);
lv_obj_t* bg = lv_obj_create(lvobj);
etx_obj_add_style(bg, styles->rounded, LV_PART_MAIN);
etx_obj_add_style(bg, styles->border, LV_PART_MAIN);
etx_obj_add_style(bg, styles->border_color[COLOR_BLACK_INDEX], LV_PART_MAIN);
lv_obj_set_size(bg, CAL_SIZ + PAD_BORDER * 2, CAL_SIZ + PAD_BORDER * 2);
lv_obj_add_flag(bg, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
axis[0] = {PAD_SMALL, CAL_SIZ / 2};
axis[1] = {CAL_SIZ - PAD_SMALL, CAL_SIZ / 2};
addLine(bg, COLOR_GREY_INDEX, &axis[0]);
axis[2] = {CAL_SIZ / 2, PAD_SMALL};
axis[3] = {CAL_SIZ / 2, CAL_SIZ - PAD_SMALL};
addLine(bg, COLOR_GREY_INDEX, &axis[2]);
lv_obj_t* bgCircle = lv_obj_create(bg);
etx_obj_add_style(bgCircle, styles->circle, LV_PART_MAIN);
etx_obj_add_style(bgCircle, styles->border, LV_PART_MAIN);
etx_obj_add_style(bgCircle, styles->border_color[COLOR_GREY_INDEX], LV_PART_MAIN);
lv_obj_set_style_border_width(bgCircle, CIRC_W, LV_PART_MAIN);
lv_obj_set_size(bgCircle, CAL_SIZ - PAD_TINY * 2, CAL_SIZ - PAD_TINY * 2);
lv_obj_set_pos(bgCircle, PAD_TINY, PAD_TINY);
for (int i = 0; i < MKR_CNT; i += 1) {
float angle = (i * 360.0f / MKR_CNT) / 180.0f * M_PI;
float x = cos(angle);
float y = sin(angle);
float r1 = (CAL_SIZ - PAD_SMALL) / 2;
float r2 = r1 - CIRC_W;
mkr[i * 2] = {(lv_coord_t)(x * r1) + CAL_SIZ / 2, (lv_coord_t)(y * r1) + CAL_SIZ / 2};
mkr[i * 2 + 1] = {(lv_coord_t)(x * r2) + CAL_SIZ / 2, (lv_coord_t)(y * r2) + CAL_SIZ / 2};
addLine(bg, COLOR_WHITE_INDEX, &mkr[i * 2]);
}
calibShadow = lv_obj_create(bg);
etx_solid_bg(calibShadow, COLOR_BLACK_INDEX);
etx_obj_add_style(calibShadow, styles->circle, LV_PART_MAIN);
lv_obj_set_style_bg_opa(calibShadow, LV_OPA_50, LV_PART_MAIN);
lv_obj_set_size(calibShadow, CAL_PTR_W, CAL_PTR_W);
calibStick = lv_obj_create(bg);
etx_solid_bg(calibStick, COLOR_WHITE_INDEX);
etx_obj_add_style(calibStick, styles->circle, LV_PART_MAIN);
etx_obj_add_style(calibStick, styles->border, LV_PART_MAIN);
etx_obj_add_style(calibStick, styles->border_color[COLOR_RED_INDEX], LV_PART_MAIN);
lv_obj_set_style_border_width(calibStick, PAD_SMALL, LV_PART_MAIN);
lv_obj_set_size(calibStick, CAL_PTR_W, CAL_PTR_W);
checkEvents();
}
void addLine(lv_obj_t* parent, LcdColorIndex color, lv_point_t* points)
{
lv_obj_t* lin = lv_line_create(parent);
etx_obj_add_style(lin, styles->line_color[color], LV_PART_MAIN);
lv_obj_set_style_line_opa(lin, LV_OPA_COVER, LV_PART_MAIN);
lv_obj_set_style_line_width(lin, 2, LV_PART_MAIN);
lv_line_set_points(lin, points, 2);
}
void checkEvents() override
{
int32_t x = calibratedAnalogs[stickX];
int32_t y = calibratedAnalogs[stickY];
coord_t dx = width() / 2 - CAL_CTR + (CAL_SIZ / 2 * x) / RESX;
coord_t dy = height() / 2 - CAL_CTR - (CAL_SIZ / 2 * y) / RESX;
lv_obj_set_pos(calibStick->getLvObj(), dx, dy);
coord_t w = (CAL_SIZ - CAL_PTR_W) / 2;
coord_t h = (CAL_SIZ - CAL_PTR_W) / 2;
coord_t dx = w + (w * x) / RESX;
coord_t dy = h - (h * y) / RESX;
lv_obj_set_pos(calibStick, dx, dy);
lv_obj_set_pos(calibShadow, dx + 1, dy + 1);
}
static LAYOUT_VAL_SCALED(CAL_CTR, 9)
static LAYOUT_VAL_SCALED(CAL_SIZ, 68)
static LAYOUT_VAL_SCALED_EVEN(CAL_PTR_W, 18);
static LAYOUT_VAL_SCALED_EVEN(CAL_SIZ, 120)
static LAYOUT_VAL_SCALED_EVEN(CIRC_W, 10)
static constexpr int MKR_CNT = 24;
protected:
uint8_t stickX, stickY;
StaticLZ4Image *calibStick = nullptr;
lv_obj_t* calibStick = nullptr;
lv_obj_t* calibShadow = nullptr;
lv_point_t axis[4];
lv_point_t mkr[MKR_CNT * 2];
};
RadioCalibrationPage::RadioCalibrationPage() :
@@ -89,21 +146,15 @@ void RadioCalibrationPage::buildBody(Window *window)
// The two sticks
LZ4Bitmap *bg = (LZ4Bitmap *)stick_background;
coord_t w = StickCalibrationWindow::CAL_SIZ + PAD_BORDER * 2;
coord_t x = (window->width() - w * 2) / 3;
coord_t y = (window->height() - w) / 2;
new StickCalibrationWindow(
window,
{window->width() / 3 - bg->width / 2,
window->height() / 2 - bg->height / 2, bg->width, bg->height},
0, 1);
new StickCalibrationWindow(window, {x, y, w, w}, 0, 1);
auto max_sticks = adcGetMaxInputs(ADC_INPUT_MAIN);
if (max_sticks > 2) {
new StickCalibrationWindow(
window,
{window->width() * 2 / 3 - bg->width / 2,
window->height() / 2 - bg->height / 2, bg->width, bg->height},
3, 2);
new StickCalibrationWindow(window, {x * 2 + w, y, w, w}, 3, 2);
}
new ViewMainDecoration(window, true);
-2
View File
@@ -2,8 +2,6 @@ file,width,height,modified
bmp_bootloader_plug_usb,111,59,2026-01-13 11:36:16
bmp_bootloader_usb_plugged,52,54,2026-01-13 11:36:16
bmp_logo_edgetx_splash,271,257,2026-01-13 11:36:16
bmp_radio_stick_background,90,90,2026-01-13 12:46:22
bmp_radio_stick_pointer,20,20,2026-01-13 11:36:16
mask_icon_edgetx,30,30,2026-01-13 11:36:16
mask_icon_menu_favs,30,30,2026-01-13 11:36:16
mask_icon_menu_manage_models,30,30,2026-01-13 11:36:16
1 file width height modified
2 bmp_bootloader_plug_usb 111 59 2026-01-13 11:36:16
3 bmp_bootloader_usb_plugged 52 54 2026-01-13 11:36:16
4 bmp_logo_edgetx_splash 271 257 2026-01-13 11:36:16
bmp_radio_stick_background 90 90 2026-01-13 12:46:22
bmp_radio_stick_pointer 20 20 2026-01-13 11:36:16
5 mask_icon_edgetx 30 30 2026-01-13 11:36:16
6 mask_icon_menu_favs 30 30 2026-01-13 11:36:16
7 mask_icon_menu_manage_models 30 30 2026-01-13 11:36:16