From c5428ad81fe52324eb0886a8d859d8ec48ec8582 Mon Sep 17 00:00:00 2001 From: yuquanjun Date: Sun, 6 Sep 2026 07:57:55 +0800 Subject: [PATCH] Fix incomplete status-bar battery outline. Keep L/R walls when generating the outline asset, tighten fill to the cavity, and nudge the icon up so the bottom edge is not clipped. Co-authored-by: Cursor --- UI/UI_global.c | 8 +- UI/UI_global.h | 2 +- .../Drv_ILI9341_Lcd_Image_UI0902.c | 84 +++++++++---------- tools/gen_ui0902_assets.py | 14 +++- 4 files changed, 59 insertions(+), 49 deletions(-) diff --git a/UI/UI_global.c b/UI/UI_global.c index 1bd7663..ad0f61f 100644 --- a/UI/UI_global.c +++ b/UI/UI_global.c @@ -230,7 +230,7 @@ void label_top() { const uint16_t btn_color = /*DARKLGRAY*/0x2988; LCD_FillByColor(0, 0, 240, UI_STATUS_BAR_H, UI0902_BG_COLOR); - /* 仅一组动态音量条(音量图标素材本身也是竖条,不再叠绘以免双图标) */ + /* 音量条:渐变 + 圆角(见 Draw_Volume_Bar) */ Draw_Volume_Bar(UI0902_VOL_X, UI0902_VOL_Y, level, 1, WHITE, GRAY); LCD_DrawLine(0, 26, 240, 26, btn_color); Show_BL_Icon(mGuiData[GUI_BL_SW].Current); @@ -340,13 +340,13 @@ void Draw_Status_Battery_Icon(uint8_t battery_percent) LCD_FillByColor(bat_x > 2 ? (uint16_t)(bat_x - 2) : 0, 0, 240, UI_STATUS_BAR_H, UI0902_BG_COLOR); - /* 实心电量条(旧 fill 图误含「80%」文字) */ - fill_w = (uint16_t)((22UL * battery_percent) / 100); + /* 实心电量条:内腔约 x+3..x+23(宽21),勿盖住右侧壳壁 */ + fill_w = (uint16_t)((21UL * battery_percent) / 100); if (fill_w > 0) { fill_x1 = (uint16_t)(bat_x + 3); fill_y1 = (uint16_t)(UI0902_BATTERY_Y + 2); fill_x2 = (uint16_t)(fill_x1 + fill_w - 1); - fill_y2 = (uint16_t)(fill_y1 + 8); + fill_y2 = (uint16_t)(fill_y1 + 7); LCD_FillByColor(fill_x1, fill_y1, fill_x2, fill_y2, WHITE); } LCD_WR_PIC_Trans(bat_x, UI0902_BATTERY_Y, UI0902_BATTERY_W, UI0902_BATTERY_H, diff --git a/UI/UI_global.h b/UI/UI_global.h index b668ac2..21e8fd9 100644 --- a/UI/UI_global.h +++ b/UI/UI_global.h @@ -122,7 +122,7 @@ void CallUI_RestoreSelect(void); #define UI0902_BT_Y 5 #define UI0902_BATTERY_W 29 #define UI0902_BATTERY_H 12 -#define UI0902_BATTERY_Y 14 /* mode.png 状态栏电池顶 ≈y14 */ +#define UI0902_BATTERY_Y 13 /* 顶≈y13,底 y24,与分隔线 y26 留空,避免底边被切 */ #define UI0902_BATTERY_RIGHT_MARGIN 6 #define UI0902_BATTERY_TEXT_GAP 4 #define UI0902_BATTERY_TEXT_SIZE 9 /* mode.png 百分比字号 ≈9,完整显示 % */ diff --git a/device/LCD_ILI9341/Drv_ILI9341_Lcd_Image_UI0902.c b/device/LCD_ILI9341/Drv_ILI9341_Lcd_Image_UI0902.c index 02d7e89..709ce7f 100644 --- a/device/LCD_ILI9341/Drv_ILI9341_Lcd_Image_UI0902.c +++ b/device/LCD_ILI9341/Drv_ILI9341_Lcd_Image_UI0902.c @@ -3,50 +3,50 @@ /* Auto-generated by tools/gen_ui0902_assets.py. Do not hand-edit. */ const unsigned char gImage_UI0902_BatteryOutline_29x12[696] = { /* 29x12 RGB565 BE */ -0x00,0x00,0x5B,0x0D,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18, -0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18, -0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18, -0xC6,0x18,0xA5,0x14,0x10,0xA3,0x00,0x21,0x00,0x00,0x21,0x04,0xFF,0xFF,0xD6,0x9A, -0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31, -0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31, -0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x84,0x31,0x94,0x93,0xFF,0xFF,0xA5,0x14, -0x00,0x42,0x00,0x00,0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x42,0x08, -0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD6,0x9A, -0x10,0x82,0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x42,0x08,0x42,0x08,0xFF,0xFF, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0xFF,0xFF,0x42,0x08,0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0x9E,0x21,0x04, -0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x26,0x00,0x00,0x42,0x08,0xFF,0xFF,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00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0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x42,0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00,0xFF,0xFF, +0xFF,0xFF,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42, +0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x42,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x42,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0xFF,0xFF,0xFF,0xFF, +0x00,0x42,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00,0x00,0x00, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0x00,0x42,0x00,0x00, }; const unsigned char gImage_UI0902_Volume_20x15[600] = { /* 20x15 RGB565 BE */ diff --git a/tools/gen_ui0902_assets.py b/tools/gen_ui0902_assets.py index 3c1d6d8..1fb6d28 100644 --- a/tools/gen_ui0902_assets.py +++ b/tools/gen_ui0902_assets.py @@ -82,15 +82,25 @@ def emit_c_array(lines, name, data, w, h): def make_battery_outline(): - """电池图标-10 -> outline only (interior fill removed; runtime draws level fill).""" + """电池图标-10 -> outline only (keep L/R walls; runtime draws level fill).""" im = Image.open(SRC / "02_顶部图标" / "电池图标-10.png").convert("RGBA") px = im.load() + w, h = im.size + # 旧 range(2,27) 会抹掉右侧壳壁,导致显示残缺 for y in range(2, 10): - for x in range(2, 27): + for x in range(3, 24): px[x, y] = (0, 0, 0, 0) + for y in range(h): + for x in range(w): + r, g, b, a = px[x, y] + if a >= 40 and (r + g + b) >= 60: + px[x, y] = (255, 255, 255, 255) + elif a < 40 or (r < 12 and g < 12 and b < 12): + px[x, y] = (0, 0, 0, 0) return im + def make_battery_fill(): """Solid white 22x9 level strip (do NOT use 电池电量 mockup — it embeds \"80%\" text).""" return Image.new("RGBA", (22, 9), (255, 255, 255, 255))