64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
/**
|
||
* @file app.c
|
||
* @author xxx
|
||
* @date 2023-08-30 08:58:43
|
||
* @brief app初始化和app启动
|
||
* @copyright Copyright (c) 2023 by xxx, All Rights Reserved.
|
||
*/
|
||
|
||
#include "app.h"
|
||
#include "adcs.h"
|
||
|
||
uDeviceTypedef uDevice; // 设备内设置的信息
|
||
uRealTimeDef uRtData; // 实时参数
|
||
driver_icon_enable_u driver_icon_enable; // 驱动使能图标
|
||
|
||
float32 calib_param[CALIBPARA_NUM][2]; // 校准参数
|
||
uint16_t crc_param[CRC_NUM]; // CRC参数
|
||
// 模拟量
|
||
uint16_t adc_raw[INMAX]; // ADC原始值
|
||
__IO uint16_t ip_out; // DAC输出值
|
||
// 数字量
|
||
__IO float32 loop_current = 0; // 输入电流mA
|
||
|
||
float32 actual_travel = 0; // 实际阀门位置 % (1位小数,如 0~100%, 100% = 1000)
|
||
float32 target_travel = 0; // 目标阀门位置 % (1位小数,如 0~100%, 100% = 1000)
|
||
float32 pid_target = 0; // pid控制目标
|
||
float32 pid_actual = 0; // pid控制实际
|
||
float32 show_target = 0; // lcd显示目标
|
||
float32 show_actual = 0; // lcd显示实际
|
||
float32 target_actual_diff = 0; // 目标与实际差值 % (1位小数,如 0~100%, 100% = 1000)
|
||
uint8_t target_direction = 1; // 目标方向,0:向下,1:向上
|
||
float32 temperature = 0; // 温度
|
||
float32 pressure; // 压力kPa
|
||
float32 pressureA; // A路压力
|
||
float32 pressureB; // B路压力
|
||
float32 range_percentage; // 量程百分比
|
||
|
||
uint8_t cpu_percent = 0; // CPU使用率
|
||
|
||
/**
|
||
* @brief app初始化
|
||
* @return {*}
|
||
* @note
|
||
*/
|
||
void app_init()
|
||
{
|
||
fal_execution_init(); // fal初始化
|
||
params_init(); // 参数初始化
|
||
uDevice.eAirAction = ATO;
|
||
key_init(); // 按键初始化
|
||
flow_init(); // 流程初始化
|
||
mode_init(); // 工作模式初始化
|
||
}
|
||
|
||
/**
|
||
* @brief 业务流程启动
|
||
* @return {*}
|
||
* @note
|
||
*/
|
||
void app_start()
|
||
{
|
||
flow_start();
|
||
}
|