增加modbus绑定

This commit is contained in:
冯佳
2025-12-18 22:24:25 +08:00
parent 9773cb5a0a
commit e5eaf2172f
13 changed files with 1443 additions and 216 deletions

View File

@ -11,7 +11,7 @@
MenuParam s_menu_params[MENU_CONFIG_MAX_PARAMS];
/**
* @brief 查找参数通过参数ID
* @brief 查找参数通过参数ID,内部使用
* @param param_id 参数ID
* @return 参数指针NULL表示未找到
*/
@ -299,4 +299,29 @@ MenuErrCode menu_param_decrease(uint16_t param_id, float step)
return menu_param_set_value(param_id, current_val - step);
}
/**
* @brief 获取参数类型
* @param param_id 参数ID
* @param type 输出参数,参数类型
* @return 错误码
*/
MenuErrCode menu_param_get_type(uint16_t param_id, MenuParamType* type)
{
if (type == NULL)
{
return MENU_ERR_INVALID_PARAM;
}
// 查找参数
MenuParam* param = menu_param_find(param_id);
if (param == NULL)
{
return MENU_ERR_NODE_NOT_FOUND;
}
// 返回参数类型
*type = param->type;
return MENU_OK;
}
#endif // MENU_CONFIG_ENABLE_PARAM