|
|
@@ -6,7 +6,8 @@
|
|
|
* @note 点击"开始预热"确认框的 Yes 后进入: 全屏不透明覆盖, 隐藏状态栏/
|
|
|
* 菜单/内容区; 左 3/4 为 CPU0 / CPU1 两张温度卡片 (各 2 个腔体,
|
|
|
* 每腔体显示其 2 路 CT7428 sensor 的均温, 不是单路 sensor 值);
|
|
|
- * 右 1/4 为加热动画 + 已加热时长; 底部红色 cancel 返回温度设置页。
|
|
|
+ * 宏开(屏端可控制): 左 3/4 卡片 + 右 1/4 动画窄柱, 底部红色 cancel 回实时温度页;
|
|
|
+ * 宏关(只显示): 卡片占满全宽, 动画改为底部一条横带 (spinner + 加热中..., 居中)。
|
|
|
******************************************************************************
|
|
|
*/
|
|
|
#include <stdio.h>
|
|
|
@@ -27,19 +28,34 @@
|
|
|
#define UI_PRE_CARD_X 16
|
|
|
#define UI_PRE_CARD_Y0 56
|
|
|
#define UI_PRE_CARD_GAP 12
|
|
|
-#define UI_PRE_CARD_W (UI_PRE_TEMPS_W - 32)
|
|
|
#define UI_PRE_CARD_H 150
|
|
|
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
+/* 宏开: 左 3/4 放卡片, 右 1/4 是动画窄柱 (与卡片同高) */
|
|
|
+#define UI_PRE_CARD_W (UI_PRE_TEMPS_W - 32)
|
|
|
+#define UI_PRE_ANIM_X (UI_PRE_TEMPS_W + 16)
|
|
|
+#define UI_PRE_ANIM_Y UI_PRE_CARD_Y0
|
|
|
+#define UI_PRE_ANIM_W (LV_HOR_RES - UI_PRE_ANIM_X - 16)
|
|
|
+#define UI_PRE_ANIM_H (UI_PRE_CARD_H * 2 + UI_PRE_CARD_GAP)
|
|
|
+#define UI_PRE_SPIN_D 120
|
|
|
+#else
|
|
|
+/* 宏关: 卡片占满全宽; 动画改成底部一条横带 (原 cancel 的位置),
|
|
|
+ * 否则底部会空出 112px、右侧 128 宽的窄柱也会显得空 */
|
|
|
+#define UI_PRE_CARD_W (UI_PRE_W - 32)
|
|
|
+#define UI_PRE_ANIM_X 16
|
|
|
+#define UI_PRE_ANIM_Y (UI_PRE_CARD_Y0 + UI_PRE_CARD_H * 2 + UI_PRE_CARD_GAP + 8)
|
|
|
+#define UI_PRE_ANIM_W (UI_PRE_W - 32)
|
|
|
+#define UI_PRE_ANIM_H 88
|
|
|
+#define UI_PRE_SPIN_D 60
|
|
|
+#endif
|
|
|
+
|
|
|
/* 卡片内行布局 */
|
|
|
#define UI_PRE_ROW_Y0 46
|
|
|
#define UI_PRE_ROW_GAP 52
|
|
|
#define UI_PRE_ROW_LINE_Y (UI_PRE_ROW_Y0 + UI_PRE_ROW_GAP - 18) /* 行间分隔线 */
|
|
|
|
|
|
-/* 右 1/4 加热动画面板 (与卡片同高) */
|
|
|
-#define UI_PRE_ANIM_X (UI_PRE_TEMPS_W + 16)
|
|
|
-#define UI_PRE_ANIM_W (LV_HOR_RES - UI_PRE_ANIM_X - 16)
|
|
|
-#define UI_PRE_ANIM_H (UI_PRE_CARD_H * 2 + UI_PRE_CARD_GAP)
|
|
|
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
/* 底部 cancel 按钮 */
|
|
|
#define UI_PRE_CANCEL_W 200
|
|
|
#define UI_PRE_CANCEL_H 48
|
|
|
@@ -47,6 +63,7 @@
|
|
|
/* 右侧面板底部 skip 按钮 (跳过预热, 直接 PID 控温) */
|
|
|
#define UI_PRE_SKIP_W 140
|
|
|
#define UI_PRE_SKIP_H 48
|
|
|
+#endif
|
|
|
|
|
|
/* BMC 未就绪提示弹窗宽度 (与其它页弹窗同宽) */
|
|
|
#define UI_PRE_MBOX_W 420
|
|
|
@@ -61,13 +78,16 @@
|
|
|
/*-------------------------------- 句柄 ---------------------------------*/
|
|
|
static lv_obj_t * s_pre_root = NULL; /* 全屏页面根 */
|
|
|
static lv_timer_t * s_pre_timer = NULL; /* 刷新定时器 */
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
static lv_obj_t * s_nr_mbox = NULL; /* BMC 未就绪提示弹窗 */
|
|
|
+#endif
|
|
|
static uint8_t s_page_closed = 0; /* 已由 UI 指定目标页并关闭 */
|
|
|
static lv_obj_t * s_pre_value[LOGIC_PREHEAT_TEMP_NUM];/* 4 路温度值 */
|
|
|
static char s_pre_buf[LOGIC_PREHEAT_TEMP_NUM][12];
|
|
|
static int8_t s_pre_last[LOGIC_PREHEAT_TEMP_NUM]; /* 上周期已显示的值 */
|
|
|
static uint8_t s_pre_valid = 0; /* 缓存是否已初始化 */
|
|
|
|
|
|
+
|
|
|
/*----------------------------- 静态函数 ------------------------------*/
|
|
|
|
|
|
/* 刷新 4 路温度数值 */
|
|
|
@@ -99,6 +119,7 @@ static void ui_preheat_refresh(void)
|
|
|
}
|
|
|
lv_label_set_text_static(s_pre_value[i], s_pre_buf[i]);
|
|
|
}
|
|
|
+
|
|
|
s_pre_valid = 1;
|
|
|
}
|
|
|
|
|
|
@@ -118,14 +139,17 @@ static void ui_preheat_delete_cb(lv_event_t * e)
|
|
|
lv_timer_del(s_pre_timer);
|
|
|
s_pre_timer = NULL;
|
|
|
}
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
if (s_nr_mbox != NULL)
|
|
|
{
|
|
|
lv_msgbox_close(s_nr_mbox); /* 自动删除全屏遮罩 */
|
|
|
s_nr_mbox = NULL;
|
|
|
}
|
|
|
+#endif
|
|
|
s_pre_root = NULL;
|
|
|
}
|
|
|
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
/* cancel 按钮: 必须在按钮范围内抬手才退出 (手指移出后抬起不生效) */
|
|
|
static void ui_preheat_cancel_cb(lv_event_t * e)
|
|
|
{
|
|
|
@@ -212,6 +236,7 @@ static void ui_preheat_skip_cb(lv_event_t * e)
|
|
|
cmd.target = (int16_t)Com_parameter_get_target();
|
|
|
App_preheat_send_cmd(&cmd);
|
|
|
}
|
|
|
+#endif /* UI_LOCAL_CTRL_ENABLE */
|
|
|
|
|
|
/* 构建一张温度卡片 (CPU0/CPU1, 各含 2 个腔体温度, 每腔体 = 2 路 sensor 均温) */
|
|
|
static void ui_preheat_build_card(lv_obj_t * root, const char * cpu_name,
|
|
|
@@ -406,6 +431,7 @@ void Ui_preheat_enter(void)
|
|
|
ui_preheat_build_card(root, "CPU0", 0, UI_PRE_CARD_Y0);
|
|
|
ui_preheat_build_card(root, "CPU1", 2, UI_PRE_CARD_Y0 + UI_PRE_CARD_H + UI_PRE_CARD_GAP);
|
|
|
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
/* 底部红色 cancel 按钮 (整屏水平居中) */
|
|
|
lv_obj_t * cancel = lv_btn_create(root);
|
|
|
lv_obj_set_size(cancel, UI_PRE_CANCEL_W, UI_PRE_CANCEL_H);
|
|
|
@@ -417,13 +443,16 @@ void Ui_preheat_enter(void)
|
|
|
lv_obj_set_style_text_font(cl, UI_FONT_TITLE, LV_STATE_DEFAULT);
|
|
|
lv_obj_set_style_text_color(cl, UI_CLR_ERR, LV_STATE_DEFAULT);
|
|
|
lv_obj_center(cl);
|
|
|
+#endif /* UI_LOCAL_CTRL_ENABLE */
|
|
|
|
|
|
/* 右 1/4: 加热动画面板 (标题 + spinner) */
|
|
|
lv_obj_t * panel = lv_obj_create(root);
|
|
|
- lv_obj_set_pos(panel, UI_PRE_ANIM_X, UI_PRE_CARD_Y0);
|
|
|
+ lv_obj_set_pos(panel, UI_PRE_ANIM_X, UI_PRE_ANIM_Y);
|
|
|
lv_obj_set_size(panel, UI_PRE_ANIM_W, UI_PRE_ANIM_H);
|
|
|
Ui_theme_style_panel(panel);
|
|
|
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
+ /* 窄柱: 标题在上, 大 spinner 居中 */
|
|
|
lv_obj_t * head = lv_label_create(panel);
|
|
|
lv_label_set_text(head, "加热中...");
|
|
|
lv_obj_set_style_text_font(head, UI_FONT_TITLE, LV_STATE_DEFAULT);
|
|
|
@@ -431,13 +460,34 @@ void Ui_preheat_enter(void)
|
|
|
lv_obj_align(head, LV_ALIGN_TOP_MID, 0, 24);
|
|
|
|
|
|
lv_obj_t * spin = lv_spinner_create(panel, 1000, 70);
|
|
|
- lv_obj_set_size(spin, 120, 120);
|
|
|
+ lv_obj_set_size(spin, UI_PRE_SPIN_D, UI_PRE_SPIN_D);
|
|
|
lv_obj_set_style_arc_width(spin, 8, LV_PART_MAIN | LV_STATE_DEFAULT);
|
|
|
lv_obj_set_style_arc_color(spin, UI_CLR_PANEL_HI, LV_PART_MAIN | LV_STATE_DEFAULT);
|
|
|
lv_obj_set_style_arc_width(spin, 8, LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
|
|
lv_obj_set_style_arc_color(spin, UI_CLR_ACCENT, LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
|
|
lv_obj_align(spin, LV_ALIGN_CENTER, 0, 0);
|
|
|
+#else
|
|
|
+ /* 横带: spinner 靠左, 右侧两行文字, 目标温度贴右缘 */
|
|
|
+ lv_obj_set_style_pad_all(panel, 0, LV_STATE_DEFAULT);
|
|
|
+
|
|
|
+ lv_obj_t * spin = lv_spinner_create(panel, 1000, 70);
|
|
|
+ lv_obj_set_size(spin, UI_PRE_SPIN_D, UI_PRE_SPIN_D);
|
|
|
+ lv_obj_set_style_arc_width(spin, 6, LV_PART_MAIN | LV_STATE_DEFAULT);
|
|
|
+ lv_obj_set_style_arc_color(spin, UI_CLR_PANEL_HI, LV_PART_MAIN | LV_STATE_DEFAULT);
|
|
|
+ lv_obj_set_style_arc_width(spin, 6, LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
|
|
+ lv_obj_set_style_arc_color(spin, UI_CLR_ACCENT, LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
|
|
+ lv_obj_align(spin, LV_ALIGN_CENTER, -70, 0);
|
|
|
+
|
|
|
+ /* 只放"加热中..." —— 中文字库是子集(my_font_cn_16/20 只含用到的字),
|
|
|
+ * 新加的字(如"最高腔温")不在字库里会显示成空白, 所以横带不再放其它文字 */
|
|
|
+ lv_obj_t * head = lv_label_create(panel);
|
|
|
+ lv_label_set_text(head, "加热中...");
|
|
|
+ lv_obj_set_style_text_font(head, UI_FONT_TITLE, LV_STATE_DEFAULT);
|
|
|
+ lv_obj_set_style_text_color(head, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
+ lv_obj_align(head, LV_ALIGN_CENTER, 50, 0);
|
|
|
+#endif
|
|
|
|
|
|
+#if UI_LOCAL_CTRL_ENABLE
|
|
|
/* Skip 按钮: 跳过预热, 直接进入 PID 控温 */
|
|
|
lv_obj_t * skip = lv_btn_create(panel);
|
|
|
lv_obj_set_size(skip, UI_PRE_SKIP_W, UI_PRE_SKIP_H);
|
|
|
@@ -449,6 +499,7 @@ void Ui_preheat_enter(void)
|
|
|
lv_obj_set_style_text_font(sl, UI_FONT_TITLE, LV_STATE_DEFAULT);
|
|
|
lv_obj_set_style_text_color(sl, UI_CLR_ACCENT_DARK, LV_STATE_DEFAULT);
|
|
|
lv_obj_center(sl);
|
|
|
+#endif /* UI_LOCAL_CTRL_ENABLE */
|
|
|
|
|
|
s_pre_valid = 0; /* 新建页面: 标签是全新的, 必须强制刷一次 */
|
|
|
ui_preheat_refresh();
|