暂存+1
This commit is contained in:
parent
01d51d4309
commit
a7bbacbe48
|
@ -5,7 +5,7 @@
|
||||||
"type": "mrs-debugger",
|
"type": "mrs-debugger",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "ble_bjq_ch303rct6_ml307",
|
"name": "ble_bjq_ch303rct6_ml307",
|
||||||
"cwd": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307",
|
"cwd": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303",
|
||||||
"openOCDCfg": {
|
"openOCDCfg": {
|
||||||
"useLocalOpenOCD": true,
|
"useLocalOpenOCD": true,
|
||||||
"executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe",
|
"executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe",
|
||||||
|
@ -39,8 +39,8 @@
|
||||||
"additionalCommands": []
|
"additionalCommands": []
|
||||||
},
|
},
|
||||||
"loadedFiles": {
|
"loadedFiles": {
|
||||||
"executableFile": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307\\obj\\ble_bjq_ch303rct6_ml307.elf",
|
"executableFile": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303\\obj\\ble_bjq_ch303rct6_ml307.elf",
|
||||||
"symbolFile": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307\\obj\\ble_bjq_ch303rct6_ml307.elf",
|
"symbolFile": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303\\obj\\ble_bjq_ch303rct6_ml307.elf",
|
||||||
"executableFileOffset": 0,
|
"executableFileOffset": 0,
|
||||||
"symbolFileOffset": 0
|
"symbolFileOffset": 0
|
||||||
},
|
},
|
||||||
|
|
|
@ -154,7 +154,7 @@ void Preheat_Timer_Callback(void *parameter)
|
||||||
LED_STOP(y);
|
LED_STOP(y);
|
||||||
LOG_D("预热完成");
|
LOG_D("预热完成");
|
||||||
preheat_flag = 1;
|
preheat_flag = 1;
|
||||||
|
|
||||||
if (g_Calibration_status == kSysGasCalibStatus)
|
if (g_Calibration_status == kSysGasCalibStatus)
|
||||||
{
|
{
|
||||||
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
||||||
|
@ -181,27 +181,28 @@ uint16_t Get_Stable_Reading(uint8_t cnt, uint32_t timeout_ms)
|
||||||
while ((rt_tick_get() - start) < timeout_ms)
|
while ((rt_tick_get() - start) < timeout_ms)
|
||||||
{
|
{
|
||||||
current = Get_Gas_VoltageAdcInt1000x();
|
current = Get_Gas_VoltageAdcInt1000x();
|
||||||
|
|
||||||
uint16_t diff = abs(current - last); // 差值
|
uint16_t diff = abs(current - last); // 差值
|
||||||
|
|
||||||
if (diff <= STABLE_THRESHOLD)
|
if (diff <= STABLE_THRESHOLD)
|
||||||
{
|
{
|
||||||
gas_buf[stable_count] = current;
|
gas_buf[stable_count] = current;
|
||||||
stable_count++;
|
stable_count++;
|
||||||
|
|
||||||
if (stable_count >= cnt)
|
if (stable_count >= cnt)
|
||||||
{
|
{
|
||||||
//求取平均值
|
//求取平均值
|
||||||
for (size_t i = 0; i < stable_count; i++)
|
for (size_t i = 0; i < stable_count; i++)
|
||||||
{
|
{
|
||||||
sum += gas_buf[i];
|
sum += gas_buf[i];
|
||||||
}
|
}
|
||||||
return (uint16_t)(sum / stable_count); // 连续n次稳定
|
return (uint16_t)(sum / stable_count); // 连续n次稳定
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stable_count = 0;
|
stable_count = 0;
|
||||||
|
rt_memset(gas_buf, 0, sizeof(gas_buf));
|
||||||
}
|
}
|
||||||
last = current;
|
last = current;
|
||||||
rt_thread_mdelay(100);
|
rt_thread_mdelay(100);
|
||||||
|
@ -215,7 +216,7 @@ int APP_Calibration_Handle(void)
|
||||||
{
|
{
|
||||||
uint16_t gas_calibration_voltage = 0;
|
uint16_t gas_calibration_voltage = 0;
|
||||||
uint8_t calibration_buf[2] = {0};
|
uint8_t calibration_buf[2] = {0};
|
||||||
|
|
||||||
// if (Get_Gas_VoltageAdcInt1000x() > 400 && Get_Gas_VoltageAdcInt1000x() < 900)
|
// if (Get_Gas_VoltageAdcInt1000x() > 400 && Get_Gas_VoltageAdcInt1000x() < 900)
|
||||||
// {
|
// {
|
||||||
// LED_OFF(r);
|
// LED_OFF(r);
|
||||||
|
@ -492,9 +493,9 @@ int main(void)
|
||||||
SysControl.last_status = SysControl.status;
|
SysControl.last_status = SysControl.status;
|
||||||
SysControl.status = kAlarmRcyEvent;
|
SysControl.status = kAlarmRcyEvent;
|
||||||
Flash_Write_Record(kRecordAlarmRcy);
|
Flash_Write_Record(kRecordAlarmRcy);
|
||||||
|
|
||||||
BEEP_STOP;
|
BEEP_STOP;
|
||||||
|
|
||||||
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
Send_Laser_Alarm_Event(kNormalDetectionEvents);
|
||||||
|
|
||||||
#if (IOT_MODULE_SWITCH == 1)
|
#if (IOT_MODULE_SWITCH == 1)
|
||||||
|
@ -739,4 +740,13 @@ static void SYS_SW_Version(void)
|
||||||
|
|
||||||
MSH_CMD_EXPORT(SYS_SW_Version, "软件版本和编译时间");
|
MSH_CMD_EXPORT(SYS_SW_Version, "软件版本和编译时间");
|
||||||
|
|
||||||
|
|
||||||
|
static void TEST_Get_SYS_Calibartion(void)
|
||||||
|
{
|
||||||
|
LOG_D("标定值 = %d", Flash_Get_SysCfg(kAlarmLValueId));
|
||||||
|
}
|
||||||
|
|
||||||
|
MSH_CMD_EXPORT(TEST_Get_SYS_Calibartion, "标定值");
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -514,7 +514,7 @@ static int ml307_netdev_set_info (struct netdev *netdev)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
__exit:
|
__exit:
|
||||||
if (resp)
|
if (resp)
|
||||||
{
|
{
|
||||||
|
@ -1057,23 +1057,23 @@ static void ml307_init_thread_entry (void *parameter)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
if (at_obj_exec_cmd (device->client, resp, "AT+CGATT=1") != RT_EOK)
|
// if (at_obj_exec_cmd (device->client, resp, "AT+CGATT=1") != RT_EOK)
|
||||||
{
|
// {
|
||||||
result = -RT_ERROR;
|
// result = -RT_ERROR;
|
||||||
goto __exit;
|
// goto __exit;
|
||||||
}
|
// }
|
||||||
char parsed_data[10] = {0};
|
// char parsed_data[10] = {0};
|
||||||
for (i = 0; i < CGATT_RETRY; i++)
|
// for (i = 0; i < CGATT_RETRY; i++)
|
||||||
{
|
// {
|
||||||
AT_SEND_CMD (client, resp, 0, ML307_AT_DEFAULT_TIMEOUT, "AT+CGATT?");
|
// AT_SEND_CMD (client, resp, 0, ML307_AT_DEFAULT_TIMEOUT, "AT+CGATT?");
|
||||||
at_resp_parse_line_args_by_kw (resp, "+CGATT:", "+CGATT: %s", &parsed_data);
|
// at_resp_parse_line_args_by_kw (resp, "+CGATT:", "+CGATT: %s", &parsed_data);
|
||||||
if (!rt_strncmp (parsed_data, "1", 1))
|
// if (!rt_strncmp (parsed_data, "1", 1))
|
||||||
{
|
// {
|
||||||
LOG_D ("%s device Packet domain attach.", device->name);
|
// LOG_D ("%s device Packet domain attach.", device->name);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
rt_thread_mdelay (1000);
|
// rt_thread_mdelay (1000);
|
||||||
}
|
// }
|
||||||
/* set network interface device hardware iccid */
|
/* set network interface device hardware iccid */
|
||||||
// LOG_D("*(rt_uint16_t *)FLASH_IOT_ICCID_ADDR = %#X", *(rt_uint16_t *)FLASH_IOT_ICCID_ADDR);
|
// LOG_D("*(rt_uint16_t *)FLASH_IOT_ICCID_ADDR = %#X", *(rt_uint16_t *)FLASH_IOT_ICCID_ADDR);
|
||||||
if ((*(rt_uint16_t *)FLASH_IOT_ICCID_ADDR == 0xE339) || (*(uint16_t *)FLASH_IOT_ICCID_ADDR == 0x39E3))
|
if ((*(rt_uint16_t *)FLASH_IOT_ICCID_ADDR == 0xE339) || (*(uint16_t *)FLASH_IOT_ICCID_ADDR == 0x39E3))
|
||||||
|
|
Loading…
Reference in New Issue