This commit is contained in:
stark1898y 2025-06-20 19:31:51 +08:00
parent 7e844a79f9
commit 69c9ae25c3
5 changed files with 15 additions and 14 deletions

View File

@ -229,9 +229,9 @@ int APP_Calibration_Handle(void)
uint16_t gas_buf[20] = {0}; uint16_t gas_buf[20] = {0};
// 采集10s的ADC值 // 采集10s的ADC值
for (i = 0; i < 20; i++) for (i = 0; i < 10; i++)
{ {
gas_buf[i] = Get_Gas_VoltageAdcInt1000x(); gas_buf[i] = Get_Gas_VoltageInt1000x();
if ((gas_buf[i] == 0) || (gas_buf[i] >= 0xfff)) if ((gas_buf[i] == 0) || (gas_buf[i] >= 0xfff))
{ {
return 0; return 0;
@ -259,7 +259,7 @@ int APP_Calibration_Handle(void)
{ {
sum += gas_buf[i]; sum += gas_buf[i];
} }
gas_calibration_voltage = (uint16_t)(sum / 8); gas_calibration_voltage = (uint16_t)((sum / 8.0f) - 85);
// 写入标定值 // 写入标定值
calibration_buf[0] = gas_calibration_voltage & 0xFF; // 低字节 calibration_buf[0] = gas_calibration_voltage & 0xFF; // 低字节

View File

@ -19,7 +19,7 @@
#define SYS_HW_VERSION (0X13U) #define SYS_HW_VERSION (0X13U)
#define SYS_SW_VERSION (0X17U) #define SYS_SW_VERSION (0X18U)
#define SYS_IOT_UPLOAD_CYCLE_MIN (0X003CU) // 高位在后,低位在前 #define SYS_IOT_UPLOAD_CYCLE_MIN (0X003CU) // 高位在后,低位在前
#define SYS_IOT_RETRY (0X03U) #define SYS_IOT_RETRY (0X03U)
#define SYS_TEMP_ALARM_THRESHOLD (0X32U) #define SYS_TEMP_ALARM_THRESHOLD (0X32U)

View File

@ -12,7 +12,7 @@
* @Author : stark1898y 1658608470@qq.com * @Author : stark1898y 1658608470@qq.com
* @Date : 2023-08-02 11:49:34 * @Date : 2023-08-02 11:49:34
* @LastEditors : stark1898y 1658608470@qq.com * @LastEditors : stark1898y 1658608470@qq.com
* @LastEditTime : 2024-06-19 09:42:35 * @LastEditTime : 2025-06-20 17:29:07
* @FilePath : \wuxi_alarm_ch32v303rct6_rtt\bsp\inc\bsp_mq.h * @FilePath : \wuxi_alarm_ch32v303rct6_rtt\bsp\inc\bsp_mq.h
* @Description : * @Description :
* *
@ -26,7 +26,7 @@
// MQ采样间隔 // MQ采样间隔
#define MQ_SAMPLING_INTERVAL_MS (100U) #define MQ_SAMPLING_INTERVAL_MS (100U)
#define SENSOR_SAMPLING_TIMS (4U) #define SENSOR_SAMPLING_TIMS (10U)
// MQ采样时间窗口 // MQ采样时间窗口
#define MQ_SAMPLING_S (uint8_t)(3U) #define MQ_SAMPLING_S (uint8_t)(3U)

View File

@ -917,7 +917,8 @@ int BSP_Flash_Init (void)
Flash_SetProductTimeLimit (2025, 6, 11, 11, 50, 20, kFactoryTimeId); Flash_SetProductTimeLimit (2025, 6, 11, 11, 50, 20, kFactoryTimeId);
Set_ExpirationTime (MAX_EXPIRATION_DAYS); Set_ExpirationTime (MAX_EXPIRATION_DAYS);
Flash_Set_Calibration_State(kSysGasCalibStatus); // 标定状态 // TODO:标定标志
Flash_Set_Calibration_State(kNotCalibrated); // 标定状态
Flash_Set_Valve_Num(0); Flash_Set_Valve_Num(0);
sci.hw_ver = SYS_HW_VERSION; sci.hw_ver = SYS_HW_VERSION;
sci.sw_ver = SYS_SW_VERSION; sci.sw_ver = SYS_SW_VERSION;

View File

@ -12,7 +12,7 @@
* @Author : yzy * @Author : yzy
* @Date : 2023-01-30 15:40:07 * @Date : 2023-01-30 15:40:07
* @LastEditors : stark1898y 1658608470@qq.com * @LastEditors : stark1898y 1658608470@qq.com
* @LastEditTime : 2023-09-19 16:25:03 * @LastEditTime : 2025-06-20 17:30:09
* @FilePath : \JT-DT-YD1F01_RTT_Nano\bsp\src\bsp_mq.c * @FilePath : \JT-DT-YD1F01_RTT_Nano\bsp\src\bsp_mq.c
* @Description : * @Description :
* *
@ -116,11 +116,11 @@ static uint8_t Sensor_CheckData(void)
static rt_uint8_t index = 0; static rt_uint8_t index = 0;
static rt_uint8_t alarm_status_buffer[SENSOR_SAMPLING_TIMS] = {0}; static rt_uint8_t alarm_status_buffer[SENSOR_SAMPLING_TIMS] = {0};
static rt_uint8_t fault_buf[SENSOR_SAMPLING_TIMS] = {0}; static rt_uint8_t fault_buf[SENSOR_SAMPLING_TIMS] = {0};
rt_uint16_t voltage = Get_Gas_VoltageAdcInt1000x(); rt_uint16_t voltage = Get_Gas_VoltageInt1000x();
if(alarm_flag) if(alarm_flag)
{ {
alarm_status_buffer[index] = ((voltage > (Sensor_device.alarm_value - 15)) && (voltage < MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorAlarm : kSensorNormal; alarm_status_buffer[index] = ((voltage > (Sensor_device.alarm_value - 30)) && (voltage < MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorAlarm : kSensorNormal;
} }
else else
{ {