删除测温ADC,更改加热引脚与状态跟初始电平,优化屏幕显示函数,增加 用UFT8转GBK的Python脚本,测试有效,实际使用待完善

This commit is contained in:
2026-02-15 23:31:34 +08:00
parent f275a5aad9
commit 05eec1f08b
191 changed files with 716 additions and 652 deletions

View File

@@ -1,52 +0,0 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.h
* @brief This file contains all the function prototypes for
* the adc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADC_H__
#define __ADC_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern ADC_HandleTypeDef hadc1;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_ADC1_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __ADC_H__ */

127
Core/Inc/gbk_text.h Normal file
View File

@@ -0,0 +1,127 @@
#ifndef __GBK_TEXT_H__
#define __GBK_TEXT_H__
#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))
#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__

View File

@@ -57,8 +57,6 @@ void Error_Handler(void);
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define HOT_Pin GPIO_PIN_1
#define HOT_GPIO_Port GPIOA
#define RUN_LED_Pin GPIO_PIN_12
#define RUN_LED_GPIO_Port GPIOB
#define ERR_LED_Pin GPIO_PIN_13
@@ -71,6 +69,8 @@ void Error_Handler(void);
#define HOT_KEY_GPIO_Port GPIOC
#define TIME_KEY_Pin GPIO_PIN_9
#define TIME_KEY_GPIO_Port GPIOC
#define HOT_Pin GPIO_PIN_8
#define HOT_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */

View File

@@ -16,6 +16,11 @@ extern "C" {
#include <stdint.h>
/* 颜色使用统一的标志 */
#define TEXT_COLOR 15 /* 白色 */
#define BG_COLOR 0 /* 黑色 */
/**
* @brief 发送原始命令字符串到屏幕(阻塞直到发送完成)
@@ -24,6 +29,7 @@ extern "C" {
*/
int Screen_SendCmd(const char *cmd);
void Screen_Init(void);
/* 常用封装 - 简短说明见各函数 */
/** 清屏layer: 要清除的层号通常为0 */
@@ -47,7 +53,7 @@ void Screen_BoxFill(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t
void Screen_Circle(uint16_t x, uint16_t y, uint16_t r, uint8_t color);
void Screen_CircleFill(uint16_t x, uint16_t y, uint16_t r, uint8_t color);
void Screen_SetBGColor(uint8_t color);
void Screen_DrawText16V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk_buf, uint16_t gbk_len, uint8_t color);
/* 带/不带背景的文本 */
void Screen_DrawText16V(uint16_t x, uint16_t y, const char *text, uint8_t color);
void Screen_DrawText24(uint16_t x, uint16_t y, const char *text, uint8_t color);
@@ -66,6 +72,19 @@ void Screen_QRCodeEx(uint16_t x, uint16_t y, const char *url, uint16_t size, uin
/* 版本信息 */
void Screen_Ver(void);
// GBK
void Screen_DrawText16_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
void Screen_DrawText16V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
void Screen_DrawText24_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
void Screen_DrawText24V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
void Screen_DrawText32_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
void Screen_DrawText32V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
void Screen_DrawText48_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color,uint8_t transparent);
#ifdef __cplusplus
}
#endif

View File

@@ -34,7 +34,7 @@
*/
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
/*#define HAL_ADC_MODULE_ENABLED */
/*#define HAL_CRYP_MODULE_ENABLED */
/*#define HAL_CAN_MODULE_ENABLED */
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */

View File

@@ -22,7 +22,7 @@
#define __STM32F1xx_IT_H
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
/* Private includes ----------------------------------------------------------*/