fix: 修复串口屏文本编译错误+完善按摩仪文本配置

1. 修复GBK文本数组多重定义编译错误(拆分.h/.c文件)
2. 修复sizeof计算不完整类型错误(预计算文本长度)
3. 新增按摩仪界面所需的全部中文文本定义
This commit is contained in:
2026-02-16 00:36:10 +08:00
parent 87478484ca
commit 6b3c37263a
5 changed files with 212 additions and 137 deletions

View File

@@ -3,125 +3,70 @@
#include <stdint.h>
// 对应文本UTF8智能按摩仪
// 对应GBK编码0xD6, 0xC7, 0xC4, 0xDC, 0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xC7
const uint8_t text_device_name_GBK[] = {0xD6, 0xC7, 0xC4, 0xDC, 0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xC7};
#define text_device_name_LEN (sizeof(text_device_name_GBK))
// GBK文本数组声明定义在gbk_text.c中
extern const uint8_t text_device_name_GBK[];
extern const uint8_t text_device_loading_GBK[];
extern const uint8_t text_start_massage_GBK[];
extern const uint8_t text_start_heating_GBK[];
extern const uint8_t text_stop_massage_GBK[];
extern const uint8_t text_stop_heating_GBK[];
extern const uint8_t text_massage_gear_1_GBK[];
extern const uint8_t text_massage_gear_2_GBK[];
extern const uint8_t text_massage_gear_3_GBK[];
extern const uint8_t text_massage_time_10_GBK[];
extern const uint8_t text_massage_time_15_GBK[];
extern const uint8_t text_massage_time_20_GBK[];
extern const uint8_t text_massage_time_30_GBK[];
extern const uint8_t text_massage_time_cont_GBK[];
extern const uint8_t text_remaining_time_GBK[];
extern const uint8_t text_heating_on_GBK[];
extern const uint8_t text_heating_off_GBK[];
extern const uint8_t text_massage_running_GBK[];
extern const uint8_t text_massage_paused_GBK[];
extern const uint8_t text_massage_ended_GBK[];
// GBK文本长度宏预计算不含\0
#define text_device_name_LEN (10)
#define text_device_loading_LEN (16)
#define text_start_massage_LEN (8)
#define text_start_heating_LEN (8)
#define text_stop_massage_LEN (8)
#define text_stop_heating_LEN (8)
#define text_massage_gear_1_LEN (13)
#define text_massage_gear_2_LEN (13)
#define text_massage_gear_3_LEN (13)
#define text_massage_time_10_LEN (16)
#define text_massage_time_15_LEN (16)
#define text_massage_time_20_LEN (16)
#define text_massage_time_30_LEN (16)
#define text_massage_time_cont_LEN (14)
#define text_remaining_time_LEN (18)
#define text_heating_on_LEN (10)
#define text_heating_off_LEN (10)
#define text_massage_running_LEN (6)
#define text_massage_paused_LEN (10)
#define text_massage_ended_LEN (10)
// 兼容旧代码的别名
#define text_device_name text_device_name_GBK
// 对应文本UTF8设备加载中请稍候
// 对应GBK编码0xC9, 0xE8, 0xB1, 0xB8, 0xBC, 0xD3, 0xD4, 0xD8, 0xD6, 0xD0, 0xC7, 0xEB, 0xC9, 0xD4, 0xBA, 0xF2
const uint8_t text_device_loading_GBK[] = {0xC9, 0xE8, 0xB1, 0xB8, 0xBC, 0xD3, 0xD4, 0xD8, 0xD6, 0xD0, 0xC7, 0xEB, 0xC9, 0xD4, 0xBA, 0xF2};
#define text_device_loading_LEN (sizeof(text_device_loading_GBK))
#define text_device_loading text_device_loading_GBK
// 对应文本UTF8开始按摩
// 对应GBK编码0xBF, 0xAA, 0xCA, 0xBC, 0xB0, 0xB4, 0xC4, 0xA6
const uint8_t text_start_massage_GBK[] = {0xBF, 0xAA, 0xCA, 0xBC, 0xB0, 0xB4, 0xC4, 0xA6};
#define text_start_massage_LEN (sizeof(text_start_massage_GBK))
#define text_start_massage text_start_massage_GBK
// 对应文本UTF8开始加热
// 对应GBK编码0xBF, 0xAA, 0xCA, 0xBC, 0xBC, 0xD3, 0xC8, 0xC8
const uint8_t text_start_heating_GBK[] = {0xBF, 0xAA, 0xCA, 0xBC, 0xBC, 0xD3, 0xC8, 0xC8};
#define text_start_heating_LEN (sizeof(text_start_heating_GBK))
#define text_start_heating text_start_heating_GBK
// 对应文本UTF8停止按摩
// 对应GBK编码0xCD, 0xA3, 0xD6, 0xB9, 0xB0, 0xB4, 0xC4, 0xA6
const uint8_t text_stop_massage_GBK[] = {0xCD, 0xA3, 0xD6, 0xB9, 0xB0, 0xB4, 0xC4, 0xA6};
#define text_stop_massage_LEN (sizeof(text_stop_massage_GBK))
#define text_stop_massage text_stop_massage_GBK
// 对应文本UTF8停止加热
// 对应GBK编码0xCD, 0xA3, 0xD6, 0xB9, 0xBC, 0xD3, 0xC8, 0xC8
const uint8_t text_stop_heating_GBK[] = {0xCD, 0xA3, 0xD6, 0xB9, 0xBC, 0xD3, 0xC8, 0xC8};
#define text_stop_heating_LEN (sizeof(text_stop_heating_GBK))
#define text_stop_heating text_stop_heating_GBK
// 对应文本UTF8按摩档位1级
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x31, 0xBC, 0xB6
const uint8_t text_massage_gear_1_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x31, 0xBC, 0xB6};
#define text_massage_gear_1_LEN (sizeof(text_massage_gear_1_GBK))
#define text_massage_gear_1 text_massage_gear_1_GBK
// 对应文本UTF8按摩档位2级
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x32, 0xBC, 0xB6
const uint8_t text_massage_gear_2_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x32, 0xBC, 0xB6};
#define text_massage_gear_2_LEN (sizeof(text_massage_gear_2_GBK))
#define text_massage_gear_2 text_massage_gear_2_GBK
// 对应文本UTF8按摩档位3级
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x33, 0xBC, 0xB6
const uint8_t text_massage_gear_3_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x33, 0xBC, 0xB6};
#define text_massage_gear_3_LEN (sizeof(text_massage_gear_3_GBK))
#define text_massage_gear_3 text_massage_gear_3_GBK
// 对应文本UTF8按摩时间10分钟
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x30, 0xB7, 0xD6, 0xD6, 0xD3
const uint8_t text_massage_time_10_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x30, 0xB7, 0xD6, 0xD6, 0xD3};
#define text_massage_time_10_LEN (sizeof(text_massage_time_10_GBK))
#define text_massage_time_10 text_massage_time_10_GBK
// 对应文本UTF8按摩时间15分钟
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x35, 0xB7, 0xD6, 0xD6, 0xD3
const uint8_t text_massage_time_15_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x35, 0xB7, 0xD6, 0xD6, 0xD3};
#define text_massage_time_15_LEN (sizeof(text_massage_time_15_GBK))
#define text_massage_time_15 text_massage_time_15_GBK
// 对应文本UTF8按摩时间20分钟
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x32, 0x30, 0xB7, 0xD6, 0xD6, 0xD3
const uint8_t text_massage_time_20_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x32, 0x30, 0xB7, 0xD6, 0xD6, 0xD3};
#define text_massage_time_20_LEN (sizeof(text_massage_time_20_GBK))
#define text_massage_time_20 text_massage_time_20_GBK
// 对应文本UTF8按摩时间30分钟
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x33, 0x30, 0xB7, 0xD6, 0xD6, 0xD3
const uint8_t text_massage_time_30_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x33, 0x30, 0xB7, 0xD6, 0xD6, 0xD3};
#define text_massage_time_30_LEN (sizeof(text_massage_time_30_GBK))
#define text_massage_time_30 text_massage_time_30_GBK
// 对应文本UTF8按摩时间持续
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0xB3, 0xD6, 0xD0, 0xF8
const uint8_t text_massage_time_cont_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0xB3, 0xD6, 0xD0, 0xF8};
#define text_massage_time_cont_LEN (sizeof(text_massage_time_cont_GBK))
#define text_massage_time_cont text_massage_time_cont_GBK
// 对应文本UTF8剩余按摩时间为%d
// 对应GBK编码0xCA, 0xA3, 0xD3, 0xE0, 0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xCE, 0xAA, 0xA3, 0xBA, 0x25, 0x64
const uint8_t text_remaining_time_GBK[] = {0xCA, 0xA3, 0xD3, 0xE0, 0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xCE, 0xAA, 0xA3, 0xBA, 0x25, 0x64};
#define text_remaining_time_LEN (sizeof(text_remaining_time_GBK))
#define text_remaining_time text_remaining_time_GBK
// 对应文本UTF8加热已开启
// 对应GBK编码0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xBF, 0xAA, 0xC6, 0xF4
const uint8_t text_heating_on_GBK[] = {0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xBF, 0xAA, 0xC6, 0xF4};
#define text_heating_on_LEN (sizeof(text_heating_on_GBK))
#define text_heating_on text_heating_on_GBK
// 对应文本UTF8加热已关闭
// 对应GBK编码0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xB9, 0xD8, 0xB1, 0xD5
const uint8_t text_heating_off_GBK[] = {0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xB9, 0xD8, 0xB1, 0xD5};
#define text_heating_off_LEN (sizeof(text_heating_off_GBK))
#define text_heating_off text_heating_off_GBK
// 对应文本UTF8按摩中
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xD6, 0xD0
const uint8_t text_massage_running_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xD6, 0xD0};
#define text_massage_running_LEN (sizeof(text_massage_running_GBK))
#define text_massage_running text_massage_running_GBK
// 对应文本UTF8按摩已暂停
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xD4, 0xDD, 0xCD, 0xA3
const uint8_t text_massage_paused_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xD4, 0xDD, 0xCD, 0xA3};
#define text_massage_paused_LEN (sizeof(text_massage_paused_GBK))
#define text_massage_paused text_massage_paused_GBK
// 对应文本UTF8按摩已结束
// 对应GBK编码0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xBD, 0xE1, 0xCA, 0xF8
const uint8_t text_massage_ended_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xBD, 0xE1, 0xCA, 0xF8};
#define text_massage_ended_LEN (sizeof(text_massage_ended_GBK))
#define text_massage_ended text_massage_ended_GBK
#endif // __GBK_TEXT_H__