暂存一个生产版本

This commit is contained in:
stark1898y 2025-06-24 16:29:17 +08:00
parent a7bbacbe48
commit 0d6721e6e0
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

@ -460,8 +460,8 @@ int Process_Factor_Cmd(const char *rx_buff, size_t length)
time_buf[5], time_buf[4], time_buf[3], cnt, imei, imsi, iccid); time_buf[5], time_buf[4], time_buf[3], cnt, imei, imsi, iccid);
BSP_Hr_Send_Data(buf, rt_strlen(buf)); BSP_Hr_Send_Data(buf, rt_strlen(buf));
Flash_GetProductTimeLimit(&ReadLimitTime, kFactoryTimeId); Flash_GetProductTimeLimit(&ReadLimitTime, kFactoryTimeId);
if ((ReadLimitTime.Struct.year != 2000 + time_buf[5])&& if ((ReadLimitTime.Struct.year != 2000 + time_buf[5])&&
(ReadLimitTime.Struct.month != time_buf[4])&& (ReadLimitTime.Struct.month != time_buf[4])&&
@ -470,14 +470,14 @@ int Process_Factor_Cmd(const char *rx_buff, size_t length)
RTC_GetTime(); RTC_GetTime();
Flash_SetProductTimeLimit(2000 + time_buf[5], time_buf[4], time_buf[3], RtcDateTime.hour, RtcDateTime.minute, RtcDateTime.second, kFactoryTimeId); Flash_SetProductTimeLimit(2000 + time_buf[5], time_buf[4], time_buf[3], RtcDateTime.hour, RtcDateTime.minute, RtcDateTime.second, kFactoryTimeId);
Flash_SetProductTimeLimit(2000 + time_buf[5] + 8, time_buf[4], time_buf[3], RtcDateTime.hour, RtcDateTime.minute, RtcDateTime.second, kExpirationTimeId); Flash_SetProductTimeLimit(2000 + time_buf[5] + 8, time_buf[4], time_buf[3], RtcDateTime.hour, RtcDateTime.minute, RtcDateTime.second, kExpirationTimeId);
} }
} }
else else
{ {
LOG_E("[%s] is not set\r\n", "factory time"); LOG_E("[%s] is not set\r\n", "factory time");
BSP_Hr_Send_Data("factory time is not set\r\n", rt_strlen("factory time is not set\r\n")); BSP_Hr_Send_Data("factory time is not set\r\n", rt_strlen("factory time is not set\r\n"));
} }
return RT_EOK; return RT_EOK;
} }
// else if (rt_strcmp(cmd, factory_cmd2) == 0) // 比较接收到的字符串与 factory_cmd2 // else if (rt_strcmp(cmd, factory_cmd2) == 0) // 比较接收到的字符串与 factory_cmd2

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"
@ -92,7 +82,7 @@ static void Sensor_HandleAlarm(uint8_t count, uint8_t threshold)
Sensor_device.detection_flag = kSensorNormal; Sensor_device.detection_flag = kSensorNormal;
Send_Laser_Alarm_Event(kAlarmRcyEvent); Send_Laser_Alarm_Event(kAlarmRcyEvent);
} }
else else
{ {
if ((Get_Gas_VoltageAdcInt1000x() < 1000) && (count == 0)) if ((Get_Gas_VoltageAdcInt1000x() < 1000) && (count == 0))
{ {
@ -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);