v2.1
This commit is contained in:
34
src/main.cpp
34
src/main.cpp
@ -172,8 +172,8 @@ void setup()
|
||||
|
||||
// while (1)
|
||||
// {
|
||||
// Serial0.println("66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666");
|
||||
// vTaskDelay(10);
|
||||
// Serial0.println("66666666666666666666666");
|
||||
// vTaskDelay(1000);
|
||||
// }
|
||||
|
||||
log_init();
|
||||
@ -250,8 +250,6 @@ void setup()
|
||||
Serial0.println("IS_SN :" +STRSensorInfos_structure.serialnumber);
|
||||
|
||||
|
||||
|
||||
|
||||
sys_info_init();
|
||||
|
||||
dingbiao_init("/dingbiao/dingbiao_up_gain.bin");
|
||||
@ -281,7 +279,7 @@ void setup()
|
||||
|
||||
if(sys_sd_doc["status_4g"] == "open_4g")
|
||||
{
|
||||
gsmm_mqtt_init();
|
||||
gsmm_mqtt_init(STRSensorInfos_structure.serialnumber);
|
||||
|
||||
xTaskCreatePinnedToCore(task_4G_mode, "task_4G_mode",1024*(20),NULL, 1,NULL, 1);
|
||||
xTaskCreatePinnedToCore(OTA_task, "OTA_task",1024*(10),NULL, 1,NULL, 1);
|
||||
@ -368,13 +366,11 @@ void Task0(void *pvParameters)
|
||||
if (atuo_return == 1)
|
||||
{
|
||||
is11Sensor->senddata(&wb485Serial,return_data_type, fengbao_num);
|
||||
|
||||
}
|
||||
vTaskDelay(1000 * time_interval);
|
||||
break;
|
||||
case 3:
|
||||
is11Sensor->senddata(&wb485Serial,return_data_type, fengbao_num);
|
||||
|
||||
uint_work_task0 = 100;
|
||||
break;
|
||||
|
||||
@ -421,8 +417,8 @@ void Task1(void *pvParameters)
|
||||
{
|
||||
vTaskDelay(3);
|
||||
write_log(log_path,"task 1",10);
|
||||
uint8_t last_day = 100;
|
||||
uint32_t count=10;
|
||||
uint8_t last_day = 100;
|
||||
uint32_t count = 10;
|
||||
while(1)
|
||||
{
|
||||
// vTaskDelay(1000);
|
||||
@ -554,9 +550,9 @@ void Task1(void *pvParameters)
|
||||
write_log(log_path,"sdcard will full," + String(used_percent * 100) + "%" +"used.",20);
|
||||
}
|
||||
|
||||
if(SD_MMC.exists("/guangpu_data/"+ String(now.year - 10) ))
|
||||
if(SD_MMC.exists("/guangpu_data/" + String(now.year - 10) ))
|
||||
{
|
||||
String path = "/guangpu_data/"+ String(now.year - 10);
|
||||
String path = "/guangpu_data/" + String(now.year - 10);
|
||||
rm_dir_or_file(path.c_str());
|
||||
}
|
||||
|
||||
@ -836,7 +832,6 @@ void task_4G_mode(void *pvParameters)
|
||||
doc_4G["SN"] = STRSensorInfos_structure.serialnumber;
|
||||
if(check_tuigan() == false )
|
||||
{
|
||||
|
||||
warn_sta = true;
|
||||
doc_4G["tuigan"] = "warn";
|
||||
if(get_tuigan_status() == tui)
|
||||
@ -1306,7 +1301,7 @@ void json_command(uint8_t port_type)
|
||||
//command 2
|
||||
else if (doc["command"] == "set_sensor_info")
|
||||
{
|
||||
write_log(log_path,"set_sensor_info",log_level);
|
||||
write_log(log_path,"set_sensor_info",log_level);
|
||||
if(doc["name"] == NULL)
|
||||
{
|
||||
send_str = "";
|
||||
@ -1598,7 +1593,7 @@ void json_command(uint8_t port_type)
|
||||
doc["work_mode"] = sys_sd_doc["work_mode"].as<String>();
|
||||
doc["caiji_mode"] = sys_sd_doc["caiji_mode"].as<String>();
|
||||
doc["atuo_return"] = sys_sd_doc["atuo_return"].as<String>();
|
||||
doc["return_data_type"] =sys_sd_doc["return_data_type"];
|
||||
doc["return_data_type"] = sys_sd_doc["return_data_type"];
|
||||
serializeJson(doc, send_str);
|
||||
ret = IRIS_Protocol_Pack(0x00,(uint16_t)send_str.length(), (uint8_t *)send_str.c_str(),send_buff);
|
||||
// wb485Serial.write(send_buff, ret);
|
||||
@ -1727,7 +1722,7 @@ void json_command(uint8_t port_type)
|
||||
|
||||
if(b1!=0 && b2 !=0 && b3 != 0 && b4 != 0)
|
||||
{
|
||||
save = true;
|
||||
save = true;
|
||||
bc_b1 = doc["bochangxishu"]["b0"];
|
||||
bc_b2 = doc["bochangxishu"]["b1"];
|
||||
bc_b3 = doc["bochangxishu"]["b2"];
|
||||
@ -2265,7 +2260,7 @@ void json_command(uint8_t port_type)
|
||||
}
|
||||
//command 28
|
||||
//获取电源电压
|
||||
else if(doc["command"] == "get_voltage")
|
||||
else if(doc["command"] == "get_voltage" )
|
||||
{
|
||||
float voltage = adc_read();
|
||||
doc["voltage"] = voltage;
|
||||
@ -2319,6 +2314,7 @@ void json_command(uint8_t port_type)
|
||||
if(port_type == 1) wb485Serial.write(send_buff,ret);
|
||||
else if(port_type == 2) mqtt_write(send_buff,ret);
|
||||
}
|
||||
|
||||
//command 31
|
||||
//计算波长
|
||||
else if(doc["command"] =="calculation")
|
||||
@ -2368,11 +2364,12 @@ void json_command(uint8_t port_type)
|
||||
if(port_type == 1) wb485Serial.write(send_buff,ret);
|
||||
else if(port_type == 2) mqtt_write(send_buff,ret);
|
||||
}
|
||||
//command 34
|
||||
else if(doc["command"] == "get_fanshelv_gain")
|
||||
{
|
||||
send_dingbiao("/dingbiao/fanshelv_gain.bin");
|
||||
|
||||
}
|
||||
//command 35
|
||||
else if(doc["command"] == "set_4g")
|
||||
{
|
||||
save = true;
|
||||
@ -2384,6 +2381,7 @@ void json_command(uint8_t port_type)
|
||||
if(port_type == 1) wb485Serial.write(send_buff,ret);
|
||||
else if(port_type == 2) mqtt_write(send_buff,ret);
|
||||
}
|
||||
//command 36
|
||||
else if(doc["command"] == "OTA")
|
||||
{
|
||||
sys_sd_doc["version_url"] = doc["version_url"];
|
||||
@ -2396,6 +2394,7 @@ void json_command(uint8_t port_type)
|
||||
else if(port_type == 2) mqtt_write(send_buff,ret);
|
||||
xEventGroupSetBits(Main_EventGroup, OTA_BIT);
|
||||
}
|
||||
//command 37
|
||||
else if(doc["command"] == "USB")
|
||||
{
|
||||
send_str = "";
|
||||
@ -2407,6 +2406,7 @@ void json_command(uint8_t port_type)
|
||||
// myusb_init();
|
||||
setupmsc();
|
||||
}
|
||||
//command 38
|
||||
else if(doc["command"] == "reboot")
|
||||
{
|
||||
// setupmsc();
|
||||
|
||||
Reference in New Issue
Block a user