|
@@ -2,10 +2,18 @@
|
|
|
******************************************************************************
|
|
******************************************************************************
|
|
|
* @file Ui_temp_setting.c
|
|
* @file Ui_temp_setting.c
|
|
|
* @brief 温度设置页面 (UI 页面层)
|
|
* @brief 温度设置页面 (UI 页面层)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note 目标温度支持两种调节方式:
|
|
|
|
|
+ * 1. 数值输入框点击弹出数字键盘直接输入;
|
|
|
|
|
+ * 2. "-"/"+" 按钮步进调节 (长按自动加速重复, 每次新按下周期复位)。
|
|
|
|
|
+ * Apply 应用设置并弹出"保存成功"弹窗 (点击 OK 或弹窗外区域关闭);
|
|
|
|
|
+ * Start preheating 弹窗确认预热 (Yes/No 都关闭返回, 后期接入控制逻辑)。
|
|
|
******************************************************************************
|
|
******************************************************************************
|
|
|
*/
|
|
*/
|
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
|
|
|
+#include <stdlib.h>
|
|
|
#include "Ui_temp_setting.h"
|
|
#include "Ui_temp_setting.h"
|
|
|
|
|
+#include "Ui.h"
|
|
|
#include "Ui_theme.h"
|
|
#include "Ui_theme.h"
|
|
|
|
|
|
|
|
/* 目标温度范围 */
|
|
/* 目标温度范围 */
|
|
@@ -13,91 +21,116 @@
|
|
|
#define UI_TSET_MAX 90
|
|
#define UI_TSET_MAX 90
|
|
|
#define UI_TSET_STEP 1
|
|
#define UI_TSET_STEP 1
|
|
|
|
|
|
|
|
-/* 长按自动重复参数 */
|
|
|
|
|
|
|
+/* 长按自动重复参数 (按钮调节) */
|
|
|
#define UI_TSET_T0 400 /* 首次重复周期 (ms) */
|
|
#define UI_TSET_T0 400 /* 首次重复周期 (ms) */
|
|
|
#define UI_TSET_TMIN 40 /* 最快重复周期 (ms) */
|
|
#define UI_TSET_TMIN 40 /* 最快重复周期 (ms) */
|
|
|
#define UI_TSET_TDEC 25 /* 每次重复周期缩短量 (ms) */
|
|
#define UI_TSET_TDEC 25 /* 每次重复周期缩短量 (ms) */
|
|
|
#define UI_TSET_ACC_N 6 /* 每 N 次重复, 步进 +1 */
|
|
#define UI_TSET_ACC_N 6 /* 每 N 次重复, 步进 +1 */
|
|
|
#define UI_TSET_MAXSTEP 5 /* 最大单次步进 */
|
|
#define UI_TSET_MAXSTEP 5 /* 最大单次步进 */
|
|
|
|
|
|
|
|
-/* 行卡片位置 */
|
|
|
|
|
-#define UI_TSET_CARD_X 10
|
|
|
|
|
-#define UI_TSET_CARD_W 590
|
|
|
|
|
-#define UI_TSET_CARD_H 66
|
|
|
|
|
-#define UI_TSET_CARD_GAP 70 /* 卡片起始 y 间距 (CPU0:64, CPU1:134) */
|
|
|
|
|
-
|
|
|
|
|
-/* 行内坐标 (相对卡片) */
|
|
|
|
|
-#define UI_TSET_LABEL_X 16
|
|
|
|
|
-#define UI_TSET_LABEL_Y 20
|
|
|
|
|
-#define UI_TSET_BTN_Y 12
|
|
|
|
|
-#define UI_TSET_BTN_SIZE 48 /* 宽 */
|
|
|
|
|
-#define UI_TSET_BTN_H 42
|
|
|
|
|
-/* 递减/数值条/递增 以 x=320 为轴左右对称 (按钮宽 48, 数值条宽 90, 间距 16) */
|
|
|
|
|
-#define UI_TSET_BTN_MINUS_X 211
|
|
|
|
|
-#define UI_TSET_VAL_CHIP_X 275
|
|
|
|
|
-#define UI_TSET_VAL_CHIP_W 90
|
|
|
|
|
-#define UI_TSET_BTN_PLUS_X 381
|
|
|
|
|
-
|
|
|
|
|
-/* 按钮区域 */
|
|
|
|
|
-#define UI_TSET_APPLY_X 20
|
|
|
|
|
|
|
+/* 内容区可见范围 x=170~800, 中心相对页面为 315 */
|
|
|
|
|
+#define UI_TSET_CX 315
|
|
|
|
|
+
|
|
|
|
|
+/* 目标温度卡片 (水平居中) */
|
|
|
|
|
+#define UI_TSET_CARD_X 35 /* (UI_TSET_CX - 560/2) */
|
|
|
|
|
+#define UI_TSET_CARD_Y 56
|
|
|
|
|
+#define UI_TSET_CARD_W 560
|
|
|
|
|
+#define UI_TSET_CARD_H 150
|
|
|
|
|
+
|
|
|
|
|
+/* 卡片内控件坐标 (相对卡片, 控件行水平居中) */
|
|
|
|
|
+#define UI_TSET_LABEL_Y 16
|
|
|
|
|
+#define UI_TSET_STEP_Y 46
|
|
|
|
|
+#define UI_TSET_STEP_W 56
|
|
|
|
|
+#define UI_TSET_STEP_H 56
|
|
|
|
|
+#define UI_TSET_BTN_MINUS_X 149
|
|
|
|
|
+#define UI_TSET_VAL_X 215
|
|
|
|
|
+#define UI_TSET_VAL_Y 46
|
|
|
|
|
+#define UI_TSET_VAL_W 130 /* 宽度保持原值 */
|
|
|
|
|
+#define UI_TSET_VAL_H 56 /* 高度与加减号按钮一致 */
|
|
|
|
|
+#define UI_TSET_BTN_PLUS_X 355
|
|
|
|
|
+
|
|
|
|
|
+/* 底部按钮行 (水平居中) */
|
|
|
|
|
+#define UI_TSET_APPLY_X 132
|
|
|
#define UI_TSET_APPLY_Y 240
|
|
#define UI_TSET_APPLY_Y 240
|
|
|
-#define UI_TSET_HINT_X 170
|
|
|
|
|
-#define UI_TSET_HINT_Y 242
|
|
|
|
|
|
|
+#define UI_TSET_APPLY_W 140
|
|
|
|
|
+#define UI_TSET_PREHEAT_X 288
|
|
|
|
|
+#define UI_TSET_PREHEAT_W 210
|
|
|
|
|
+#define UI_TSET_BTN_H 44
|
|
|
|
|
|
|
|
-/* 全局句柄 */
|
|
|
|
|
-static int16_t s_target_cpu0 = 60; /* CPU0 目标温度 (假数据) */
|
|
|
|
|
-static int16_t s_target_cpu1 = 60; /* CPU1 目标温度 (假数据) */
|
|
|
|
|
-static lv_obj_t * s_val_cpu0 = NULL; /* CPU0 数值标签 */
|
|
|
|
|
-static lv_obj_t * s_val_cpu1 = NULL; /* CPU1 数值标签 */
|
|
|
|
|
-static lv_timer_t * s_repeat_timer = NULL; /* 长按重复定时器 */
|
|
|
|
|
-static uint8_t s_active = 0xFF; /* 当前激活按键: 0xFF=无, 否则 (which<<1)|dirBit */
|
|
|
|
|
-static uint8_t s_repeat = 0; /* 已重复次数 */
|
|
|
|
|
|
|
+/* 弹窗宽度 (预热确认框与保存成功弹窗同尺寸, 适配 4.3 寸 800x480) */
|
|
|
|
|
+#define UI_TSET_MBOX_W 420
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 刷新 CPU0 / CPU1 的目标温度数值显示
|
|
|
|
|
- */
|
|
|
|
|
|
|
+/* 内容区 (菜单右侧) 可见中心: x 170~800, y 44~480 => (485, 262) */
|
|
|
|
|
+#define UI_TSET_CONTENT_CX 485
|
|
|
|
|
+#define UI_TSET_CONTENT_CY 262
|
|
|
|
|
+
|
|
|
|
|
+/* 全局句柄 */
|
|
|
|
|
+static int16_t s_target = 60; /* 目标温度 (假数据) */
|
|
|
|
|
+static lv_obj_t * s_ta = NULL; /* 目标温度数值输入框 */
|
|
|
|
|
+static lv_obj_t * s_kb = NULL; /* 数字键盘 (弹出时有效) */
|
|
|
|
|
+static lv_obj_t * s_msgbox = NULL; /* 预热确认弹窗 (弹出时有效) */
|
|
|
|
|
+static lv_obj_t * s_saved = NULL; /* 保存成功弹窗 (弹出时有效) */
|
|
|
|
|
+static lv_timer_t * s_repeat_timer = NULL; /* 长按重复定时器 */
|
|
|
|
|
+static uint8_t s_active = 0xFF; /* 当前激活按键: 0xFF=无, 0=递减, 1=递增 */
|
|
|
|
|
+static uint8_t s_repeat = 0; /* 已重复次数 */
|
|
|
|
|
+
|
|
|
|
|
+/* 刷新目标温度数值显示 */
|
|
|
static void ui_tset_refresh(void)
|
|
static void ui_tset_refresh(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (s_ta == NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
char buf[16];
|
|
char buf[16];
|
|
|
- snprintf(buf, sizeof(buf), "%d", (int)s_target_cpu0);
|
|
|
|
|
- lv_label_set_text(s_val_cpu0, buf);
|
|
|
|
|
|
|
+ snprintf(buf, sizeof(buf), "%d", (int)s_target);
|
|
|
|
|
+ lv_textarea_set_text(s_ta, buf);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- snprintf(buf, sizeof(buf), "%d", (int)s_target_cpu1);
|
|
|
|
|
- lv_label_set_text(s_val_cpu1, buf);
|
|
|
|
|
|
|
+/* 应用键盘输入: 解析并限制范围 */
|
|
|
|
|
+static void ui_tset_apply_kb_input(void)
|
|
|
|
|
+{
|
|
|
|
|
+ if (s_ta == NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const char * txt = lv_textarea_get_text(s_ta);
|
|
|
|
|
+ if (txt == NULL || txt[0] == '\0')
|
|
|
|
|
+ {
|
|
|
|
|
+ ui_tset_refresh(); /* 空输入: 恢复原值 */
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ int v = atoi(txt);
|
|
|
|
|
+ if (v < UI_TSET_MIN) { v = UI_TSET_MIN; }
|
|
|
|
|
+ if (v > UI_TSET_MAX) { v = UI_TSET_MAX; }
|
|
|
|
|
+ s_target = (int16_t)v;
|
|
|
|
|
+ ui_tset_refresh();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 对指定 CPU 的目标温度执行一次步进并限制范围
|
|
|
|
|
- * @param delta : 步进增量 (可为负)
|
|
|
|
|
- * @param which : 0=CPU0, 1=CPU1
|
|
|
|
|
- */
|
|
|
|
|
-static void ui_tset_step(int delta, int which)
|
|
|
|
|
|
|
+/* 步进一次目标温度并限制范围 */
|
|
|
|
|
+static void ui_tset_step(int delta)
|
|
|
{
|
|
{
|
|
|
- int16_t * target = (which == 0) ? &s_target_cpu0 : &s_target_cpu1;
|
|
|
|
|
- int16_t v = (int16_t)(*target + delta);
|
|
|
|
|
|
|
+ /* 先同步键盘中未提交的输入, 再以当前值步进 */
|
|
|
|
|
+ ui_tset_apply_kb_input();
|
|
|
|
|
+ int16_t v = (int16_t)(s_target + delta);
|
|
|
if (v < UI_TSET_MIN) { v = UI_TSET_MIN; }
|
|
if (v < UI_TSET_MIN) { v = UI_TSET_MIN; }
|
|
|
if (v > UI_TSET_MAX) { v = UI_TSET_MAX; }
|
|
if (v > UI_TSET_MAX) { v = UI_TSET_MAX; }
|
|
|
- *target = v;
|
|
|
|
|
|
|
+ s_target = v;
|
|
|
ui_tset_refresh();
|
|
ui_tset_refresh();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 长按重复定时器回调: 执行步进并加速
|
|
|
|
|
- */
|
|
|
|
|
|
|
+/* 长按重复定时器回调: 步进并加速 */
|
|
|
static void ui_tset_repeat_timer_cb(lv_timer_t * t)
|
|
static void ui_tset_repeat_timer_cb(lv_timer_t * t)
|
|
|
{
|
|
{
|
|
|
- if (s_active == 0xFF)
|
|
|
|
|
|
|
+ if (s_active == 0xFF || s_ta == NULL)
|
|
|
{
|
|
{
|
|
|
|
|
+ s_active = 0xFF; /* 防御: 页面已销毁 */
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- int which = (int)(s_active >> 1);
|
|
|
|
|
- int dir = ((s_active & 1) ? 1 : -1);
|
|
|
|
|
-
|
|
|
|
|
- /* 步进随重复次数增大 (变化越来越快) */
|
|
|
|
|
|
|
+ int dir = (s_active == 1) ? 1 : -1;
|
|
|
int step = UI_TSET_STEP + (int)(s_repeat / UI_TSET_ACC_N);
|
|
int step = UI_TSET_STEP + (int)(s_repeat / UI_TSET_ACC_N);
|
|
|
if (step > UI_TSET_MAXSTEP) { step = UI_TSET_MAXSTEP; }
|
|
if (step > UI_TSET_MAXSTEP) { step = UI_TSET_MAXSTEP; }
|
|
|
- ui_tset_step(dir * step, which);
|
|
|
|
|
|
|
+ ui_tset_step(dir * step);
|
|
|
|
|
|
|
|
s_repeat++;
|
|
s_repeat++;
|
|
|
|
|
|
|
@@ -107,18 +140,14 @@ static void ui_tset_repeat_timer_cb(lv_timer_t * t)
|
|
|
lv_timer_set_period(t, p);
|
|
lv_timer_set_period(t, p);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 按下按钮: 立即步进一次并启动长按自动重复
|
|
|
|
|
- * @param which : 0=CPU0, 1=CPU1
|
|
|
|
|
- * @param dir : +1 递增, -1 递减
|
|
|
|
|
- */
|
|
|
|
|
-static void ui_tset_press(int which, int dir)
|
|
|
|
|
|
|
+/* 按下 "-"/"+" 按钮: 立即步进一次并启动长按自动重复 */
|
|
|
|
|
+static void ui_tset_press(int dir)
|
|
|
{
|
|
{
|
|
|
- s_active = (uint8_t)((which << 1) | (dir > 0 ? 1 : 0));
|
|
|
|
|
|
|
+ s_active = (dir > 0) ? 1 : 0;
|
|
|
s_repeat = 0;
|
|
s_repeat = 0;
|
|
|
|
|
|
|
|
- /* 先立即执行一次 (单击也能 +1/-1) */
|
|
|
|
|
- ui_tset_step(dir, which);
|
|
|
|
|
|
|
+ /* 先立即执行一次 (单击也能 ±1) */
|
|
|
|
|
+ ui_tset_step(dir);
|
|
|
|
|
|
|
|
if (s_repeat_timer == NULL)
|
|
if (s_repeat_timer == NULL)
|
|
|
{
|
|
{
|
|
@@ -129,12 +158,13 @@ static void ui_tset_press(int which, int dir)
|
|
|
{
|
|
{
|
|
|
lv_timer_reset(s_repeat_timer);
|
|
lv_timer_reset(s_repeat_timer);
|
|
|
lv_timer_resume(s_repeat_timer);
|
|
lv_timer_resume(s_repeat_timer);
|
|
|
|
|
+ /* 修复: 上次长按会把周期加速到很短, 重新按下时必须复位,
|
|
|
|
|
+ * 否则第一次自动重复会几乎立即触发, 表现为"一下跳两个单位" */
|
|
|
|
|
+ lv_timer_set_period(s_repeat_timer, UI_TSET_T0);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 释放/失去按钮: 停止自动重复
|
|
|
|
|
- */
|
|
|
|
|
|
|
+/* 释放/失去按钮: 停止自动重复 */
|
|
|
static void ui_tset_release_cb(lv_event_t * e)
|
|
static void ui_tset_release_cb(lv_event_t * e)
|
|
|
{
|
|
{
|
|
|
(void)e;
|
|
(void)e;
|
|
@@ -146,121 +176,301 @@ static void ui_tset_release_cb(lv_event_t * e)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 递减按钮按下事件回调
|
|
|
|
|
- */
|
|
|
|
|
-static void ui_tset_minus_press_cb(lv_event_t * e)
|
|
|
|
|
|
|
+/* 递减按钮按下事件回调 */
|
|
|
|
|
+static void ui_tset_minus_cb(lv_event_t * e)
|
|
|
{
|
|
{
|
|
|
- uint32_t which = (uint32_t)(uintptr_t)lv_event_get_user_data(e);
|
|
|
|
|
- ui_tset_press((int)which, -1);
|
|
|
|
|
|
|
+ (void)e;
|
|
|
|
|
+ ui_tset_press(-1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 递增按钮按下事件回调
|
|
|
|
|
- */
|
|
|
|
|
-static void ui_tset_plus_press_cb(lv_event_t * e)
|
|
|
|
|
|
|
+/* 递增按钮按下事件回调 */
|
|
|
|
|
+static void ui_tset_plus_cb(lv_event_t * e)
|
|
|
{
|
|
{
|
|
|
- uint32_t which = (uint32_t)(uintptr_t)lv_event_get_user_data(e);
|
|
|
|
|
- ui_tset_press((int)which, +1);
|
|
|
|
|
|
|
+ (void)e;
|
|
|
|
|
+ ui_tset_press(+1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 构建一个 \"-\"/\"+\" 强调色步进按钮
|
|
|
|
|
- * @param parent : 父容器 (卡片)
|
|
|
|
|
- * @param x : 按钮 x 坐标
|
|
|
|
|
- * @param ch : 按钮文字 (\"-\"/\"+\")
|
|
|
|
|
- * @param which : 0=CPU0, 1=CPU1
|
|
|
|
|
- * @param dir : +1 递增, -1 递减
|
|
|
|
|
- */
|
|
|
|
|
-static void ui_tset_build_step_btn(lv_obj_t * parent, lv_coord_t x, const char * ch,
|
|
|
|
|
- uint32_t which, int dir)
|
|
|
|
|
|
|
+/* 数值输入框事件: 点击弹出数字键盘, OK 提交 / 取消恢复 */
|
|
|
|
|
+static void ui_tset_ta_event_cb(lv_event_t * e)
|
|
|
{
|
|
{
|
|
|
- lv_obj_t * btn = lv_btn_create(parent);
|
|
|
|
|
- lv_obj_set_size(btn, UI_TSET_BTN_SIZE, UI_TSET_BTN_H);
|
|
|
|
|
- lv_obj_set_pos(btn, x, UI_TSET_BTN_Y);
|
|
|
|
|
- Ui_theme_style_btn_accent(btn);
|
|
|
|
|
- lv_obj_add_event_cb(btn, (dir > 0) ? ui_tset_plus_press_cb : ui_tset_minus_press_cb,
|
|
|
|
|
- LV_EVENT_PRESSED, (void *)(uintptr_t)which);
|
|
|
|
|
- lv_obj_add_event_cb(btn, ui_tset_release_cb, LV_EVENT_RELEASED, NULL);
|
|
|
|
|
- lv_obj_add_event_cb(btn, ui_tset_release_cb, LV_EVENT_PRESS_LOST, NULL);
|
|
|
|
|
|
|
+ lv_event_code_t code = lv_event_get_code(e);
|
|
|
|
|
+ lv_obj_t * ta = lv_event_get_target(e);
|
|
|
|
|
|
|
|
- lv_obj_t * lbl = lv_label_create(btn);
|
|
|
|
|
- lv_label_set_text(lbl, ch);
|
|
|
|
|
- lv_obj_set_style_text_font(lbl, &lv_font_montserrat_20, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_set_style_text_color(lbl, UI_CLR_ACCENT_DARK, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_center(lbl);
|
|
|
|
|
|
|
+ if (code == LV_EVENT_CLICKED || code == LV_EVENT_FOCUSED)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (s_kb != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ return; /* 键盘已打开 */
|
|
|
|
|
+ }
|
|
|
|
|
+ s_kb = lv_keyboard_create(lv_scr_act());
|
|
|
|
|
+ lv_keyboard_set_textarea(s_kb, ta);
|
|
|
|
|
+ lv_keyboard_set_mode(s_kb, LV_KEYBOARD_MODE_NUMBER);
|
|
|
|
|
+ Ui_theme_style_keyboard(s_kb);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (code == LV_EVENT_READY)
|
|
|
|
|
+ {
|
|
|
|
|
+ ui_tset_apply_kb_input(); /* OK: 提交修改 */
|
|
|
|
|
+ if (s_kb != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_obj_del(s_kb);
|
|
|
|
|
+ s_kb = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (code == LV_EVENT_CANCEL)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (s_kb != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_obj_del(s_kb);
|
|
|
|
|
+ s_kb = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ ui_tset_refresh(); /* 取消: 恢复原值 */
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 构建一行目标温度设置 (名称 + 递减 + 数值条 + 递增)
|
|
|
|
|
- * @param parent : 父容器 (卡片)
|
|
|
|
|
- * @param name : CPU 名称 (CPU0/CPU1)
|
|
|
|
|
- * @param which : 0=CPU0, 1=CPU1
|
|
|
|
|
- * @param val_ptr : 指向数值标签句柄
|
|
|
|
|
- */
|
|
|
|
|
-static void ui_tset_add_row(lv_obj_t * parent, const char * name, uint32_t which,
|
|
|
|
|
- lv_obj_t ** val_ptr)
|
|
|
|
|
|
|
+/* 弹窗统一样式: 深色卡片主题, 420 宽 (适配 4.3 寸) */
|
|
|
|
|
+static void ui_tset_style_msgbox(lv_obj_t * mbox)
|
|
|
{
|
|
{
|
|
|
- /* 名称 */
|
|
|
|
|
- lv_obj_t * lbl = lv_label_create(parent);
|
|
|
|
|
- lv_label_set_text(lbl, name);
|
|
|
|
|
- lv_obj_set_style_text_font(lbl, &lv_font_montserrat_16, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_set_style_text_color(lbl, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_set_pos(lbl, UI_TSET_LABEL_X, UI_TSET_LABEL_Y);
|
|
|
|
|
|
|
+ /* 弹窗主体 */
|
|
|
|
|
+ lv_obj_set_width(mbox, UI_TSET_MBOX_W);
|
|
|
|
|
+ lv_obj_set_style_radius(mbox, 12, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_color(mbox, UI_CLR_PANEL, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_opa(mbox, LV_OPA_COVER, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_border_width(mbox, 1, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_border_color(mbox, UI_CLR_LINE, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_shadow_width(mbox, 0, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_shadow_opa(mbox, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_outline_width(mbox, 0, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_pad_all(mbox, 24, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_pad_row(mbox, 20, LV_STATE_DEFAULT); /* 标题/文字/按钮行间距 */
|
|
|
|
|
+
|
|
|
|
|
+ /* 标题 */
|
|
|
|
|
+ lv_obj_t * mtitle = lv_msgbox_get_title(mbox);
|
|
|
|
|
+ lv_obj_set_style_text_font(mtitle, &lv_font_montserrat_20, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(mtitle, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
|
|
+
|
|
|
|
|
+ /* 提示文字 */
|
|
|
|
|
+ lv_obj_t * mtext = lv_msgbox_get_text(mbox);
|
|
|
|
|
+ lv_obj_set_style_text_font(mtext, &lv_font_montserrat_16, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(mtext, UI_CLR_TEXT_DIM, LV_STATE_DEFAULT);
|
|
|
|
|
+
|
|
|
|
|
+ /* 按钮矩阵: 占满弹窗宽度, 按钮均分 */
|
|
|
|
|
+ lv_obj_t * mbtns = lv_msgbox_get_btns(mbox);
|
|
|
|
|
+ if (mbtns != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_obj_set_width(mbtns, lv_pct(100));
|
|
|
|
|
+ lv_obj_set_height(mbtns, 44);
|
|
|
|
|
+ lv_obj_set_style_pad_all(mbtns, 0, LV_PART_MAIN);
|
|
|
|
|
+ lv_obj_set_style_pad_column(mbtns, 12, LV_PART_MAIN);
|
|
|
|
|
+ lv_obj_set_style_radius(mbtns, 8, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_color(mbtns, UI_CLR_PANEL_HI, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_opa(mbtns, LV_OPA_COVER, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_border_width(mbtns, 1, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_border_color(mbtns, UI_CLR_LINE, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_font(mbtns, &lv_font_montserrat_16, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(mbtns, UI_CLR_TEXT, LV_PART_ITEMS | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_color(mbtns, UI_CLR_ACCENT, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
|
|
|
+ lv_obj_set_style_text_color(mbtns, UI_CLR_ACCENT_DARK, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
|
|
|
+ lv_obj_set_style_border_color(mbtns, UI_CLR_ACCENT, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* 背景遮罩: 半透明黑 */
|
|
|
|
|
+ lv_obj_t * backdrop = lv_obj_get_parent(mbox);
|
|
|
|
|
+ lv_obj_set_style_bg_color(backdrop, lv_color_black(), LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_opa(backdrop, LV_OPA_60, LV_STATE_DEFAULT);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 弹窗居中到内容区 (菜单右侧可见区域) 中心, 而非整个屏幕中心 */
|
|
|
|
|
+static void ui_tset_center_msgbox(lv_obj_t * mbox)
|
|
|
|
|
+{
|
|
|
|
|
+ lv_obj_align(mbox, LV_ALIGN_CENTER,
|
|
|
|
|
+ UI_TSET_CONTENT_CX - (lv_coord_t)(LV_HOR_RES / 2),
|
|
|
|
|
+ UI_TSET_CONTENT_CY - (lv_coord_t)(LV_VER_RES / 2));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 预热确认弹窗按钮回调: Yes/No 都关闭弹窗返回 (后期接入控制逻辑) */
|
|
|
|
|
+static void ui_tset_msgbox_cb(lv_event_t * e)
|
|
|
|
|
+{
|
|
|
|
|
+ /* 事件由按钮矩阵冒泡到弹窗, current_target 才是弹窗本体
|
|
|
|
|
+ * (target 是按钮矩阵, 对它 close 会删错对象导致弹窗卡住) */
|
|
|
|
|
+ lv_obj_t * mbox = lv_event_get_current_target(e);
|
|
|
|
|
+ if (lv_msgbox_get_active_btn(mbox) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ /* Yes: 启动预热 (TODO: 接入逻辑层/控制层) */
|
|
|
|
|
+ }
|
|
|
|
|
+ lv_msgbox_close(mbox);
|
|
|
|
|
+ s_msgbox = NULL;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Start preheating 按钮: 弹出确认框 (与保存成功弹窗同尺寸同风格) */
|
|
|
|
|
+static void ui_tset_preheat_cb(lv_event_t * e)
|
|
|
|
|
+{
|
|
|
|
|
+ (void)e;
|
|
|
|
|
+ if (s_msgbox != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ static const char * btns[] = { "Yes", "No", "" };
|
|
|
|
|
+ s_msgbox = lv_msgbox_create(NULL, "Start preheating",
|
|
|
|
|
+ "Are you sure you want to start preheating?", btns, false);
|
|
|
|
|
+ ui_tset_style_msgbox(s_msgbox);
|
|
|
|
|
+
|
|
|
|
|
+ lv_obj_add_event_cb(s_msgbox, ui_tset_msgbox_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
|
|
|
|
+ ui_tset_center_msgbox(s_msgbox);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 关闭保存成功弹窗 */
|
|
|
|
|
+static void ui_tset_saved_hide(void)
|
|
|
|
|
+{
|
|
|
|
|
+ if (s_saved != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_msgbox_close(s_saved); /* 自动删除全屏遮罩 */
|
|
|
|
|
+ s_saved = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 点击遮罩任意位置 (弹窗外区域): 关闭 */
|
|
|
|
|
+static void ui_tset_saved_backdrop_cb(lv_event_t * e)
|
|
|
|
|
+{
|
|
|
|
|
+ (void)e;
|
|
|
|
|
+ ui_tset_saved_hide();
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- /* 递减按钮 \"-\" (长按自动减) */
|
|
|
|
|
- ui_tset_build_step_btn(parent, UI_TSET_BTN_MINUS_X, "-", which, -1);
|
|
|
|
|
|
|
+/* 点击 OK 按钮: 关闭 */
|
|
|
|
|
+static void ui_tset_saved_ok_cb(lv_event_t * e)
|
|
|
|
|
+{
|
|
|
|
|
+ (void)e;
|
|
|
|
|
+ ui_tset_saved_hide();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 弹出"保存成功"弹窗: 与预热确认框同尺寸, 点击 OK 或弹窗外任意位置关闭 */
|
|
|
|
|
+static void ui_tset_show_saved(void)
|
|
|
|
|
+{
|
|
|
|
|
+ ui_tset_saved_hide(); /* 先关闭旧弹窗 */
|
|
|
|
|
|
|
|
- /* 数值条: 深色圆角底 + 白色数值 */
|
|
|
|
|
- lv_obj_t * chip = lv_obj_create(parent);
|
|
|
|
|
- lv_obj_set_pos(chip, UI_TSET_VAL_CHIP_X, UI_TSET_BTN_Y);
|
|
|
|
|
- lv_obj_set_size(chip, UI_TSET_VAL_CHIP_W, UI_TSET_BTN_H);
|
|
|
|
|
- Ui_theme_style_chip(chip);
|
|
|
|
|
|
|
+ static const char * btns[] = { "OK", "" };
|
|
|
|
|
+ s_saved = lv_msgbox_create(NULL, "Saved successfully",
|
|
|
|
|
+ "Target temperature has been saved.", btns, false);
|
|
|
|
|
+ ui_tset_style_msgbox(s_saved);
|
|
|
|
|
|
|
|
- lv_obj_t * val = lv_label_create(chip);
|
|
|
|
|
- lv_obj_set_style_text_font(val, &lv_font_montserrat_20, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_set_style_text_color(val, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_center(val);
|
|
|
|
|
- *val_ptr = val;
|
|
|
|
|
|
|
+ /* 点击弹窗外遮罩任意位置关闭 */
|
|
|
|
|
+ lv_obj_t * backdrop = lv_obj_get_parent(s_saved);
|
|
|
|
|
+ lv_obj_add_event_cb(backdrop, ui_tset_saved_backdrop_cb, LV_EVENT_CLICKED, NULL);
|
|
|
|
|
+ /* 点击 OK 关闭 */
|
|
|
|
|
+ lv_obj_add_event_cb(s_saved, ui_tset_saved_ok_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
|
|
|
|
|
|
|
- /* 递增按钮 \"+\" (长按自动加) */
|
|
|
|
|
- ui_tset_build_step_btn(parent, UI_TSET_BTN_PLUS_X, "+", which, +1);
|
|
|
|
|
|
|
+ ui_tset_center_msgbox(s_saved);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief Apply 按钮事件回调 (假数据)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+/* 页面销毁时清理键盘/弹窗/长按定时器 (键盘与弹窗建在顶层, 不随页面自动删除) */
|
|
|
|
|
+static void ui_tset_delete_cb(lv_event_t * e)
|
|
|
|
|
+{
|
|
|
|
|
+ (void)e;
|
|
|
|
|
+ ui_tset_saved_hide();
|
|
|
|
|
+ if (s_kb != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_obj_del(s_kb);
|
|
|
|
|
+ s_kb = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (s_msgbox != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_msgbox_close(s_msgbox);
|
|
|
|
|
+ s_msgbox = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ s_active = 0xFF; /* 停止长按重复, 防止悬挂 */
|
|
|
|
|
+ s_repeat = 0;
|
|
|
|
|
+ if (s_repeat_timer != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ lv_timer_pause(s_repeat_timer);
|
|
|
|
|
+ }
|
|
|
|
|
+ s_ta = NULL;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 构建 "-"/"+" 步进按钮 (长按自动重复) */
|
|
|
|
|
+static void ui_tset_add_step_btn(lv_obj_t * parent, const char * txt, lv_coord_t x,
|
|
|
|
|
+ lv_event_cb_t press_cb)
|
|
|
|
|
+{
|
|
|
|
|
+ lv_obj_t * btn = lv_btn_create(parent);
|
|
|
|
|
+ lv_obj_set_size(btn, UI_TSET_STEP_W, UI_TSET_STEP_H);
|
|
|
|
|
+ lv_obj_set_pos(btn, x, UI_TSET_STEP_Y);
|
|
|
|
|
+ lv_obj_add_event_cb(btn, press_cb, LV_EVENT_PRESSED, NULL);
|
|
|
|
|
+ lv_obj_add_event_cb(btn, ui_tset_release_cb, LV_EVENT_RELEASED, NULL);
|
|
|
|
|
+ lv_obj_add_event_cb(btn, ui_tset_release_cb, LV_EVENT_PRESS_LOST, NULL);
|
|
|
|
|
+ Ui_theme_style_btn(btn);
|
|
|
|
|
+
|
|
|
|
|
+ lv_obj_t * lbl = lv_label_create(btn);
|
|
|
|
|
+ lv_label_set_text(lbl, txt);
|
|
|
|
|
+ lv_obj_set_style_text_font(lbl, &lv_font_montserrat_20, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(lbl, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(lbl, UI_CLR_ACCENT_DARK, LV_STATE_PRESSED);
|
|
|
|
|
+ lv_obj_center(lbl);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Apply 按钮: 提交输入并弹出保存成功弹窗 (假数据) */
|
|
|
static void ui_tset_apply_cb(lv_event_t * e)
|
|
static void ui_tset_apply_cb(lv_event_t * e)
|
|
|
{
|
|
{
|
|
|
(void)e;
|
|
(void)e;
|
|
|
|
|
+ ui_tset_apply_kb_input(); /* 先提交输入框中的数值 */
|
|
|
|
|
+ ui_tset_show_saved();
|
|
|
/* TODO: 将目标温度写入逻辑层/控制层 */
|
|
/* TODO: 将目标温度写入逻辑层/控制层 */
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * @brief 在父容器内创建\"温度设置\"页面
|
|
|
|
|
- * @param parent : 父容器 (右侧内容区)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+/* 在父容器内创建"温度设置"页面 */
|
|
|
void Ui_temp_setting_create(lv_obj_t * parent)
|
|
void Ui_temp_setting_create(lv_obj_t * parent)
|
|
|
{
|
|
{
|
|
|
Ui_theme_add_title(parent, "Temperature Setting", 10);
|
|
Ui_theme_add_title(parent, "Temperature Setting", 10);
|
|
|
|
|
|
|
|
- /* CPU0 目标温度卡片 */
|
|
|
|
|
- lv_obj_t * card0 = lv_obj_create(parent);
|
|
|
|
|
- lv_obj_set_pos(card0, UI_TSET_CARD_X, UI_TSET_CARD_GAP - 6);
|
|
|
|
|
- lv_obj_set_size(card0, UI_TSET_CARD_W, UI_TSET_CARD_H);
|
|
|
|
|
- Ui_theme_style_panel(card0);
|
|
|
|
|
- ui_tset_add_row(card0, "CPU0 Target:", 0, &s_val_cpu0);
|
|
|
|
|
-
|
|
|
|
|
- /* CPU1 目标温度卡片 */
|
|
|
|
|
- lv_obj_t * card1 = lv_obj_create(parent);
|
|
|
|
|
- lv_obj_set_pos(card1, UI_TSET_CARD_X, UI_TSET_CARD_GAP * 2 - 6);
|
|
|
|
|
- lv_obj_set_size(card1, UI_TSET_CARD_W, UI_TSET_CARD_H);
|
|
|
|
|
- Ui_theme_style_panel(card1);
|
|
|
|
|
- ui_tset_add_row(card1, "CPU1 Target:", 1, &s_val_cpu1);
|
|
|
|
|
-
|
|
|
|
|
- /* Apply 按钮 (强调色) */
|
|
|
|
|
|
|
+ /* 目标温度卡片 (居中) */
|
|
|
|
|
+ lv_obj_t * card = lv_obj_create(parent);
|
|
|
|
|
+ lv_obj_set_pos(card, UI_TSET_CARD_X, UI_TSET_CARD_Y);
|
|
|
|
|
+ lv_obj_set_size(card, UI_TSET_CARD_W, UI_TSET_CARD_H);
|
|
|
|
|
+ Ui_theme_style_panel(card);
|
|
|
|
|
+ lv_obj_add_event_cb(card, ui_tset_delete_cb, LV_EVENT_DELETE, NULL);
|
|
|
|
|
+
|
|
|
|
|
+ /* 名称 (卡片顶部居中) */
|
|
|
|
|
+ lv_obj_t * lbl = lv_label_create(card);
|
|
|
|
|
+ lv_label_set_text(lbl, "target temperature");
|
|
|
|
|
+ lv_obj_set_style_text_font(lbl, &lv_font_montserrat_20, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(lbl, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_align(lbl, LV_ALIGN_TOP_MID, 0, UI_TSET_LABEL_Y);
|
|
|
|
|
+
|
|
|
|
|
+ /* 范围提示 (英文, 卡片底部居中) */
|
|
|
|
|
+ lv_obj_t * hint = lv_label_create(card);
|
|
|
|
|
+ lv_label_set_text(hint, "Range: 40 ~ 90 degree centigrade");
|
|
|
|
|
+ lv_obj_set_style_text_font(hint, &lv_font_montserrat_14, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(hint, UI_CLR_TEXT_MUTED, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_align(hint, LV_ALIGN_BOTTOM_MID, 0, -12);
|
|
|
|
|
+
|
|
|
|
|
+ /* 递减按钮 "-" (长按自动减) */
|
|
|
|
|
+ ui_tset_add_step_btn(card, LV_SYMBOL_MINUS, UI_TSET_BTN_MINUS_X, ui_tset_minus_cb);
|
|
|
|
|
+
|
|
|
|
|
+ /* 数值输入框: 点击弹出数字键盘 */
|
|
|
|
|
+ s_ta = lv_textarea_create(card);
|
|
|
|
|
+ lv_obj_set_pos(s_ta, UI_TSET_VAL_X, UI_TSET_VAL_Y);
|
|
|
|
|
+ lv_textarea_set_one_line(s_ta, true); /* 先设单行: 内部会把高度改为自适应内容 */
|
|
|
|
|
+ lv_obj_set_size(s_ta, UI_TSET_VAL_W, UI_TSET_VAL_H); /* 再设尺寸: 覆盖为与按钮一致的 56 高 */
|
|
|
|
|
+ lv_textarea_set_max_length(s_ta, 3);
|
|
|
|
|
+ lv_textarea_set_align(s_ta, LV_TEXT_ALIGN_CENTER);
|
|
|
|
|
+ lv_obj_set_style_radius(s_ta, LV_RADIUS_CIRCLE, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_color(s_ta, UI_CLR_PANEL_HI, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_bg_opa(s_ta, LV_OPA_COVER, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_border_width(s_ta, 1, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_border_color(s_ta, UI_CLR_LINE, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_pad_all(s_ta, 0, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_font(s_ta, &lv_font_montserrat_20, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(s_ta, UI_CLR_TEXT, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_scrollbar_mode(s_ta, LV_SCROLLBAR_MODE_OFF);
|
|
|
|
|
+ /* 光标/选中统一为强调青色 */
|
|
|
|
|
+ lv_obj_set_style_bg_color(s_ta, UI_CLR_ACCENT, LV_PART_CURSOR | LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_add_event_cb(s_ta, ui_tset_ta_event_cb, LV_EVENT_ALL, NULL);
|
|
|
|
|
+ /* 单行文本框文字默认顶对齐, 手动居中到 56 高的框内 */
|
|
|
|
|
+ lv_obj_align(lv_textarea_get_label(s_ta), LV_ALIGN_CENTER, 0, 0);
|
|
|
|
|
+
|
|
|
|
|
+ /* 递增按钮 "+" (长按自动加) */
|
|
|
|
|
+ ui_tset_add_step_btn(card, LV_SYMBOL_PLUS, UI_TSET_BTN_PLUS_X, ui_tset_plus_cb);
|
|
|
|
|
+
|
|
|
|
|
+ /* 底部按钮行 (居中): Apply + Start preheating */
|
|
|
lv_obj_t * apply = lv_btn_create(parent);
|
|
lv_obj_t * apply = lv_btn_create(parent);
|
|
|
- lv_obj_set_size(apply, 130, 44);
|
|
|
|
|
|
|
+ lv_obj_set_size(apply, UI_TSET_APPLY_W, UI_TSET_BTN_H);
|
|
|
lv_obj_set_pos(apply, UI_TSET_APPLY_X, UI_TSET_APPLY_Y);
|
|
lv_obj_set_pos(apply, UI_TSET_APPLY_X, UI_TSET_APPLY_Y);
|
|
|
lv_obj_add_event_cb(apply, ui_tset_apply_cb, LV_EVENT_CLICKED, NULL);
|
|
lv_obj_add_event_cb(apply, ui_tset_apply_cb, LV_EVENT_CLICKED, NULL);
|
|
|
Ui_theme_style_btn_accent(apply);
|
|
Ui_theme_style_btn_accent(apply);
|
|
@@ -270,17 +480,16 @@ void Ui_temp_setting_create(lv_obj_t * parent)
|
|
|
lv_obj_set_style_text_color(al, UI_CLR_ACCENT_DARK, LV_STATE_DEFAULT);
|
|
lv_obj_set_style_text_color(al, UI_CLR_ACCENT_DARK, LV_STATE_DEFAULT);
|
|
|
lv_obj_center(al);
|
|
lv_obj_center(al);
|
|
|
|
|
|
|
|
- /* 范围说明 (信息条) */
|
|
|
|
|
- lv_obj_t * hint_chip = lv_obj_create(parent);
|
|
|
|
|
- lv_obj_set_pos(hint_chip, UI_TSET_HINT_X, UI_TSET_HINT_Y);
|
|
|
|
|
- lv_obj_set_size(hint_chip, 260, 44);
|
|
|
|
|
- Ui_theme_style_chip(hint_chip);
|
|
|
|
|
- lv_obj_t * hint = lv_label_create(hint_chip);
|
|
|
|
|
- lv_label_set_text(hint, "Range: 40 ~ 90 deg C");
|
|
|
|
|
- lv_obj_set_style_text_font(hint, &lv_font_montserrat_14, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_set_style_text_color(hint, UI_CLR_TEXT_MUTED, LV_STATE_DEFAULT);
|
|
|
|
|
- lv_obj_center(hint);
|
|
|
|
|
|
|
+ lv_obj_t * ph = lv_btn_create(parent);
|
|
|
|
|
+ lv_obj_set_size(ph, UI_TSET_PREHEAT_W, UI_TSET_BTN_H);
|
|
|
|
|
+ lv_obj_set_pos(ph, UI_TSET_PREHEAT_X, UI_TSET_APPLY_Y);
|
|
|
|
|
+ lv_obj_add_event_cb(ph, ui_tset_preheat_cb, LV_EVENT_CLICKED, NULL);
|
|
|
|
|
+ Ui_theme_style_btn_accent(ph);
|
|
|
|
|
+ lv_obj_t * pl = lv_label_create(ph);
|
|
|
|
|
+ lv_label_set_text(pl, "Start preheating");
|
|
|
|
|
+ lv_obj_set_style_text_font(pl, &lv_font_montserrat_16, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_set_style_text_color(pl, UI_CLR_ACCENT_DARK, LV_STATE_DEFAULT);
|
|
|
|
|
+ lv_obj_center(pl);
|
|
|
|
|
|
|
|
- /* 初始显示 */
|
|
|
|
|
ui_tset_refresh();
|
|
ui_tset_refresh();
|
|
|
}
|
|
}
|