将未标定改为红灯常亮,将AT指令free 参数改为0,2

This commit is contained in:
小马_666 2025-05-21 16:24:16 +08:00
parent ef5987d0ff
commit 5005c126d8
7 changed files with 31 additions and 19 deletions

View File

@ -5,7 +5,7 @@
"type": "mrs-debugger",
"request": "launch",
"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": {
"useLocalOpenOCD": true,
"executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe",
@ -39,8 +39,8 @@
"additionalCommands": []
},
"loadedFiles": {
"executableFile": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307\\obj\\ble_bjq_ch303rct6_ml307.elf",
"symbolFile": "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": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303\\obj\\ble_bjq_ch303rct6_ml307.elf",
"executableFileOffset": 0,
"symbolFileOffset": 0
},

View File

@ -156,10 +156,10 @@ int APP_Calibration_Handle(void)
// 定义超时时间,单位为毫秒
#define TIMEOUT_MS (3 * 60 * 1000)
LED_STOP(r);
LED_STOP(g);
LED_STOP(y);
LED_CTRL(g, "1000,500", -1);
LED_START(g);
LED_ON(r);
LED_START(r);
uint32_t ticks = 0, gas_calibration_voltage;
LOG_D("标定开始");

View File

@ -855,10 +855,8 @@
"ATTR_BUILD_BEFORE_LAUNCH_ATTR": 2,
"GdbServerAllocateConsole": true,
"GdbServerAllocateTelnetConsole": false,
"SkipDownloadBeforeDebug": false,
"StartGdbCLient": true,
"UPDATE_THREADLIST_ON_SUSPEND": false,
"DebugInRam": false
"UPDATE_THREADLIST_ON_SUSPEND": false
}
}
}

View File

@ -89,7 +89,7 @@ static rt_err_t ml307_power_on(struct at_device *device)
rt_pin_write(ml307->pwr_en_pin, PIN_HIGH);
rt_thread_mdelay(RT_TICK_PER_SECOND);
rt_pin_write(ml307->power_pin, PIN_HIGH);
rt_thread_mdelay(ML307_POWER_ON_TIME * RT_TICK_PER_SECOND);
rt_pin_write(ml307->power_pin, PIN_LOW);
@ -302,7 +302,7 @@ static int at_device_ml307_connect_tcp(struct at_device *device)
flash_sever_info sever_info = {0};
rt_err_t ret = RT_ERROR;
ASSERT(device);
at_response_t resp = at_create_resp(64, 2, 5000);
at_response_t resp = at_create_resp(256, 2, 10000);
if (resp == RT_NULL)
{
LOG_E("No memory for response structure!");
@ -878,7 +878,7 @@ static void ml307_init_thread_entry(void *parameter)
struct at_device *device = (struct at_device *)parameter;
struct at_client *client = device->client;
resp = at_create_resp(128, 0, rt_tick_from_millisecond(ML307_AT_DEFAULT_TIMEOUT * 2));
resp = at_create_resp(256, 0, rt_tick_from_millisecond(ML307_AT_DEFAULT_TIMEOUT * 2));
if (resp == RT_NULL)
{
LOG_E("no memory for resp create.");
@ -1159,10 +1159,10 @@ static void ml307_init_thread_entry(void *parameter)
/* check and create link staus sync thread */
ml307_netdev_check_link_status(device->netdev);
LOG_I("%s device network initialize success.", device->name);
while (Flash_Get_Calibration_State() == kNotCalibrated)
{
rt_thread_mdelay(1000); // we need wait for calibration finish
}
// while (Flash_Get_Calibration_State() == kNotCalibrated)
// {
// rt_thread_mdelay(1000); // we need wait for calibration finish
// }
rt_completion_done(&ml307_init_complate); // 通知初始化完成
}
else

View File

@ -895,7 +895,7 @@ int BSP_Flash_Init (void)
Flash_SetProductTimeLimit (2025, 2, 10, 13, 50, 20, kFactoryTimeId);
Set_ExpirationTime (MAX_EXPIRATION_DAYS);
Flash_Set_Calibration_State(kNotCalibrated); // 标定状态
Flash_Set_Calibration_State(kSysGasCalibStatus); // 标定状态
Flash_Set_Valve_Num(0);
sci.hw_ver = SYS_HW_VERSION;
sci.sw_ver = SYS_SW_VERSION;

View File

@ -737,7 +737,7 @@ int Ml307_Send_Power_Off(struct at_device *device, void *param)
LOG_E("ml307 param error\n");
return RT_ERROR;
}
rt_memset(&valve[0].valve_connct_status, 0, (sizeof(struct valve_t) - 7));//当掉电事件时,直接清空阀门结构体,这样连接状态就为断开
rt_memset(&valve[0].valve_connct_status, 0, (sizeof(struct valve_t) - 7)); // 当掉电事件时,直接清空阀门结构体,这样连接状态就为断开
if (ml307_ops->send(ml307_ops, DATA_SERIAL_NUM, CMD_TYPE_DEVICE_EVENT_REPORT, DEVICE_TYPE_ML307, EVENT_TYPE_POWER_OFF))
{
LOG_E("ml307 send cmd[%X] failed\n", EVENT_TYPE_POWER_OFF);
@ -1972,6 +1972,20 @@ static void Ml307_Life_Thread_Entry(void *parameter)
result = -RT_ERROR;
goto __exit;
}
int link_stat = 0;
if (at_resp_parse_line_args_by_kw(resp, "+MIPCALL:", "+MIPCALL: %d,%*d,%*s", &link_stat) > 0)
{
if (link_stat == 1)
{
result = RT_EOK;
}
}
else
{
LOG_E("AT+MIPCALL error.");
result = -RT_ERROR;
goto __exit;
}
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_CONN, RT_NULL) == RT_EOK)
{
LOG_D("重连网络成功\n");

View File

@ -47,7 +47,7 @@ uint16_t Get_Gas_VoltageInt1000x(void)
uint16_t Get_Gas_VoltageAdcInt1000x(void)
{
rt_uint16_t voltage_adc = (Get_ADC_Average(kGasAdc) * 3.3 / 4096) * 1000;
LOG_D("Get_Gas_VoltageAdcInt1000x = %04d", voltage_adc);
// LOG_D("Get_Gas_VoltageAdcInt1000x = %04d", voltage_adc);
return voltage_adc;
}