feat: refine remote states and PRTS LCD refresh

- add remote NOT_READY/READY/PROTECT state flow and matching LED/status display

- speed up TFT hardware SPI DMA flush path and larger LVGL partial refresh buffer

- reduce page/menu redraw artifacts and center the PRTS status title
This commit is contained in:
TuxMonkey
2026-07-21 00:40:01 +08:00
parent 8671f84139
commit dc57b5152e
10 changed files with 230 additions and 67 deletions

View File

@@ -21,9 +21,12 @@
#define PRTS_CARD_H 140
#define PRTS_CARD_GAP 15
#define PRTS_CARD_PAD_HOR 75
#define PRTS_DOT_SIZE_NORMAL 8
#define PRTS_DOT_SIZE_ACTIVE 12
#define PRTS_DOT_SIZE_NORMAL 10
#define PRTS_DOT_SIZE_ACTIVE 10
#define PRTS_MENU_CARD_COUNT 3U
#define PRTS_STATUS_BRAND_X 18
#define PRTS_STATUS_BRAND_W 54
#define PRTS_STATUS_TITLE_W 130
#define PRTS_VALUE_PANEL_WIDTH 228
#define PRTS_VALUE_PANEL_HEIGHT 34
@@ -33,7 +36,7 @@
#define PRTS_JOY_DEBOUNCE_MS 25U
#define PRTS_JOY_LONG_PRESS_MS 700U
#define PRTS_MONITOR_UPDATE_MS 150U
#define PRTS_SCREEN_ANIM_MS 140U
#define PRTS_SCREEN_ANIM_MS 0U
typedef enum
{
@@ -174,8 +177,12 @@ static const char *prts_robot_mode_text(RobotMode_t mode)
return "ERROR";
case REMOTE_NOT_CONNECTED:
return "REMOTE OFF";
case REMOTE_CONNECTED:
return "REMOTE ON";
case REMOTE_NOT_READY:
return "NOT READY";
case REMOTE_READY:
return "READY";
case REMOTE_PROTECT:
return "PROTECT";
case AUTO_SHOOTING_MODE:
return "AUTO SHOOT";
case IMU_CALIBERATION_MODE:
@@ -194,7 +201,11 @@ static lv_color_t prts_robot_mode_color(RobotMode_t mode)
case SYS_ERROR_OCCURRED:
case REMOTE_NOT_CONNECTED:
return lv_color_hex(0xFF4D4F);
case REMOTE_CONNECTED:
case REMOTE_NOT_READY:
return lv_color_hex(0xEDEDED);
case REMOTE_READY:
return lv_color_hex(0xC678FF);
case REMOTE_PROTECT:
return lv_color_hex(0xFFD666);
case AUTO_SHOOTING_MODE:
return lv_color_hex(0x40C4FF);
@@ -212,7 +223,11 @@ static lv_color_t prts_robot_mode_text_color(RobotMode_t mode)
case SYS_ERROR_OCCURRED:
case REMOTE_NOT_CONNECTED:
return lv_color_hex(0xFFE2E2);
case REMOTE_CONNECTED:
case REMOTE_NOT_READY:
return lv_color_hex(0xFFFFFF);
case REMOTE_READY:
return lv_color_hex(0xF5E6FF);
case REMOTE_PROTECT:
return lv_color_hex(0xFFF3C4);
default:
return lv_color_hex(0xFFFFFF);
@@ -338,9 +353,6 @@ static void prts_init_styles(void)
LV_STYLE_BG_COLOR,
LV_STYLE_BORDER_COLOR,
LV_STYLE_BORDER_WIDTH,
LV_STYLE_TRANSFORM_WIDTH,
LV_STYLE_TRANSFORM_HEIGHT,
LV_STYLE_SHADOW_OPA,
0
};
@@ -373,8 +385,8 @@ static void prts_init_styles(void)
lv_style_set_bg_color(&prts_style_card_focused, lv_color_hex(0x3A3A3C));
lv_style_set_border_color(&prts_style_card_focused, lv_color_hex(0x0A84FF));
lv_style_set_border_width(&prts_style_card_focused, 2);
lv_style_set_transform_width(&prts_style_card_focused, 4);
lv_style_set_transform_height(&prts_style_card_focused, 3);
lv_style_set_transform_width(&prts_style_card_focused, 0);
lv_style_set_transform_height(&prts_style_card_focused, 0);
lv_style_set_shadow_width(&prts_style_card_focused, 0);
lv_style_set_shadow_color(&prts_style_card_focused, lv_color_hex(0x0A84FF));
lv_style_set_shadow_opa(&prts_style_card_focused, LV_OPA_0);
@@ -449,13 +461,16 @@ static lv_obj_t *prts_create_status_bar(lv_obj_t *parent, const char *title_text
brand = lv_label_create(bar);
lv_label_set_text(brand, "PRTS");
prts_style_label(brand, lv_color_hex(0x6EE7F9));
lv_obj_set_pos(brand, 10, 6);
lv_obj_set_pos(brand, PRTS_STATUS_BRAND_X, 6);
lv_obj_set_size(brand, PRTS_STATUS_BRAND_W, 18);
lv_obj_set_style_text_align(brand, LV_TEXT_ALIGN_CENTER, 0);
title = lv_label_create(bar);
lv_label_set_text(title, title_text);
prts_style_label(title, lv_color_hex(0xEBEBF5));
lv_obj_set_pos(title, 74, 6);
lv_obj_set_size(title, 130, 18);
lv_obj_set_pos(title, (PRTS_SCREEN_W - PRTS_STATUS_TITLE_W) / 2, 6);
lv_obj_set_size(title, PRTS_STATUS_TITLE_W, 18);
lv_obj_set_style_text_align(title, LV_TEXT_ALIGN_CENTER, 0);
if (parent == prts_main_screen)
{
@@ -605,7 +620,7 @@ static void prts_page_key_event_cb(lv_event_t *e)
if (lv_event_get_key(e) == LV_KEY_ESC)
{
prts_show_page(PRTS_PAGE_MAIN, LV_SCREEN_LOAD_ANIM_OVER_RIGHT);
prts_show_page(PRTS_PAGE_MAIN, LV_SCREEN_LOAD_ANIM_NONE);
}
}
@@ -629,7 +644,7 @@ static void prts_card_event_cb(lv_event_t *e)
else if (code == LV_EVENT_CLICKED)
{
prts_current_card = (uint8_t) index;
prts_show_page(prts_menu_cards_data[index].page, LV_SCREEN_LOAD_ANIM_OVER_LEFT);
prts_show_page(prts_menu_cards_data[index].page, LV_SCREEN_LOAD_ANIM_NONE);
}
}