This commit is contained in:
小马_666 2025-06-25 13:41:59 +08:00
commit 76900cbf8a
6 changed files with 14 additions and 24 deletions

View File

@ -20,4 +20,4 @@ Reset=true
SDIPrintf=false SDIPrintf=false
Disable Power Output=false Disable Power Output=false
Clear CodeFlash=false Clear CodeFlash=false
Disable Code-Protect=false Disable Code-Protect=true

View File

@ -175,7 +175,7 @@ uint16_t Get_Stable_Reading(uint8_t cnt, uint32_t timeout_ms)
uint16_t current; uint16_t current;
uint8_t stable_count = 0; uint8_t stable_count = 0;
uint16_t gas_buf[20] = {0};//传入的cnt不能大于这个数组大小 uint16_t gas_buf[20] = {0};//传入的cnt不能大于这个数组大小
uint16_t gas_value = 0; // uint16_t gas_value = 0;
uint32_t sum = 0; uint32_t sum = 0;
while ((rt_tick_get() - start) < timeout_ms) while ((rt_tick_get() - start) < timeout_ms)
@ -241,7 +241,7 @@ int APP_Calibration_Handle(void)
Send_Laser_Alarm_Event(kNotCalibratedEvent); Send_Laser_Alarm_Event(kNotCalibratedEvent);
return RT_EOK; return RT_EOK;
} }
gas_calibration_voltage = Get_Stable_Reading(10, 10000); // 10s内连续10稳定则认为其标定浓度稳定进行标定 gas_calibration_voltage = (Get_Stable_Reading(10, 10000) - 10); // 10s内连续10稳定则认为其标定浓度稳定进行标定
if ((gas_calibration_voltage == 0)||(gas_calibration_voltage >= 0xfff)) if ((gas_calibration_voltage == 0)||(gas_calibration_voltage >= 0xfff))
{ {
LOG_D("标定超时,标定错误"); LOG_D("标定超时,标定错误");
@ -276,7 +276,7 @@ int main(void)
BSP_SYS_Init(); BSP_SYS_Init();
work_duration = Flash_Get_WorkDuration(); work_duration = Flash_Get_WorkDuration();
LOG_D("工作时长:%d", work_duration); LOG_D("工作时长:%d", work_duration);
// 读取历史记录总数 //
g_Calibration_status = Flash_Get_Calibration_State(); g_Calibration_status = Flash_Get_Calibration_State();
//这种方法当纽扣电池没电直接完蛋但是5年应该能撑住 //这种方法当纽扣电池没电直接完蛋但是5年应该能撑住

View File

@ -779,7 +779,7 @@
"sdiPrintf": false, "sdiPrintf": false,
"disablepowerout": false, "disablepowerout": false,
"clearcodeflash": false, "clearcodeflash": false,
"disablecodeprotect": false, "disablecodeprotect": true,
"exepath": "", "exepath": "",
"exearguments": "" "exearguments": ""
}, },

View File

@ -44,7 +44,7 @@
#define MQ_VOLTAGE_RATIO (1.74F) #define MQ_VOLTAGE_RATIO (1.74F)
// adc voltage 1000x // adc voltage 1000x
#define MQ_VOLTAGE_HIGH_LIMIT (4095U) #define MQ_VOLTAGE_HIGH_LIMIT (4000U)
#define MQ_VOLTAGE_LOW_LIMIT (100U) #define MQ_VOLTAGE_LOW_LIMIT (100U)
#define MQ_VOLTAGE_ALARM_DEFAULT (uint16_t)(2250U) #define MQ_VOLTAGE_ALARM_DEFAULT (uint16_t)(2250U)

View File

@ -8,16 +8,6 @@
* *
* Copyright (c) 2024 by yzy, All Rights Reserved. * Copyright (c) 2024 by yzy, All Rights Reserved.
*/ */
/*
* @Author : yzy
* @Date : 2023-01-30 15:40:07
* @LastEditors : stark1898y 1658608470@qq.com
* @LastEditTime : 2025-06-20 17:30:09
* @FilePath : \JT-DT-YD1F01_RTT_Nano\bsp\src\bsp_mq.c
* @Description :
*
* Copyright (c) 2023 by yzy, All Rights Reserved.
*/
#include "bsp_mq.h" #include "bsp_mq.h"
#include "bsp_adc.h" #include "bsp_adc.h"
#include "bsp_flash.h" #include "bsp_flash.h"
@ -130,11 +120,11 @@ static uint8_t Sensor_CheckData(void)
if(alarm_flag)//检测到报警后的报警恢复,降低其阈值 if(alarm_flag)//检测到报警后的报警恢复,降低其阈值
{ {
alarm_status_buffer[index] = (((voltage > (Sensor_device.alarm_value - 200)) && (voltage < MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorAlarm : kSensorNormal); alarm_status_buffer[index] = (((voltage > (Sensor_device.alarm_value - 150)) && (voltage < MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorAlarm : kSensorNormal);
} }
else else
{ {
alarm_status_buffer[index] = (((voltage > Sensor_device.alarm_value) && (voltage < MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorAlarm : kSensorNormal); alarm_status_buffer[index] = (((voltage >= Sensor_device.alarm_value) && (voltage < MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorAlarm : kSensorNormal);
} }
fault_buf[index] = (((voltage < MQ_VOLTAGE_LOW_LIMIT) || (voltage > MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorFault : kSensorNormal); fault_buf[index] = (((voltage < MQ_VOLTAGE_LOW_LIMIT) || (voltage > MQ_VOLTAGE_HIGH_LIMIT)) ? kSensorFault : kSensorNormal);