优化整定一版

This commit is contained in:
冯佳
2025-12-18 23:56:36 +08:00
parent e5eaf2172f
commit e36b4e0e27
16 changed files with 2619 additions and 504 deletions

39
src/param/menu_param.h Normal file
View File

@ -0,0 +1,39 @@
/**
* @file menu_param.h
* @brief 菜单参数管理内部类型定义(用户无需关心)
*/
#ifndef MENU_PARAM_H
#define MENU_PARAM_H
#include "menu_core.h"
#include <stdint.h>
#include <stdbool.h>
/**
* @brief 参数值共用体(支持多种数据类型)
*/
typedef union {
int8_t i8; ///< 8位有符号整数
uint8_t u8; ///< 8位无符号整数
int16_t i16; ///< 16位有符号整数
uint16_t u16; ///< 16位无符号整数
int32_t i32; ///< 32位有符号整数
uint32_t u32; ///< 32位无符号整数
float f; ///< 浮点数
} MenuParamValue;
/**
* @brief 参数结构体(参数管理的核心单元)
*/
typedef struct {
uint16_t id; ///< 参数ID唯一
MenuParamType type; ///< 参数类型
MenuParamValue value; ///< 当前值
MenuParamValue default_val;///< 默认值
float min_val; ///< 最小值(浮点表示)
float max_val; ///< 最大值(浮点表示)
float scale; ///< 缩放因子
bool is_registered : 1; ///< 是否已注册
} MenuParam;
#endif // MENU_PARAM_H