feat(ui): show charging battery icon when Type-C is plugged
Replace the status-bar outline+fill with the 0918 lightning battery bitmap while charging, and fix Pre-Build git version script UTF-8 decoding on Chinese Windows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fb64ada557
commit
fd58637e9d
|
|
@ -33,6 +33,10 @@ void UI_ExpertMode_Process(DisplayTaskMessage_Type msg)
|
|||
case MSG_ID_BATTERY_VALUE:
|
||||
Draw_Status_Battery_Icon(percentage);
|
||||
break;
|
||||
|
||||
case MSG_ID_CHARG:
|
||||
Show_Battery_Icon(msg.ID);
|
||||
break;
|
||||
|
||||
case MSG_ID_TAP_SPEED:
|
||||
// uint8_t last_value = mGuiData[GUI_SPEED].Current;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ void UI_FreeMode_Process(DisplayTaskMessage_Type msg)
|
|||
case MSG_ID_BATTERY_VALUE:
|
||||
Draw_Status_Battery_Icon(percentage);
|
||||
break;
|
||||
|
||||
case MSG_ID_CHARG:
|
||||
Show_Battery_Icon(msg.ID);
|
||||
break;
|
||||
|
||||
case MSG_ID_TAP_SPEED:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ void UI_SystemSet_Process(DisplayTaskMessage_Type msg)
|
|||
label_top();
|
||||
break;
|
||||
|
||||
case MSG_ID_CHARG:
|
||||
label_top();
|
||||
break;
|
||||
|
||||
case MSG_ID_EC_VOL:
|
||||
/* 主音量已在 MainTask 下发;此处只刷新状态栏音量条,保证与旋钮一致 */
|
||||
Draw_Volume_Bar(UI0902_VOL_X, UI0902_VOL_Y, msg.HiByte, 1, WHITE, GRAY);
|
||||
|
|
|
|||
|
|
@ -410,6 +410,10 @@ void Draw_Status_Battery_Icon(uint8_t battery_percent)
|
|||
uint16_t text_x;
|
||||
uint16_t text_y;
|
||||
uint16_t fill_x1, fill_y1, fill_x2, fill_y2;
|
||||
uint8_t charging = (usb_charging_state != 0) ? 1 : 0;
|
||||
uint16_t icon_w = charging ? UI0902_BATTERY_CHG_W : UI0902_BATTERY_W;
|
||||
uint16_t icon_h = charging ? UI0902_BATTERY_CHG_H : UI0902_BATTERY_H;
|
||||
uint16_t icon_y;
|
||||
uint8_t adv = UI0902_ASCII_W(UI0902_BATTERY_TEXT_SIZE);
|
||||
|
||||
if (battery_percent > 100)
|
||||
|
|
@ -419,9 +423,12 @@ void Draw_Status_Battery_Icon(uint8_t battery_percent)
|
|||
actual_w = (uint16_t)(strlen((char *)Info) * adv);
|
||||
/* 图标与百分比紧贴;整组右对齐。「100%」变位数时图标左移,不拉开字距 */
|
||||
max_w = (uint16_t)(4u * adv);
|
||||
group_w = (uint16_t)(UI0902_BATTERY_W + UI0902_BATTERY_TEXT_GAP + actual_w);
|
||||
group_w = (uint16_t)(icon_w + UI0902_BATTERY_TEXT_GAP + actual_w);
|
||||
bat_x = (uint16_t)(240 - UI0902_BATTERY_RIGHT_MARGIN - group_w);
|
||||
text_x = (uint16_t)(bat_x + UI0902_BATTERY_W + UI0902_BATTERY_TEXT_GAP);
|
||||
text_x = (uint16_t)(bat_x + icon_w + UI0902_BATTERY_TEXT_GAP);
|
||||
/* 充电图 13px 比普通外壳 12px 高 1px:同中心上提,保持与音量/蓝牙对齐 */
|
||||
icon_y = (uint16_t)(UI0902_BATTERY_Y
|
||||
+ ((int16_t)UI0902_BATTERY_H - (int16_t)icon_h) / 2);
|
||||
text_y = (uint16_t)(UI0902_BATTERY_Y
|
||||
+ ((int16_t)UI0902_BATTERY_H - (int16_t)UI0902_BATTERY_TEXT_SIZE) / 2);
|
||||
if ((int16_t)text_y < 0)
|
||||
|
|
@ -435,17 +442,23 @@ void Draw_Status_Battery_Icon(uint8_t battery_percent)
|
|||
clear_x = 0;
|
||||
LCD_FillByColor(clear_x, 0, 240, UI0902_STATUS_SEP_Y, UI0902_BG_COLOR);
|
||||
|
||||
/* 内腔约 y+2..y+9 / x+3..x+23;上下左右各留 1px,电量不贴外壳 */
|
||||
fill_w = (uint16_t)((19UL * battery_percent) / 100);
|
||||
if (fill_w > 0) {
|
||||
fill_x1 = (uint16_t)(bat_x + 4);
|
||||
fill_y1 = (uint16_t)(UI0902_BATTERY_Y + 3);
|
||||
fill_x2 = (uint16_t)(fill_x1 + fill_w);
|
||||
fill_y2 = (uint16_t)(fill_y1 + 6);
|
||||
LCD_FillByColor(fill_x1, fill_y1, fill_x2, fill_y2, WHITE);
|
||||
if (charging) {
|
||||
/* Type-C 插入:0918 闪电电池图,无电量填充,右侧仍显示百分比 */
|
||||
LCD_WR_PIC_Trans(bat_x, icon_y, UI0902_BATTERY_CHG_W, UI0902_BATTERY_CHG_H,
|
||||
gImage_UI0902_BatteryCharging_28x13, BLACK);
|
||||
} else {
|
||||
/* 内腔约 y+2..y+9 / x+3..x+23;上下左右各留 1px,电量不贴外壳 */
|
||||
fill_w = (uint16_t)((19UL * battery_percent) / 100);
|
||||
if (fill_w > 0) {
|
||||
fill_x1 = (uint16_t)(bat_x + 4);
|
||||
fill_y1 = (uint16_t)(UI0902_BATTERY_Y + 3);
|
||||
fill_x2 = (uint16_t)(fill_x1 + fill_w);
|
||||
fill_y2 = (uint16_t)(fill_y1 + 6);
|
||||
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,
|
||||
gImage_UI0902_BatteryOutline_29x12, BLACK);
|
||||
}
|
||||
LCD_WR_PIC_Trans(bat_x, UI0902_BATTERY_Y, UI0902_BATTERY_W, UI0902_BATTERY_H,
|
||||
gImage_UI0902_BatteryOutline_29x12, BLACK);
|
||||
LCD_ShowString(text_x, text_y, Info, WHITE, UI0902_BG_COLOR,
|
||||
UI0902_BATTERY_TEXT_SIZE, 0);
|
||||
UI_DrawStatusSepLine();
|
||||
|
|
@ -453,7 +466,7 @@ void Draw_Status_Battery_Icon(uint8_t battery_percent)
|
|||
|
||||
void Show_Battery_Icon(uint8_t flag)
|
||||
{
|
||||
(void)flag;
|
||||
(void)flag; /* 充电态由全局 usb_charging_state 决定(MSG_ID_CHARG 发送前已更新) */
|
||||
Draw_Status_Battery_Icon(percentage);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,9 @@ void CallUI_RestoreSelect(void);
|
|||
#define UI0902_BT_Y 5
|
||||
#define UI0902_BATTERY_W 29
|
||||
#define UI0902_BATTERY_H 12
|
||||
/* 0918 充电态:闪电电池图(替换外壳+填充),28x13,与外壳同中心 */
|
||||
#define UI0902_BATTERY_CHG_W 28
|
||||
#define UI0902_BATTERY_CHG_H 13
|
||||
/* 与音量/蓝牙大致居中后再下移 2px:12px 高 → 顶 y9 */
|
||||
#define UI0902_BATTERY_Y 9
|
||||
#define UI0902_BATTERY_RIGHT_MARGIN 6
|
||||
|
|
|
|||
|
|
@ -2095,3 +2095,52 @@ const unsigned char gImage_UI0902_Txt_Cancel_50x24[2400] = { /* 50x24 RGB565 BE
|
|||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
const unsigned char gImage_UI0902_BatteryCharging_28x13[728] = { /* 28x13 RGB565 BE */
|
||||
0x00,0x00,0x73,0x8E,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,
|
||||
0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,
|
||||
0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,
|
||||
0x73,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0xD6,0x9A,0xFF,0xFF,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,0xCE,0x59,0xC6,0x18,0xC6,0x18,0xC6,0x18,0xC6,0x18,
|
||||
0xC6,0x18,0xC6,0x18,0xC6,0x18,0xD6,0x9A,0xFF,0xFF,0xA5,0x14,0x00,0x00,0x00,0x00,
|
||||
0xFF,0xFF,0x73,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x0C,0xC6,0x18,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xA5,0x14,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x63,0x0C,0xFF,0xFF,0x73,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00,
|
||||
0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x14,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x42,0x08,0xFF,0xFF,0x94,0x92,0x00,0x00,0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x14,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x52,0x8A,0x42,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x08,0xFF,0xFF,0xFF,0xFF,0x73,0x8E,
|
||||
0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x73,0x8E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xD6,0x9A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x42,0x08,0xFF,0xFF,0xFF,0xFF,0x84,0x10,0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x08,
|
||||
0xB5,0x96,0xFF,0xFF,0xFF,0xFF,0xD6,0x9A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x08,0xFF,0xFF,0xFF,0xFF,0x73,0x8E,
|
||||
0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB5,0x96,0xFF,0xFF,0xD6,0x9A,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x42,0x08,0xFF,0xFF,0x73,0x8E,0x00,0x00,0xFF,0xFF,0x42,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xFF,0xFF,0xD6,0x9A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x08,0xFF,0xFF,0x00,0x00,0x00,0x00,
|
||||
0xFF,0xFF,0x73,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x8A,0xA5,0x14,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xA5,0x14,0xF7,0x9E,0x00,0x00,0x00,0x00,0xC6,0x18,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,0x94,0x92,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x52,0x8A,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,
|
||||
0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,
|
||||
0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x10,
|
||||
0x42,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ extern const unsigned char gImage_UI0902_BatteryOutline_29x12[];
|
|||
extern const unsigned char gImage_UI0902_Volume_20x15[600];
|
||||
extern const unsigned char gImage_UI0902_Bluetooth_11x17[374];
|
||||
extern const unsigned char gImage_UI0902_BatteryFill_22x9[396];
|
||||
extern const unsigned char gImage_UI0902_BatteryCharging_28x13[728];
|
||||
extern const unsigned char gImage_UI0902_TabSetting_Sel_40x32[2560];
|
||||
extern const unsigned char gImage_UI0902_TabSetting_Not_40x32[2560];
|
||||
extern const unsigned char gImage_UI0902_TabMixer_Sel_40x32[2560];
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/* Auto-generated by tools/gen_git_user_fw_ver.py — do not edit.
|
||||
* git HEAD (dirty): e721c8e67c33fe089bc5a69be522303dda548e3b
|
||||
* git HEAD (dirty): fb64ada5573e4b301b1ee9ad2b0942fbf753485f
|
||||
* branch: develop → develop
|
||||
* 01 0C wire: develop_e721c8*
|
||||
* 01 0C wire: develop_fb64ad*
|
||||
*/
|
||||
#ifndef GIT_USER_FW_VER_H
|
||||
#define GIT_USER_FW_VER_H
|
||||
|
||||
#define GIT_COMMIT_ID_FULL "e721c8e67c33fe089bc5a69be522303dda548e3b"
|
||||
#define GIT_COMMIT_ID_FULL "fb64ada5573e4b301b1ee9ad2b0942fbf753485f"
|
||||
#define GIT_BRANCH_NAME "develop"
|
||||
#define GIT_COMMIT_SHORT6 "e721c8"
|
||||
#define GIT_COMMIT_SHORT6 "fb64ad"
|
||||
#define GIT_DIRTY (1)
|
||||
#define GIT_BUILD_ID "develop_e721c8*"
|
||||
#define GIT_BUILD_ID "develop_fb64ad*"
|
||||
#define GIT_BUILD_ID_LEN 15u
|
||||
|
||||
#endif /* GIT_USER_FW_VER_H */
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 310 B |
|
|
@ -29,6 +29,8 @@ def _git(*args: str) -> str | None:
|
|||
cwd=ROOT,
|
||||
stderr=subprocess.DEVNULL,
|
||||
text=True,
|
||||
encoding="utf-8", # git 输出 UTF-8;中文 Windows 默认 GBK 会在中文文件名上解码崩溃
|
||||
errors="replace",
|
||||
).strip()
|
||||
except (subprocess.CalledProcessError, FileNotFoundError, OSError):
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ def make_cancel_button():
|
|||
INTERNAL = [
|
||||
("gImage_UI0902_Volume_20x15", "02_顶部图标/音量图标-10.png"),
|
||||
("gImage_UI0902_Bluetooth_11x17", "02_顶部图标/蓝牙图标-10.png"),
|
||||
("gImage_UI0902_BatteryCharging_28x13", "02_顶部图标/电池图标-充电状态-0918.png"), # 0918 充电闪电电池
|
||||
# BatteryFill generated by make_battery_fill() — not from mockup PNG
|
||||
("gImage_UI0902_TabSetting_Sel_40x32", "03_底部图标/底部图标-10.png"), # 万能白
|
||||
("gImage_UI0902_TabSetting_Not_40x32", "03_底部图标/底部图标-11.png"), # 普通白
|
||||
|
|
|
|||
Loading…
Reference in New Issue