| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /**
- ******************************************************************************
- * @file Logic_temperature.c
- * @brief 温度数据逻辑层 (Logic)
- *
- * @note 实时温度取自 CPLD 快照 "24 路 BMC 原始温度读数" (Mid_temp 缓存);
- * 预加热温度取自 CT7428 (映射暂定 = 前 4 路)。
- * 无数据/无效统一返回 LOGIC_TEMP_INVALID, UI 层显示 "--°C"。
- ******************************************************************************
- */
- #include <stdio.h>
- #include "lvgl.h"
- #include "Logic_temperature.h"
- #include "Mid_temp.h"
- /**
- * @brief 获取指定通道的温度值
- * @note 真实数据源: CPLD 快照 24 路 BMC 原始温度读数 (值即摄氏度,
- * 经 Mid_temp 缓存); 无数据/通道无效返回 LOGIC_TEMP_INVALID
- * @param ch : 通道号 (0 ~ 23)
- * @retval 温度值 (摄氏度), 越界返回 LOGIC_TEMP_INVALID
- */
- int8_t Logic_temperature_get(uint8_t ch)
- {
- if (ch >= LOGIC_TEMP_TOTAL_CH)
- {
- return LOGIC_TEMP_INVALID;
- }
- return (int8_t)Mid_Temp_GetBmcTemp(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;
- }
- /**
- * @brief 获取预加热传感器的温度值
- * @note 真实数据源: CPLD 快照内 CT7428 (经 Mid_temp 缓存,
- * 映射暂定 = 前 4 路, 见 Mid_temp.h); 无数据/无效返回 LOGIC_TEMP_INVALID
- * @param idx : 序号 (0 ~ LOGIC_PREHEAT_TEMP_NUM-1); 0/1 = CPU0, 2/3 = CPU1
- * @retval 温度值 (摄氏度), 越界返回 LOGIC_TEMP_INVALID
- */
- int8_t Logic_preheat_get(uint8_t idx)
- {
- if (idx >= LOGIC_PREHEAT_TEMP_NUM)
- {
- return LOGIC_TEMP_INVALID;
- }
- return (int8_t)Mid_Temp_GetPreheat(idx);
- }
|