|
|
@@ -49,10 +49,10 @@ rt_thread_t dtu_send_data = RT_NULL;
|
|
|
|
|
|
rt_device_t dtuserial; /*串口设备句柄*/
|
|
|
struct serial_configure dtuconfig = RT_SERIAL_CONFIG_DEFAULT; /*初始化配置参数*/
|
|
|
-static int num_updata = 0;
|
|
|
+static int num_updata = 60;
|
|
|
|
|
|
|
|
|
-int DTU_uart2_init(void)
|
|
|
+static int DTU_uart2_init(void)
|
|
|
{
|
|
|
|
|
|
dtuserial = rt_device_find(DTU_UART_NAME);
|
|
|
@@ -66,7 +66,7 @@ int DTU_uart2_init(void)
|
|
|
rt_device_control(dtuserial, RT_DEVICE_CTRL_CONFIG, &dtuconfig);
|
|
|
/* step4:打开串口设备。以DMA接收及轮询发送模式打开串口设备 */
|
|
|
rt_device_open(dtuserial, RT_DEVICE_FLAG_DMA_RX);
|
|
|
- return 0;
|
|
|
+ return RT_EOK;
|
|
|
}
|
|
|
/*数据发送*/
|
|
|
void DTU_Write(char *fmt, ...)
|
|
|
@@ -159,9 +159,11 @@ static void dtu_thread_entry_recv(void *parameter)
|
|
|
/*入口函数-指令发送*/
|
|
|
static void dtu_thread_entry_send(void *parameter)
|
|
|
{
|
|
|
+
|
|
|
static uint8_t dev_sta = 1;//开机置1
|
|
|
static uint8_t power_sta = 1;//开机置1
|
|
|
rt_thread_delay(10000); //20S等待联网
|
|
|
+ if(atoi(device_status.net)==1) num_updata = 0;
|
|
|
while(1)
|
|
|
{
|
|
|
if(num_updata!=0)
|
|
|
@@ -249,7 +251,7 @@ int dtu_data_play(void)
|
|
|
/* 如果获得线程控制块,启动这个线程 */
|
|
|
if (dtu_recv_data != RT_NULL)
|
|
|
rt_thread_startup(dtu_recv_data);
|
|
|
- return 0;
|
|
|
+ return RT_EOK;
|
|
|
}
|
|
|
char * makeJson_ReadInfo()
|
|
|
{
|
|
|
@@ -621,7 +623,7 @@ void parseDtu(char *json_string)
|
|
|
}
|
|
|
else if (strstr(item_cmd->valuestring,"synchronization")!=RT_NULL)
|
|
|
{
|
|
|
-
|
|
|
+ device_status.refresh_timeout=0;
|
|
|
//driver_4g = cJSON_GetObjectItem(item_ext,"version");
|
|
|
driver_4g = cJSON_GetObjectItem(item_ext,"dver");
|
|
|
//project = cJSON_GetObjectItem(item_ext,"project");
|
|
|
@@ -670,7 +672,7 @@ void parseDtu(char *json_string)
|
|
|
if(atoi(year_s)>2020&&atoi(year_s)<3000&&atoi(month_s)>0&&atoi(month_s)<13&&atoi(day_s)>0&&atoi(day_s)<32)
|
|
|
{
|
|
|
rt_kprintf("设置时间:%d年%d月%d日\n",atoi(year_s),atoi(month_s),atoi(day_s));
|
|
|
- if(net->valueint==0||atoi(net->valuestring)==0)
|
|
|
+ if(atoi(net->valuestring)==0)
|
|
|
{
|
|
|
set_date(atoi(year_s),atoi(month_s),atoi(day_s));
|
|
|
}
|
|
|
@@ -682,7 +684,7 @@ void parseDtu(char *json_string)
|
|
|
if(atoi(hour_s)>0&&atoi(hour_s)<=24&&atoi(min_s)>=0&&atoi(min_s)<=60&&atoi(sec_s)>=0&&atoi(sec_s)<=60)
|
|
|
{
|
|
|
rt_kprintf("设置时间:%d时%d分%d秒\n",atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
- if(net->valueint==0||atoi(net->valuestring)==0)
|
|
|
+ if(atoi(net->valuestring)==0)
|
|
|
{
|
|
|
set_time(atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
}
|
|
|
@@ -785,21 +787,13 @@ void parseDtu(char *json_string)
|
|
|
ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar)); //开始时间
|
|
|
rt_kprintf("开始时间st:%d\n",atoi(st->valuestring));
|
|
|
}
|
|
|
- else if (atoi(st->valuestring)>=0&&atoi(st->valuestring)<=23&&st!=NULL) {
|
|
|
- device_status.startBar = atoi(st->valuestring);
|
|
|
- ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar)); //开始时间
|
|
|
- rt_kprintf("开始时间st:%d\n",atoi(st->valuestring));
|
|
|
- }
|
|
|
+
|
|
|
if(atoi(et->valuestring)>=0&&atoi(et->valuestring)<=23&&et!=NULL){
|
|
|
device_status.stopBar = atoi(et->valuestring);
|
|
|
ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar)); //结束时间
|
|
|
rt_kprintf("结束时间et:%d\n",atoi(et->valuestring));
|
|
|
}
|
|
|
- else if (atoi(et->valuestring)>=0&&atoi(et->valuestring)<=23&&et!=NULL) {
|
|
|
- device_status.stopBar = atoi(et->valuestring);
|
|
|
- ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar)); //结束时间
|
|
|
- rt_kprintf("结束时间et:%d\n",atoi(et->valuestring));
|
|
|
- }
|
|
|
+
|
|
|
if(atoi(collt->valuestring)>=1&&atoi(collt->valuestring)<=60&&collt!=NULL){
|
|
|
device_status.clt_time = atoi(collt->valuestring);
|
|
|
ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time)); //收集时间
|
|
|
@@ -919,3 +913,4 @@ void UpLoad_Data(void)
|
|
|
list_mem();
|
|
|
//播放数据上传中语音
|
|
|
}
|
|
|
+
|