zhanghongyi пре 3 месеци
родитељ
комит
79b9665d8e

+ 5 - 288
App/Src/App_freertosTask.c

@@ -5,7 +5,7 @@
 #include "lv_port_disp.h"
 #include "lv_port_disp.h"
 #include "lv_port_indev.h"
 #include "lv_port_indev.h"
 #include "Int_gt1151.h"
 #include "Int_gt1151.h"
-#include "Int_lcd.h"
+#include "Ui.h"
 
 
 #define TASK_CPLD_PRIORITY          4
 #define TASK_CPLD_PRIORITY          4
 #define TASK_CPLD_STACK_SIZE        512
 #define TASK_CPLD_STACK_SIZE        512
@@ -16,271 +16,6 @@
 #define TASK_TEST_PRIORITY          1
 #define TASK_TEST_PRIORITY          1
 #define TASK_TEST_STACK_SIZE        512
 #define TASK_TEST_STACK_SIZE        512
 
 
-/* 测试1(顺序测试)条件编译开关:1=运行;0=静态红底+文字页 */
-#define ENABLE_TEST1                1
-
-/* 触摸验证(可点击按钮)条件编译开关:1=运行触摸验证界面;0=不运行 */
-#define ENABLE_TOUCH_TEST           1
-
-#if ENABLE_TEST1
-
-/**
- * @brief 测试1 状态机
- *
- * 顺序:10s 倒数(局部文字刷新)→ 背景三原色切换(1s)→ 3x3 九宫格
- */
-typedef enum
-{
-    TEST1_PHASE_COUNTDOWN,   /* 10s 倒数 */
-    TEST1_PHASE_BG,          /* 三原色背景切换 */
-    TEST1_PHASE_GRID         /* 三原色九宫格 */
-} test1_phase_t;
-
-typedef struct
-{
-    test1_phase_t phase;
-    uint32_t      last_ms;
-    int32_t       count;     /* 倒数 10..1 */
-    uint32_t      bg_idx;    /* 当前背景色索引 */
-    lv_obj_t    * scr;
-    lv_obj_t    * lbl;
-} test1_state_t;
-
-static const uint32_t test1_bg_hex[3] = {
-    0xFF0000,   /* 红 */
-    0x00FF00,   /* 绿 */
-    0x0000FF    /* 蓝 */
-};
-
-static const uint32_t test1_grid_hex[9] = {
-    0xFF0000,   /* 红 */
-    0x00FF00,   /* 绿 */
-    0x0000FF,   /* 蓝 */
-    0xFFFF00,   /* 黄 */
-    0x00FFFF,   /* 青 */
-    0xFF00FF,   /* 品红 */
-    0xFF8000,   /* 橙 */
-    0x80FF00,   /* 草绿 */
-    0x8000FF    /* 品蓝 */
-};
-
-/* 九宫格列宽:800 = 266 + 267 + 267;行高:480 = 160 * 3 */
-static const lv_coord_t test1_grid_col_w[3] = { 266, 267, 267 };
-static const lv_coord_t test1_grid_col_x[3] = { 0, 266, 533 };
-static const lv_coord_t test1_grid_row_h = 160;
-
-static void Test1_Init(test1_state_t * st)
-{
-    st->phase   = TEST1_PHASE_COUNTDOWN;
-    st->last_ms = lv_tick_get();
-    st->count   = 10;
-    st->bg_idx  = 0;
-
-    st->scr = lv_scr_act();
-    lv_obj_set_style_bg_color(st->scr, lv_color_hex(test1_bg_hex[0]), LV_STATE_DEFAULT);
-
-    st->lbl = lv_label_create(st->scr);
-    lv_label_set_text_fmt(st->lbl, "%d", st->count);
-    lv_obj_center(st->lbl);
-}
-
-static void Test1_Tick(test1_state_t * st)
-{
-    uint32_t now = lv_tick_get();
-
-    if ((uint32_t)(now - st->last_ms) < 1000)
-    {
-        return;
-    }
-    st->last_ms = now;
-
-    switch (st->phase)
-    {
-    case TEST1_PHASE_COUNTDOWN:
-    {
-        st->count--;
-        if (st->count >= 1)
-        {
-            lv_label_set_text_fmt(st->lbl, "%d", st->count);
-        }
-        else
-        {
-            /* 倒数结束:删除文字,进入背景切换 */
-            if (st->lbl != NULL)
-            {
-                lv_obj_del(st->lbl);
-                st->lbl = NULL;
-            }
-            st->phase = TEST1_PHASE_BG;
-            lv_obj_set_style_bg_color(st->scr, lv_color_hex(test1_bg_hex[0]), LV_STATE_DEFAULT);
-        }
-        break;
-    }
-
-    case TEST1_PHASE_BG:
-    {
-        st->bg_idx++;
-        if (st->bg_idx < 3)
-        {
-            lv_obj_set_style_bg_color(st->scr, lv_color_hex(test1_bg_hex[st->bg_idx]), LV_STATE_DEFAULT);
-        }
-        else
-        {
-            /* 三原色切换完毕:创建 3x3 九宫格 */
-            uint32_t i;
-            for (i = 0; i < 9; i++)
-            {
-                lv_obj_t * blk = lv_obj_create(st->scr);
-                lv_obj_set_size(blk, test1_grid_col_w[i % 3], test1_grid_row_h);
-                lv_obj_set_pos(blk, test1_grid_col_x[i % 3], (i / 3) * test1_grid_row_h);
-                lv_obj_set_style_bg_color(blk, lv_color_hex(test1_grid_hex[i]), LV_STATE_DEFAULT);
-                lv_obj_set_style_border_width(blk, 0, LV_STATE_DEFAULT);
-                lv_obj_set_style_radius(blk, 0, LV_STATE_DEFAULT);
-            }
-            st->phase = TEST1_PHASE_GRID;
-        }
-        break;
-    }
-
-    default:
-        break;
-    }
-}
-
-#endif /* ENABLE_TEST1 */
-
-#if ENABLE_TOUCH_TEST
-
-/**
- * @brief 触摸画板: 配合电容触摸, 在屏幕上用手指绘制线条
- *
- * 实现方式:
- *  - 全屏 lv_canvas (RGB565), 白底黑笔。
- *  - 画布数据缓冲放在 SDRAM 第三块 (非缓存区, 无缓存一致性问题)。
- *  - 主循环每帧轮询按压状态: 按下则用 Bresenham 从上一触点连线到当前触点;
- *    松开则重置上一触点, 下次按下从新起点开始 (不连线)。
- *  - 右上角提供 "CLEAR" 清屏按钮。
- */
-
-/* 画板常量 */
-#define PAD_BUF_ADDR    (INT_LCD_FRAME_BUF_ADDR + 2 * INT_LCD_FRAME_BUF_SIZE)  /* SDRAM 3rd block */
-#define PAD_WIDTH       INT_LCD_WIDTH
-#define PAD_HEIGHT      INT_LCD_HEIGHT
-
-/* 画板句柄 */
-static lv_obj_t * s_pad_canvas   = NULL;
-static lv_coord_t s_pad_last_x;
-static lv_coord_t s_pad_last_y;
-static uint8_t    s_pad_drawing;   /* 是否正在连线中 */
-
-/**
- * @brief Bresenham 画线: 在 canvas 上从 (x0,y0) 到 (x1,y1) 逐点涂色
- */
-static void Pad_DrawLine(lv_coord_t x0, lv_coord_t y0, lv_coord_t x1, lv_coord_t y1)
-{
-    int dx = (x1 > x0) ? (x1 - x0) : (x0 - x1);
-    int dy = (y1 > y0) ? (y1 - y0) : (y0 - y1);
-    int sx = (x1 > x0) ? 1 : -1;
-    int sy = (y1 > y0) ? 1 : -1;
-    int err = dx - dy;
-    lv_color_t c = lv_color_black();
-
-    while (1)
-    {
-        if (x0 >= 0 && x0 < PAD_WIDTH && y0 >= 0 && y0 < PAD_HEIGHT)
-        {
-            lv_canvas_set_px(s_pad_canvas, x0, y0, c);
-        }
-        if (x0 == x1 && y0 == y1) break;
-        int e2 = 2 * err;
-        if (e2 > -dy) { err -= dy; x0 += sx; }
-        if (e2 <  dx) { err += dx; y0 += sy; }
-    }
-}
-
-/**
- * @brief 清屏按钮事件回调
- */
-static void Pad_ClearCb(lv_event_t * e)
-{
-    if (lv_event_get_code(e) == LV_EVENT_CLICKED && s_pad_canvas != NULL)
-    {
-        lv_canvas_fill_bg(s_pad_canvas, lv_color_white(), LV_OPA_COVER);
-        lv_obj_invalidate(s_pad_canvas);
-        s_pad_drawing = 0;
-    }
-}
-
-/**
- * @brief 画板主循环动作: 每帧调用, 根据按压状态绘制
- */
-static void TouchTest_Tick(void)
-{
-    uint16_t px = 0;
-    uint16_t py = 0;
-
-    if (s_pad_canvas == NULL) return;
-
-    if (Int_gt1151_pressed())
-    {
-        Int_gt1151_get_point(&px, &py);
-
-        if (s_pad_drawing)
-        {
-            /* 上一触点 -> 当前触点连线 */
-            Pad_DrawLine(s_pad_last_x, s_pad_last_y, (lv_coord_t)px, (lv_coord_t)py);
-        }
-        else
-        {
-            /* 刚按下: 画一个起始点 */
-            if (px < PAD_WIDTH && py < PAD_HEIGHT)
-            {
-                lv_canvas_set_px(s_pad_canvas, (lv_coord_t)px, (lv_coord_t)py, lv_color_black());
-            }
-            s_pad_drawing = 1;
-        }
-        s_pad_last_x = (lv_coord_t)px;
-        s_pad_last_y = (lv_coord_t)py;
-
-        /* 通知 LVGL 重绘画布, 将新画笔迹刷到显示 */
-        lv_obj_invalidate(s_pad_canvas);
-    }
-    else
-    {
-        s_pad_drawing = 0;   /* 松开, 下次按下重新起笔 */
-    }
-}
-
-/**
- * @brief 初始化触摸画板
- */
-static void TouchTest_Init(lv_obj_t * scr)
-{
-    lv_obj_set_style_bg_color(scr, lv_color_hex(0x000000), LV_STATE_DEFAULT);
-
-    /* 创建全屏画布 */
-    s_pad_canvas = lv_canvas_create(scr);
-    /* 画布缓冲使用 SDRAM 固定地址 */
-    lv_canvas_set_buffer(s_pad_canvas, (void *)PAD_BUF_ADDR, PAD_WIDTH, PAD_HEIGHT, LV_IMG_CF_TRUE_COLOR);
-    lv_obj_center(s_pad_canvas);
-    lv_canvas_fill_bg(s_pad_canvas, lv_color_white(), LV_OPA_COVER);
-
-    s_pad_drawing = 0;
-    s_pad_last_x  = 0;
-    s_pad_last_y  = 0;
-
-    /* 右上角清屏按钮 */
-    lv_obj_t * btn = lv_btn_create(scr);
-    lv_obj_set_size(btn, 96, 40);
-    lv_obj_align(btn, LV_ALIGN_TOP_RIGHT, -10, 10);
-    lv_obj_add_event_cb(btn, Pad_ClearCb, LV_EVENT_CLICKED, NULL);
-
-    lv_obj_t * lbl = lv_label_create(btn);
-    lv_label_set_text(lbl, "CLEAR");
-    lv_obj_center(lbl);
-}
-
-#endif /* ENABLE_TOUCH_TEST */
 
 
 TaskHandle_t xCPLDProcessTaskHandle = NULL;
 TaskHandle_t xCPLDProcessTaskHandle = NULL;
 TaskHandle_t xLVGLDisplayTaskHandle = NULL;
 TaskHandle_t xLVGLDisplayTaskHandle = NULL;
@@ -357,34 +92,16 @@ void Task_LVGL_Display(void *argument)
         printf("[ERR] GT1151 Init failed\r\n");
         printf("[ERR] GT1151 Init failed\r\n");
     }
     }
 
 
-#if ENABLE_TOUCH_TEST
-    /* 触摸验证界面:可点击按钮 + 实时坐标显示 */
-    {
-        lv_obj_t *scr = lv_scr_act();
-        TouchTest_Init(scr);
-    }
-#elif ENABLE_TEST1
-    test1_state_t test1;
-    Test1_Init(&test1);
-#else
-    /* 验证界面:红底 + 居中文字 */
-    lv_obj_t *scr = lv_scr_act();
-    lv_obj_set_style_bg_color(scr, lv_color_hex(0xFF0000), LV_STATE_DEFAULT);
+    /* 创建工业设备主页 (UI 页面层) */
+    Ui_init();
 
 
-    lv_obj_t *lbl = lv_label_create(scr);
-    lv_label_set_text(lbl, "LVGL Test");
-    lv_obj_center(lbl);
-#endif
+    /* 假数据: 设备就绪 */
+    Ui_set_ready(true);
 
 
     while (1)
     while (1)
     {
     {
         /* 周期驱动 LVGL(渲染/动画/输入),配合 LV_DISP_DEF_REFR_PERIOD 30ms */
         /* 周期驱动 LVGL(渲染/动画/输入),配合 LV_DISP_DEF_REFR_PERIOD 30ms */
         lv_timer_handler();
         lv_timer_handler();
-#if ENABLE_TOUCH_TEST
-        TouchTest_Tick();
-#elif ENABLE_TEST1
-        Test1_Tick(&test1);
-#endif
         vTaskDelay(pdMS_TO_TICKS(5));
         vTaskDelay(pdMS_TO_TICKS(5));
     }
     }
 }
 }

+ 2 - 6
Int/Inc/Int_gt1151.h

@@ -22,16 +22,12 @@
 #define INT_GT1151_CHECK_REG      0X80FF      /* 配置校验和寄存器 */
 #define INT_GT1151_CHECK_REG      0X80FF      /* 配置校验和寄存器 */
 #define INT_GT1151_PID_REG        0X8140      /* 产品 ID 寄存器 (4字节, 本板为 "1151") */
 #define INT_GT1151_PID_REG        0X8140      /* 产品 ID 寄存器 (4字节, 本板为 "1151") */
 #define INT_GT1151_GSTID_REG      0X814E      /* 触摸点数/状态寄存器 */
 #define INT_GT1151_GSTID_REG      0X814E      /* 触摸点数/状态寄存器 */
-#define INT_GT1151_TP1_REG        0X8150      /* 第一触点数据地址 */
-#define INT_GT1151_TP2_REG        0X8158
-#define INT_GT1151_TP3_REG        0X8160
-#define INT_GT1151_TP4_REG        0X8168
-#define INT_GT1151_TP5_REG        0X8170
+#define INT_GT1151_TP1_REG        0X8150      /* 第一触点数据地址 (单点模式) */
 
 
 /*----------------------- 屏幕分辨率 (与 LCD 一致) ------------------------*/
 /*----------------------- 屏幕分辨率 (与 LCD 一致) ------------------------*/
 #define INT_GT1151_WIDTH          800
 #define INT_GT1151_WIDTH          800
 #define INT_GT1151_HEIGHT         480
 #define INT_GT1151_HEIGHT         480
-#define INT_GT1151_TOUCH_NUM      5           /* GT1151 支持 5 点触摸 */
+#define INT_GT1151_TOUCH_NUM      5           /* 触点数量上限 (单点模式, 用于 gstid 有效性判断) */           /* GT1151 支持 5 点触摸 */
 
 
 /*----------------------- 坐标方向调整宏 ------------------------
 /*----------------------- 坐标方向调整宏 ------------------------
  * 触点原始坐标方向可能与 LCD 逻辑坐标不一致, 提供以下开关便于实测调整:
  * 触点原始坐标方向可能与 LCD 逻辑坐标不一致, 提供以下开关便于实测调整:

+ 0 - 7
Int/Src/Int_gt1151.c

@@ -132,13 +132,6 @@ uint8_t Int_gt1151_init(void)
     return 0;
     return 0;
 }
 }
 
 
-/* GT1151 各触摸点寄存器地址表 */
-static const uint16_t s_int_gt_tp_tbl[INT_GT1151_TOUCH_NUM] =
-{
-    INT_GT1151_TP1_REG, INT_GT1151_TP2_REG, INT_GT1151_TP3_REG,
-    INT_GT1151_TP4_REG, INT_GT1151_TP5_REG,
-};
-
 /**
 /**
   * @brief  扫描触摸屏 (查询方式)
   * @brief  扫描触摸屏 (查询方式)
   * @note   把原始触点坐标经方向变换后, 保存在内部 g_int_gt_x/g_int_gt_y (LCD 逻辑坐标)。
   * @note   把原始触点坐标经方向变换后, 保存在内部 g_int_gt_x/g_int_gt_y (LCD 逻辑坐标)。

+ 43 - 0
LVGL8v3/logic/Logic_temperature.c

@@ -0,0 +1,43 @@
+/**
+  ******************************************************************************
+  * @file    Logic_temperature.c
+  * @brief   温度数据逻辑层 (假数据版) - 后续替换为真实数据源
+  *
+  * @note    当前提供假数据, 后续从真实采集通道获取。
+  ******************************************************************************
+  */
+#include <stdio.h>
+#include "Logic_temperature.h"
+
+/**
+ * @brief  获取指定通道的温度值
+ * @note   假数据: 以通道号为基准生成一个随通道变化的温度值,
+ *         便于 UI 端直观区分各通道, 后续替换为真实采集数据。
+ * @param  ch : 通道号 (0 ~ 31)
+ * @retval 温度值 (摄氏度), 越界返回 -127
+ */
+int8_t Logic_temperature_get(uint8_t ch)
+{
+    if (ch >= LOGIC_TEMP_TOTAL_CH)
+    {
+        return -127;
+    }
+
+    /* 假数据: 温度随通道递增偏移, 模拟不同通道的温差 */
+    return (int8_t)(40 + ch);
+}
+
+/**
+ * @brief  获取指定通道所属的 CPU 编号
+ * @param  ch : 通道号
+ * @retval 0 = CPU0, 1 = CPU1; 越界返回 -1
+ */
+int8_t Logic_temperature_get_cpu(uint8_t ch)
+{
+    if (ch >= LOGIC_TEMP_TOTAL_CH)
+    {
+        return -1;
+    }
+
+    return (ch < LOGIC_TEMP_CPU_CH_COUNT) ? 0 : 1;
+}

+ 47 - 0
LVGL8v3/logic/Logic_temperature.h

@@ -0,0 +1,47 @@
+/**
+  ******************************************************************************
+  * @file    Logic_temperature.h
+  * @brief   温度数据逻辑层 (假数据版) - 后续替换为真实数据源
+  *
+  * @note    本文件为逻辑层 (Logic) 接口, 供 UI 页面层获取温度数据。
+  *          当前使用假数据, 后续从真实采集通道 (如 CPLD/ADC) 获取。
+  *
+  *          温度通道划分:
+  *            通道 0 ~ 15  -> CPU0
+  *            通道 16 ~ 31 -> CPU1 (共 32 条, 前 16 条 CPU0, 后 16 条 CPU1)
+  ******************************************************************************
+  */
+#ifndef __LOGIC_TEMPERATURE_H
+#define __LOGIC_TEMPERATURE_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 温度相关常量 */
+#define LOGIC_TEMP_TOTAL_CH        32          /* 温度通道总数 */
+#define LOGIC_TEMP_CPU_CH_COUNT    16          /* 每个 CPU 的通道数 */
+
+/* 功能函数 ----------------------------------------------------------------*/
+
+/**
+ * @brief  获取指定通道的温度值 (假数据)
+ * @param  ch : 通道号 (0 ~ LOGIC_TEMP_TOTAL_CH-1)
+ * @retval 温度值 (摄氏度, 整数), 通道越界时返回 -127
+ */
+int8_t  Logic_temperature_get(uint8_t ch);
+
+/**
+ * @brief  获取指定通道所属的 CPU 编号
+ * @param  ch : 通道号
+ * @retval 0 = CPU0, 1 = CPU1; 越界返回 -1
+ */
+int8_t  Logic_temperature_get_cpu(uint8_t ch);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LOGIC_TEMPERATURE_H */

+ 2 - 2
LVGL8v3/lv_conf.h

@@ -365,9 +365,9 @@
 #define LV_FONT_MONTSERRAT_10 0
 #define LV_FONT_MONTSERRAT_10 0
 #define LV_FONT_MONTSERRAT_12 0
 #define LV_FONT_MONTSERRAT_12 0
 #define LV_FONT_MONTSERRAT_14 1
 #define LV_FONT_MONTSERRAT_14 1
-#define LV_FONT_MONTSERRAT_16 0
+#define LV_FONT_MONTSERRAT_16 1
 #define LV_FONT_MONTSERRAT_18 0
 #define LV_FONT_MONTSERRAT_18 0
-#define LV_FONT_MONTSERRAT_20 0
+#define LV_FONT_MONTSERRAT_20 1
 #define LV_FONT_MONTSERRAT_22 0
 #define LV_FONT_MONTSERRAT_22 0
 #define LV_FONT_MONTSERRAT_24 0
 #define LV_FONT_MONTSERRAT_24 0
 #define LV_FONT_MONTSERRAT_26 0
 #define LV_FONT_MONTSERRAT_26 0

+ 270 - 0
LVGL8v3/ui/Ui.c

@@ -0,0 +1,270 @@
+/**
+  ******************************************************************************
+  * @file    Ui.c
+  * @brief   UI 页面层主框架 (工业设备主页)
+  *
+  * @note    构建工业设备主页:
+  *          - 顶部状态栏: 设备名称 + 就绪状态指示灯 (就绪=绿, 未就绪=红)
+  *          - 左侧菜单栏: 实时温度 / 设备状态 / 温度设置
+  *          - 右侧内容区: 随菜单点击切换对应页面
+  ******************************************************************************
+  */
+#include <stdio.h>
+#include "Ui.h"
+#include "Ui_temperature.h"
+#include "Ui_status.h"
+#include "Ui_temp_setting.h"
+
+/*----------------------------- 布局尺寸 ------------------------------*/
+#define UI_STATUS_BAR_H     40          /* 顶部状态栏高度 */
+#define UI_MENU_W           160         /* 左侧菜单栏宽度 */
+#define UI_CONTENT_X        (UI_MENU_W + 10)   /* 内容区起点 X */
+
+/*----------------------------- 状态栏 ------------------------------*/
+typedef enum
+{
+    UI_READY_READY = 0,    /* 就绪 (绿) */
+    UI_READY_NOT   = 1     /* 未就绪 (红) */
+} ui_ready_state_t;
+
+/* 全局句柄 */
+static lv_obj_t * s_status_dot   = NULL;   /* 状态指示灯 (圆点) */
+static lv_obj_t * s_status_label = NULL;   /* 状态文字 ("Ready"/"Not Ready") */
+static lv_obj_t * s_status_badge = NULL;   /* 就绪徽章 (圆角底) */
+static lv_obj_t * s_content      = NULL;   /* 右侧内容区容器 */
+static ui_ready_state_t s_ready  = UI_READY_NOT;
+
+/*----------------------------- 菜单项 ------------------------------*/
+enum
+{
+    UI_MENU_TEMPERATURE = 0,
+    UI_MENU_STATUS,
+    UI_MENU_TEMP_SETTING,
+    UI_MENU_MAX
+};
+
+static const char * s_menu_text[UI_MENU_MAX] =
+{
+    "Temperature",
+    "Status",
+    "Temp Setting",
+};
+
+/*----------------------------- 静态函数 ------------------------------*/
+
+/**
+ * @brief  禁用指定对象的滚动与滚动条 (防止左滑拖动整个页面)
+ * @param  obj : 目标对象
+ */
+static void ui_fix_scroll(lv_obj_t * obj)
+{
+    lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
+    lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_OFF);
+}
+
+/**
+ * @brief  构建顶部状态栏
+ */
+static void ui_build_status_bar(lv_obj_t * scr)
+{
+    lv_obj_t * bar = lv_obj_create(scr);
+    lv_obj_set_size(bar, lv_pct(100), UI_STATUS_BAR_H);
+    lv_obj_set_pos(bar, 0, 0);
+    lv_obj_set_style_radius(bar, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_border_width(bar, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_bg_color(bar, lv_color_hex(0x202830), LV_STATE_DEFAULT);
+    lv_obj_set_style_pad_all(bar, 0, LV_STATE_DEFAULT);
+    ui_fix_scroll(bar);
+
+    /* 左侧设备名称 */
+    lv_obj_t * name = lv_label_create(bar);
+    lv_label_set_text(name, "Temperature Control System");
+    lv_obj_set_style_text_font(name, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(name, lv_color_hex(0xFFFFFF), LV_STATE_DEFAULT);
+    lv_obj_align(name, LV_ALIGN_LEFT_MID, 16, 0);
+
+    /* 右侧就绪徽章 (圆角底 + 圆点 + 状态文字, 清除默认主题视觉成纯色) */
+    s_status_badge = lv_obj_create(bar);
+    lv_obj_set_size(s_status_badge, 150, 30);
+    lv_obj_align(s_status_badge, LV_ALIGN_RIGHT_MID, -16, 0);
+    lv_obj_set_style_radius(s_status_badge, LV_RADIUS_CIRCLE, LV_STATE_DEFAULT);
+    lv_obj_set_style_bg_opa(s_status_badge, LV_OPA_COVER, LV_STATE_DEFAULT);
+    lv_obj_set_style_border_opa(s_status_badge, LV_OPA_TRANSP, LV_STATE_DEFAULT);
+    lv_obj_set_style_shadow_width(s_status_badge, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_shadow_opa(s_status_badge, LV_OPA_TRANSP, LV_STATE_DEFAULT);
+    lv_obj_set_style_outline_width(s_status_badge, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_pad_all(s_status_badge, 0, LV_STATE_DEFAULT);
+    lv_obj_clear_flag(s_status_badge, LV_OBJ_FLAG_SCROLLABLE);
+    lv_obj_set_scrollbar_mode(s_status_badge, LV_SCROLLBAR_MODE_OFF);
+
+    /* 徽章内圆点 (就绪指示灯, 纯色实心圆) */
+    s_status_dot = lv_obj_create(s_status_badge);
+    lv_obj_set_size(s_status_dot, 14, 14);
+    lv_obj_align(s_status_dot, LV_ALIGN_LEFT_MID, 10, 0);
+    lv_obj_set_style_radius(s_status_dot, LV_RADIUS_CIRCLE, LV_STATE_DEFAULT);
+    lv_obj_set_style_bg_opa(s_status_dot, LV_OPA_COVER, LV_STATE_DEFAULT);
+    lv_obj_set_style_border_opa(s_status_dot, LV_OPA_TRANSP, LV_STATE_DEFAULT);
+    lv_obj_set_style_shadow_width(s_status_dot, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_shadow_opa(s_status_dot, LV_OPA_TRANSP, LV_STATE_DEFAULT);
+    lv_obj_set_style_outline_width(s_status_dot, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_pad_all(s_status_dot, 0, LV_STATE_DEFAULT);
+    lv_obj_clear_flag(s_status_dot, LV_OBJ_FLAG_SCROLLABLE);
+    lv_obj_set_scrollbar_mode(s_status_dot, LV_SCROLLBAR_MODE_OFF);
+
+    /* 徽章内状态文字 */
+    s_status_label = lv_label_create(s_status_badge);
+    lv_label_set_text(s_status_label, "Not Ready");
+    lv_obj_set_style_text_font(s_status_label, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(s_status_label, lv_color_hex(0xFFFFFF), LV_STATE_DEFAULT);
+    lv_obj_align(s_status_label, LV_ALIGN_RIGHT_MID, -12, 0);
+}
+
+/**
+ * @brief  刷新状态栏的就绪指示灯与文字
+ */
+static void ui_refresh_ready(void)
+{
+    if (s_status_dot == NULL || s_status_label == NULL || s_status_badge == NULL)
+    {
+        return;
+    }
+
+    if (s_ready == UI_READY_READY)
+    {
+        lv_obj_set_style_bg_color(s_status_badge, lv_color_hex(0x00A800), LV_STATE_DEFAULT);
+        lv_obj_set_style_bg_color(s_status_dot,   lv_color_hex(0x00FF00), LV_STATE_DEFAULT);
+        lv_obj_set_style_text_color(s_status_label, lv_color_hex(0x003000), LV_STATE_DEFAULT);
+        lv_label_set_text(s_status_label, "Ready");
+    }
+    else
+    {
+        lv_obj_set_style_bg_color(s_status_badge, lv_color_hex(0x8E0000), LV_STATE_DEFAULT);
+        lv_obj_set_style_bg_color(s_status_dot,   lv_color_hex(0xFF3030), LV_STATE_DEFAULT);
+        lv_obj_set_style_text_color(s_status_label, lv_color_hex(0xFFFFFF), LV_STATE_DEFAULT);
+        lv_label_set_text(s_status_label, "Not Ready");
+    }
+}
+
+/**
+ * @brief  UI 菜单按钮点击事件回调: 切换右侧内容区页面
+ */
+static void ui_menu_click_cb(lv_event_t * e)
+{
+    uint32_t menu_id = (uint32_t)(uintptr_t)lv_event_get_user_data(e);
+
+    /* 清空内容区, 重新构建对应页面 */
+    lv_obj_clean(s_content);
+
+    switch (menu_id)
+    {
+    case UI_MENU_TEMPERATURE:
+        Ui_temperature_create(s_content);
+        break;
+    case UI_MENU_STATUS:
+        Ui_status_create(s_content);
+        break;
+    case UI_MENU_TEMP_SETTING:
+        Ui_temp_setting_create(s_content);
+        break;
+    default:
+        break;
+    }
+}
+
+/**
+ * @brief  构建左侧菜单栏 (三个按钮均分左侧高度并水平居中)
+ */
+static void ui_build_menu(lv_obj_t * scr)
+{
+    /* 菜单高度 = 屏幕高度 - 顶部状态栏高度 (固定值, 避免依赖 pct 布局时序) */
+    lv_coord_t menu_h = lv_disp_get_ver_res(NULL) - UI_STATUS_BAR_H;
+
+    lv_obj_t * menu = lv_obj_create(scr);
+    lv_obj_set_size(menu, UI_MENU_W, menu_h);
+    lv_obj_set_pos(menu, 0, UI_STATUS_BAR_H);
+    lv_obj_set_style_radius(menu, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_border_width(menu, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_bg_color(menu, lv_color_hex(0x283038), LV_STATE_DEFAULT);
+    lv_obj_set_style_pad_all(menu, 8, LV_STATE_DEFAULT);
+    ui_fix_scroll(menu);
+
+    /* 三个按钮均分左侧可用高度 */
+    lv_coord_t btn_w   = UI_MENU_W - 16;                          /* 内容区宽度 */
+    lv_coord_t col_h   = menu_h - 16;                             /* 内容区高度 (扣除上下 pad) */
+    lv_coord_t gap     = 6;
+    lv_coord_t btn_h   = (col_h - (UI_MENU_MAX - 1) * gap) / UI_MENU_MAX;
+    if (btn_h < 24)
+    {
+        btn_h = 24;                                               /* 防御: 高度下限 */
+    }
+    uint32_t   i;
+
+    for (i = 0; i < UI_MENU_MAX; i++)
+    {
+        lv_obj_t * btn = lv_btn_create(menu);
+        lv_obj_set_size(btn, btn_w, btn_h);
+        /* TOP_MID: 水平居中; 纵向依次排开 */
+        lv_obj_align(btn, LV_ALIGN_TOP_MID, 0, 0 + i * (btn_h + gap));
+        lv_obj_add_event_cb(btn, ui_menu_click_cb, LV_EVENT_CLICKED, (void *)(uintptr_t)i);
+
+        lv_obj_t * lbl = lv_label_create(btn);
+        lv_label_set_text(lbl, s_menu_text[i]);
+        lv_obj_set_style_text_font(lbl, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+        lv_obj_center(lbl);
+    }
+}
+
+/**
+ * @brief  构建右侧内容区容器
+ */
+static void ui_build_content(lv_obj_t * scr)
+{
+    s_content = lv_obj_create(scr);
+    lv_obj_set_size(s_content, lv_pct(100), lv_pct(100));
+    lv_obj_set_pos(s_content, UI_CONTENT_X, UI_STATUS_BAR_H + 4);
+    lv_obj_set_style_radius(s_content, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_border_width(s_content, 0, LV_STATE_DEFAULT);
+    lv_obj_set_style_bg_color(s_content, lv_color_hex(0x10151A), LV_STATE_DEFAULT);
+    lv_obj_set_style_pad_all(s_content, 0, LV_STATE_DEFAULT);
+    ui_fix_scroll(s_content);
+}
+
+/*----------------------------- 全局函数 ------------------------------*/
+
+/**
+ * @brief  初始化并创建工业设备主页
+ */
+void Ui_init(void)
+{
+    lv_obj_t * scr = lv_scr_act();
+
+    /* 默认深色背景 */
+    lv_obj_set_style_bg_color(scr, lv_color_hex(0x10151A), LV_STATE_DEFAULT);
+
+    /* 固定整屏, 防止左滑拖动页面 */
+    ui_fix_scroll(scr);
+
+    /* 构建布局 */
+    ui_build_status_bar(scr);
+    ui_build_menu(scr);
+    ui_build_content(scr);
+
+    /* 默认显示实时温度页面 */
+    Ui_temperature_create(s_content);
+
+    /* 刷新状态栏 (默认未就绪=红) */
+    ui_refresh_ready();
+
+    /* 立即计算并重绘一次, 避免首帧布局位置不正 */
+    lv_obj_update_layout(scr);
+    lv_refr_now(NULL);
+}
+
+/**
+ * @brief  设置顶部状态栏的就绪状态
+ */
+void Ui_set_ready(bool ready)
+{
+    s_ready = ready ? UI_READY_READY : UI_READY_NOT;
+    ui_refresh_ready();
+}

+ 52 - 0
LVGL8v3/ui/Ui_status.c

@@ -0,0 +1,52 @@
+/**
+  ******************************************************************************
+  * @file    Ui_status.c
+  * @brief   设备状态页面 (UI 页面层)
+  *
+  ******************************************************************************
+  */
+#include <stdio.h>
+#include "Ui_status.h"
+#include "Logic_temperature.h"
+
+/**
+ * @brief  在父容器内创建一行"标题: 值"的状态项
+ */
+static void ui_status_add_item(lv_obj_t * parent, const char * key, const char * value,
+                               lv_coord_t y, lv_color_t value_color)
+{
+    lv_obj_t * k = lv_label_create(parent);
+    lv_label_set_text(k, key);
+    lv_obj_set_style_text_font(k, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(k, lv_color_hex(0xA0A0A0), LV_STATE_DEFAULT);
+    lv_obj_set_pos(k, 10, y);
+
+    lv_obj_t * v = lv_label_create(parent);
+    lv_label_set_text(v, value);
+    lv_obj_set_style_text_font(v, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(v, value_color, LV_STATE_DEFAULT);
+    lv_obj_set_pos(v, 200, y);
+}
+
+/**
+ * @brief  在父容器内创建"Device Status"页面
+ * @param  parent : 父容器 (右侧内容区)
+ */
+void Ui_status_create(lv_obj_t * parent)
+{
+    lv_obj_t * title = lv_label_create(parent);
+    lv_label_set_text(title, "Device Status");
+    lv_obj_set_style_text_font(title, &lv_font_montserrat_20, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), LV_STATE_DEFAULT);
+    lv_obj_set_pos(title, 10, 10);
+
+    /* 状态信息 (假数据) */
+    lv_color_t ok_color = lv_color_hex(0x00E000);
+    lv_color_t gray     = lv_color_hex(0xE0E0E0);
+
+    ui_status_add_item(parent, "Status:", "Running", 60, gray);
+    ui_status_add_item(parent, "Power:", "OK", 100, ok_color);      //电源
+    ui_status_add_item(parent, "Comm:", "OK", 140, ok_color);       //通信
+    ui_status_add_item(parent, "Ready:", "Ready", 180, ok_color);
+
+}

+ 21 - 0
LVGL8v3/ui/Ui_status.h

@@ -0,0 +1,21 @@
+#ifndef __UI_STATUS_H
+#define __UI_STATUS_H
+
+#include "lvgl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  在父容器内创建"设备状态"页面
+ * @param  parent : 父容器 (右侧内容区)
+ * @retval 无
+ */
+void Ui_status_create(lv_obj_t * parent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UI_STATUS_H */

+ 240 - 0
LVGL8v3/ui/Ui_temp_setting.c

@@ -0,0 +1,240 @@
+/**
+  ******************************************************************************
+  * @file    Ui_temp_setting.c
+  * @brief   温度设置页面 (UI 页面层)
+  ******************************************************************************
+  */
+#include <stdio.h>
+#include "Ui_temp_setting.h"
+
+/* 目标温度范围 */
+#define UI_TSET_MIN         40
+#define UI_TSET_MAX         90
+#define UI_TSET_STEP        1
+
+/* 长按自动重复参数 */
+#define UI_TSET_T0          400     /* 首次重复周期 (ms) */
+#define UI_TSET_TMIN        40      /* 最快重复周期 (ms) */
+#define UI_TSET_TDEC        25      /* 每次重复周期缩短量 (ms) */
+#define UI_TSET_ACC_N       6       /* 每 N 次重复, 步进 +1 */
+#define UI_TSET_MAXSTEP     5       /* 最大单次步进 */
+
+/* 行布局 */
+#define UI_TSET_LABEL_X     20
+#define UI_TSET_BTN_MINUS_X 200
+#define UI_TSET_VAL_X       287
+#define UI_TSET_BTN_PLUS_X  360
+
+/* 全局句柄 */
+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;              /* 已重复次数 */
+
+/**
+ * @brief  刷新 CPU0 / CPU1 的目标温度数值显示
+ */
+static void ui_tset_refresh(void)
+{
+    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_cpu1);
+    lv_label_set_text(s_val_cpu1, buf);
+}
+
+/**
+ * @brief  对指定 CPU 的目标温度执行一次步进并限制范围
+ * @param  delta : 步进增量 (可为负)
+ * @param  which : 0=CPU0, 1=CPU1
+ */
+static void ui_tset_step(int delta, int which)
+{
+    int16_t * target = (which == 0) ? &s_target_cpu0 : &s_target_cpu1;
+    int16_t   v      = (int16_t)(*target + delta);
+    if (v < UI_TSET_MIN) { v = UI_TSET_MIN; }
+    if (v > UI_TSET_MAX) { v = UI_TSET_MAX; }
+    *target = v;
+    ui_tset_refresh();
+}
+
+/**
+ * @brief  长按重复定时器回调: 执行步进并加速
+ */
+static void ui_tset_repeat_timer_cb(lv_timer_t * t)
+{
+    if (s_active == 0xFF)
+    {
+        return;
+    }
+
+    int which = (int)(s_active >> 1);
+    int dir   = ((s_active & 1) ? 1 : -1);
+
+    /* 步进随重复次数增大 (变化越来越快) */
+    int step = UI_TSET_STEP + (int)(s_repeat / UI_TSET_ACC_N);
+    if (step > UI_TSET_MAXSTEP) { step = UI_TSET_MAXSTEP; }
+    ui_tset_step(dir * step, which);
+
+    s_repeat++;
+
+    /* 周期随之缩短 (加速), 到最小值为止 */
+    lv_coord_t p = (lv_coord_t)(UI_TSET_T0 - s_repeat * UI_TSET_TDEC);
+    if (p < UI_TSET_TMIN) { p = UI_TSET_TMIN; }
+    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)
+{
+    s_active = (uint8_t)((which << 1) | (dir > 0 ? 1 : 0));
+    s_repeat = 0;
+
+    /* 先立即执行一次 (单击也能 +1/-1) */
+    ui_tset_step(dir, which);
+
+    if (s_repeat_timer == NULL)
+    {
+        s_repeat_timer = lv_timer_create(ui_tset_repeat_timer_cb, UI_TSET_T0, NULL);
+        lv_timer_set_repeat_count(s_repeat_timer, -1);
+    }
+    else
+    {
+        lv_timer_reset(s_repeat_timer);
+        lv_timer_resume(s_repeat_timer);
+    }
+}
+
+/**
+ * @brief  释放/失去按钮: 停止自动重复
+ */
+static void ui_tset_release_cb(lv_event_t * e)
+{
+    (void)e;
+    s_active = 0xFF;
+    s_repeat = 0;
+    if (s_repeat_timer != NULL)
+    {
+        lv_timer_pause(s_repeat_timer);
+    }
+}
+
+/**
+ * @brief  递减按钮按下事件回调
+ */
+static void ui_tset_minus_press_cb(lv_event_t * e)
+{
+    uint32_t which = (uint32_t)(uintptr_t)lv_event_get_user_data(e);
+    ui_tset_press((int)which, -1);
+}
+
+/**
+ * @brief  递增按钮按下事件回调
+ */
+static void ui_tset_plus_press_cb(lv_event_t * e)
+{
+    uint32_t which = (uint32_t)(uintptr_t)lv_event_get_user_data(e);
+    ui_tset_press((int)which, +1);
+}
+
+/**
+ * @brief  构建一行目标温度设置
+ * @param  parent  : 父容器
+ * @param  name    : CPU 名称 (CPU0/CPU1)
+ * @param  which   : 0=CPU0, 1=CPU1
+ * @param  y       : 行顶部 y 坐标
+ * @param  val_ptr : 指向数值标签句柄
+ */
+static void ui_tset_add_row(lv_obj_t * parent, const char * name, uint32_t which,
+                            lv_coord_t y, lv_obj_t ** val_ptr)
+{
+    /* 名称 */
+    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, lv_color_hex(0xE0E0E0), LV_STATE_DEFAULT);
+    lv_obj_set_pos(lbl, UI_TSET_LABEL_X, y);
+
+    /* 递减按钮 "-" (长按自动减) */
+    lv_obj_t * minus = lv_btn_create(parent);
+    lv_obj_set_size(minus, 48, 40);
+    lv_obj_set_pos(minus, UI_TSET_BTN_MINUS_X, y - 6);
+    lv_obj_add_event_cb(minus, ui_tset_minus_press_cb, LV_EVENT_PRESSED, (void *)(uintptr_t)which);
+    lv_obj_add_event_cb(minus, ui_tset_release_cb, LV_EVENT_RELEASED, NULL);
+    lv_obj_add_event_cb(minus, ui_tset_release_cb, LV_EVENT_PRESS_LOST, NULL);
+    lv_obj_t * ml = lv_label_create(minus);
+    lv_label_set_text(ml, "-");
+    lv_obj_center(ml);
+
+    /* 数值标签 */
+    lv_obj_t * val = lv_label_create(parent);
+    lv_obj_set_style_text_font(val, &lv_font_montserrat_20, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(val, lv_color_hex(0xFFFFFF), LV_STATE_DEFAULT);
+    lv_obj_set_pos(val, UI_TSET_VAL_X, y);
+    *val_ptr = val;
+
+    /* 递增按钮 "+" (长按自动加) */
+    lv_obj_t * plus = lv_btn_create(parent);
+    lv_obj_set_size(plus, 48, 40);
+    lv_obj_set_pos(plus, UI_TSET_BTN_PLUS_X, y - 6);
+    lv_obj_add_event_cb(plus, ui_tset_plus_press_cb, LV_EVENT_PRESSED, (void *)(uintptr_t)which);
+    lv_obj_add_event_cb(plus, ui_tset_release_cb, LV_EVENT_RELEASED, NULL);
+    lv_obj_add_event_cb(plus, ui_tset_release_cb, LV_EVENT_PRESS_LOST, NULL);
+    lv_obj_t * pl = lv_label_create(plus);
+    lv_label_set_text(pl, "+");
+    lv_obj_center(pl);
+}
+
+/**
+ * @brief  Apply 按钮事件回调 (假数据)
+ */
+static void ui_tset_apply_cb(lv_event_t * e)
+{
+    (void)e;
+    /* TODO: 将目标温度写入逻辑层/控制层 */
+}
+
+/**
+ * @brief  在父容器内创建"温度设置"页面
+ * @param  parent : 父容器 (右侧内容区)
+ */
+void Ui_temp_setting_create(lv_obj_t * parent)
+{
+    lv_obj_t * title = lv_label_create(parent);
+    lv_label_set_text(title, "Temperature Setting");
+    lv_obj_set_style_text_font(title, &lv_font_montserrat_20, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), LV_STATE_DEFAULT);
+    lv_obj_set_pos(title, 10, 10);
+
+    /* CPU0 / CPU1 目标温度行 */
+    ui_tset_add_row(parent, "CPU0 Target:", 0, 80, &s_val_cpu0);
+    ui_tset_add_row(parent, "CPU1 Target:", 1, 150, &s_val_cpu1);
+
+    /* Apply 按钮 */
+    lv_obj_t * apply = lv_btn_create(parent);
+    lv_obj_set_size(apply, 120, 44);
+    lv_obj_set_pos(apply, UI_TSET_LABEL_X, 240);
+    lv_obj_add_event_cb(apply, ui_tset_apply_cb, LV_EVENT_CLICKED, NULL);
+    lv_obj_t * al = lv_label_create(apply);
+    lv_label_set_text(al, "Apply");
+    lv_obj_set_style_text_font(al, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_center(al);
+
+    /* 范围说明 */
+    lv_obj_t * hint = lv_label_create(parent);
+    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, lv_color_hex(0x808080), LV_STATE_DEFAULT);
+    lv_obj_set_pos(hint, UI_TSET_LABEL_X, 210);
+
+    /* 初始显示 */
+    ui_tset_refresh();
+}

+ 21 - 0
LVGL8v3/ui/Ui_temp_setting.h

@@ -0,0 +1,21 @@
+#ifndef __UI_TEMP_SETTING_H
+#define __UI_TEMP_SETTING_H
+
+#include "lvgl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  在父容器内创建"温度设置"页面
+ * @param  parent : 父容器 (右侧内容区)
+ * @retval 无
+ */
+void Ui_temp_setting_create(lv_obj_t * parent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UI_TEMP_SETTING_H */

+ 193 - 0
LVGL8v3/ui/Ui_temperature.c

@@ -0,0 +1,193 @@
+/**
+  ******************************************************************************
+  * @file    Ui_temperature.c
+  * @brief   实时温度页面 (UI 页面层)
+  ******************************************************************************
+  */
+#include <stdio.h>
+#include "Ui_temperature.h"
+#include "Logic_temperature.h"
+
+/* 每页显示的通道数 = 4 行 x 2 列 = 8 条 */
+#define UI_TEMP_PAGE_NUM        8
+#define UI_TEMP_ROW_CNT         4
+#define UI_TEMP_COL_CNT         2
+
+/* 左侧箭头 / 右侧箭头宽度 */
+#define UI_TEMP_NAV_W           70
+
+/* 数据区行列位置 */
+#define UI_TEMP_SW_X1           110
+#define UI_TEMP_SW_X2           350
+#define UI_TEMP_SW_Y_BASE       50
+#define UI_TEMP_SW_H            95
+
+/* 色卡尺寸 */
+#define UI_TEMP_SW_SIZE         22
+
+/* 全局句柄 */
+static lv_obj_t * s_temp_labels[UI_TEMP_PAGE_NUM];   /* 8 个温度数据标签 */
+static lv_obj_t * s_temp_swatch[UI_TEMP_PAGE_NUM];   /* 8 个色卡 */
+static lv_obj_t * s_page_label  = NULL;              /* 页码指示 (如 1/4) */
+static uint8_t    s_page_start  = 0;                 /* 当前页起始通道 (0/8/16/24) */
+
+/* 上一页 / 下一页最大起始通道 */
+#define UI_TEMP_PAGE_STEP       8
+#define UI_TEMP_PAGE_MAX        (LOGIC_TEMP_TOTAL_CH - UI_TEMP_PAGE_NUM)   /* 24 */
+
+/**
+ * @brief  根据全局通道号生成固定颜色 (HSV -> RGB)
+ * @param  ch : 全局通道号 (0 ~ 31)
+ */
+static lv_color_t ui_temp_ch_color(uint8_t ch)
+{
+    /* 每通道区分色相, 保证各通道固定且互不相同 */
+    uint16_t hue = (uint16_t)(ch * (360U / LOGIC_TEMP_TOTAL_CH));
+    return lv_color_hsv_to_rgb(hue, 100, 100);
+}
+
+/**
+ * @brief  刷新当前页的温度数据显示
+ */
+static void ui_temp_refresh(void)
+{
+    uint8_t i;
+    for (i = 0; i < UI_TEMP_PAGE_NUM; i++)
+    {
+        uint8_t ch     = s_page_start + i;              /* 全局通道号 */
+        int8_t  cpu    = Logic_temperature_get_cpu(ch); /* 0=CPU0, 1=CPU1 */
+        uint8_t ch_in  = (uint8_t)(ch % LOGIC_TEMP_CPU_CH_COUNT) + 1;  /* CPU 内 1~16 */
+        int8_t  t      = Logic_temperature_get(ch);
+        char buf[24];
+
+        snprintf(buf, sizeof(buf), "CPU%d CH%d: %d", (int)cpu, (int)ch_in, (int)t);
+        lv_label_set_text(s_temp_labels[i], buf);
+
+        /* 色卡: 固定通道色 */
+        lv_obj_set_style_bg_color(s_temp_swatch[i], ui_temp_ch_color(ch), LV_STATE_DEFAULT);
+    }
+
+    /* 页码指示: 当前页 / 总页数 */
+    if (s_page_label != NULL)
+    {
+        char page_buf[16];
+        snprintf(page_buf, sizeof(page_buf), "%d/%d",
+                 (int)(s_page_start / UI_TEMP_PAGE_STEP) + 1,
+                 (int)(LOGIC_TEMP_TOTAL_CH / UI_TEMP_PAGE_NUM));
+        lv_label_set_text(s_page_label, page_buf);
+    }
+}
+
+/**
+ * @brief  左箭头按钮事件回调: 上一页
+ */
+static void ui_temp_prev_cb(lv_event_t * e)
+{
+    (void)e;
+    if (s_page_start >= UI_TEMP_PAGE_STEP)
+    {
+        s_page_start -= UI_TEMP_PAGE_STEP;
+    }
+    else
+    {
+        s_page_start = UI_TEMP_PAGE_MAX;   /* 到首页后再按, 跳到最后页 */
+    }
+    ui_temp_refresh();
+}
+
+/**
+ * @brief  右箭头按钮事件回调: 下一页
+ */
+static void ui_temp_next_cb(lv_event_t * e)
+{
+    (void)e;
+    if (s_page_start < UI_TEMP_PAGE_MAX)
+    {
+        s_page_start += UI_TEMP_PAGE_STEP;
+    }
+    else
+    {
+        s_page_start = 0;                  /* 到末页后再按, 回到首页 */
+    }
+    ui_temp_refresh();
+}
+
+/**
+ * @brief  构建一个箭头导航按钮
+ * @param  parent : 父容器 (右侧内容区)
+ * @param  ch     : 箭头字符 (LV_SYMBOL_LEFT / LV_SYMBOL_RIGHT)
+ * @param  x      : 按钮 x 坐标
+ * @param  cb     : 点击回调
+ */
+static void ui_temp_build_nav_btn(lv_obj_t * parent, const char * ch, lv_coord_t x,
+                                  lv_event_cb_t cb)
+{
+    lv_obj_t * btn = lv_btn_create(parent);
+    lv_obj_set_size(btn, UI_TEMP_NAV_W, 200);
+    lv_obj_set_pos(btn, x, 100);
+    lv_obj_add_event_cb(btn, cb, LV_EVENT_CLICKED, NULL);
+
+    lv_obj_t * lbl = lv_label_create(btn);
+    lv_label_set_text(lbl, ch);
+    lv_obj_set_style_text_font(lbl, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_center(lbl);
+}
+
+/**
+ * @brief  在父容器内创建"实时温度"页面
+ * @param  parent : 父容器 (右侧内容区)
+ */
+void Ui_temperature_create(lv_obj_t * parent)
+{
+    uint8_t r, c, i = 0;
+
+    /* 左侧"上一页"整列箭头 */
+    ui_temp_build_nav_btn(parent, LV_SYMBOL_LEFT, 10, ui_temp_prev_cb);
+
+    /* 右侧"下一页"整列箭头 */
+    ui_temp_build_nav_btn(parent, LV_SYMBOL_RIGHT, 545, ui_temp_next_cb);
+
+    /* 中间 4 行 x 2 列 共 8 条温度数据 (每条: 色卡 + 文本) */
+    for (r = 0; r < UI_TEMP_ROW_CNT; r++)
+    {
+        for (c = 0; c < UI_TEMP_COL_CNT; c++)
+        {
+            lv_coord_t x = (c == 0) ? UI_TEMP_SW_X1 : UI_TEMP_SW_X2;
+            lv_coord_t y = UI_TEMP_SW_Y_BASE + r * UI_TEMP_SW_H;
+
+            /* 色卡 (固定通道色的纯色圆点, 清除全部默认主题视觉) */
+            lv_obj_t * sw = lv_obj_create(parent);
+            lv_obj_set_size(sw, UI_TEMP_SW_SIZE, UI_TEMP_SW_SIZE);
+            lv_obj_set_pos(sw, x, y);
+            lv_obj_set_style_radius(sw, LV_RADIUS_CIRCLE, LV_STATE_DEFAULT);
+            lv_obj_set_style_bg_opa(sw, LV_OPA_COVER, LV_STATE_DEFAULT);
+            lv_obj_set_style_border_width(sw, 0, LV_STATE_DEFAULT);
+            lv_obj_set_style_border_opa(sw, LV_OPA_TRANSP, LV_STATE_DEFAULT);
+            lv_obj_set_style_shadow_width(sw, 0, LV_STATE_DEFAULT);
+            lv_obj_set_style_shadow_opa(sw, LV_OPA_TRANSP, LV_STATE_DEFAULT);
+            lv_obj_set_style_outline_width(sw, 0, LV_STATE_DEFAULT);
+            lv_obj_set_style_pad_all(sw, 0, LV_STATE_DEFAULT);
+            lv_obj_clear_flag(sw, LV_OBJ_FLAG_SCROLLABLE);
+            lv_obj_set_scrollbar_mode(sw, LV_SCROLLBAR_MODE_OFF);
+            s_temp_swatch[i] = sw;
+
+            /* 文字: "CPUx CHn: 温度" */
+            lv_obj_t * lbl = lv_label_create(parent);
+            lv_obj_set_pos(lbl, x + UI_TEMP_SW_SIZE + 10, y);
+            lv_obj_set_style_text_font(lbl, &lv_font_montserrat_20, LV_STATE_DEFAULT);
+            lv_obj_set_style_text_color(lbl, lv_color_hex(0xE0E0E0), LV_STATE_DEFAULT);
+            s_temp_labels[i] = lbl;
+            i++;
+        }
+    }
+
+    /* 页码指示 (右下角) */
+    s_page_label = lv_label_create(parent);
+    lv_obj_set_style_text_font(s_page_label, &lv_font_montserrat_16, LV_STATE_DEFAULT);
+    lv_obj_set_style_text_color(s_page_label, lv_color_hex(0x808080), LV_STATE_DEFAULT);
+    lv_obj_align(s_page_label, LV_ALIGN_BOTTOM_RIGHT, -20, -10);
+
+    /* 初始显示 */
+    s_page_start = 0;
+    ui_temp_refresh();
+}

+ 21 - 0
LVGL8v3/ui/Ui_temperature.h

@@ -0,0 +1,21 @@
+#ifndef __UI_TEMPERATURE_H
+#define __UI_TEMPERATURE_H
+
+#include "lvgl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  在父容器内创建"实时温度"页面
+ * @param  parent : 父容器 (右侧内容区)
+ * @retval 无
+ */
+void Ui_temperature_create(lv_obj_t * parent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UI_TEMPERATURE_H */

+ 36 - 0
LVGL8v3/ui/ui.h

@@ -0,0 +1,36 @@
+/**
+  ******************************************************************************
+  * @file    Ui.h
+  * @brief   UI 页面层统一对外接口
+  *
+  * @note    供应用层 (App) 调用, 初始化工业设备主页。
+  *          主页包含: 顶部状态栏 + 左侧菜单栏 + 右侧内容区。
+  ******************************************************************************
+  */
+#ifndef __UI_H
+#define __UI_H
+
+#include "lvgl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  初始化并创建工业设备主页 (应在此前完成 lv_init 与 lv_port_disp_init)
+ * @retval 无
+ */
+void Ui_init(void);
+
+/**
+ * @brief  设置顶部状态栏的就绪状态 (值会被刷新显示)
+ * @param  ready : 1 = 就绪 (绿色), 0 = 未就绪 (红色)
+ * @retval 无
+ */
+void Ui_set_ready(bool ready);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UI_H */

+ 36 - 1
MDK-ARM/STMH7_temperature_control_board.uvprojx

@@ -341,7 +341,7 @@
               <MiscControls>--diag_suppress=1041</MiscControls>
               <MiscControls>--diag_suppress=1041</MiscControls>
               <Define>USE_PWR_LDO_SUPPLY,USE_HAL_DRIVER,STM32H743xx,LV_LVGL_H_INCLUDE_SIMPLE</Define>
               <Define>USE_PWR_LDO_SUPPLY,USE_HAL_DRIVER,STM32H743xx,LV_LVGL_H_INCLUDE_SIMPLE</Define>
               <Undefine></Undefine>
               <Undefine></Undefine>
-              <IncludePath>../Core/Inc;../Int/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32H7xx/Include;../Drivers/CMSIS/Include;../FreeRTOS;../FreeRTOS/include;../FreeRTOS/portable/RVDS/ARM_CM7/r0p1;../App/Inc;../LVGL8v3;../LVGL8v3/examples/porting;../LVGL8v3/src</IncludePath>
+              <IncludePath>../Core/Inc;../Int/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc;../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32H7xx/Include;../Drivers/CMSIS/Include;../FreeRTOS;../FreeRTOS/include;../FreeRTOS/portable/RVDS/ARM_CM7/r0p1;../App/Inc;../LVGL8v3;../LVGL8v3/examples/porting;../LVGL8v3/src;..\LVGL8v3\ui;..\LVGL8v3\logic</IncludePath>
             </VariousControls>
             </VariousControls>
           </Cads>
           </Cads>
           <Aads>
           <Aads>
@@ -1900,6 +1900,41 @@
             </File>
             </File>
           </Files>
           </Files>
         </Group>
         </Group>
+        <Group>
+          <GroupName>LVGL/ui</GroupName>
+          <Files>
+            <File>
+              <FileName>Ui.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LVGL8v3\ui\Ui.c</FilePath>
+            </File>
+            <File>
+              <FileName>Ui_temperature.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LVGL8v3\ui\Ui_temperature.c</FilePath>
+            </File>
+            <File>
+              <FileName>Ui_status.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LVGL8v3\ui\Ui_status.c</FilePath>
+            </File>
+            <File>
+              <FileName>Ui_temp_setting.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LVGL8v3\ui\Ui_temp_setting.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>LVGL/logic</GroupName>
+          <Files>
+            <File>
+              <FileName>Logic_temperature.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LVGL8v3\logic\Logic_temperature.c</FilePath>
+            </File>
+          </Files>
+        </Group>
         <Group>
         <Group>
           <GroupName>::CMSIS</GroupName>
           <GroupName>::CMSIS</GroupName>
         </Group>
         </Group>