Compare commits
2 Commits
3276dc5981
...
900cbc3f79
| Author | SHA1 | Date | |
|---|---|---|---|
| 900cbc3f79 | |||
| f45ae095aa |
@ -774,7 +774,12 @@ void SensorIS11::TakeOneJob()
|
|||||||
double b3 = SensorIS11::guangpu_bochang.b3;
|
double b3 = SensorIS11::guangpu_bochang.b3;
|
||||||
for (uint32_t i = 0; i < 2048; i++)
|
for (uint32_t i = 0; i < 2048; i++)
|
||||||
{
|
{
|
||||||
xValues[i] = b0 * i * i * i + b1 * i * i + b2 * i+ b3;
|
// xValues[i] = b0 * i * i * i + b1 * i * i + b2 * i+ b3;
|
||||||
|
double p_up = SensorInfo.a1 * i * i * i + SensorInfo.a2 * i * i + SensorInfo.a3 * i+ SensorInfo.a4;
|
||||||
|
|
||||||
|
// = p_up + (-2.999e-7 * p_up*p_up + 0.0009475 * p_up - 0.48467);
|
||||||
|
|
||||||
|
xValues[i] = p_up + (9.4755e-11*p_up*p_up*p_up - 6.0470e-07*p_up*p_up + 0.0012166*p_up - 0.53644);
|
||||||
IS11_datastruct_down.data[i] = DATABUFF[i];
|
IS11_datastruct_down.data[i] = DATABUFF[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1473,11 +1478,20 @@ void SensorIS11::advanced_mode(u_int32_t direction,u_int32_t shutter_time,u_int3
|
|||||||
double b3 = SensorIS11::guangpu_bochang.b3;
|
double b3 = SensorIS11::guangpu_bochang.b3;
|
||||||
write_log(log_path,"bochang:"+String(b0,4)+" "+String(b1,4)+" "+String(b2,4)+" "+String(b3,4),10);
|
write_log(log_path,"bochang:"+String(b0,4)+" "+String(b1,4)+" "+String(b2,4)+" "+String(b3,4),10);
|
||||||
yValues = IS11_datastructure_avn->data;
|
yValues = IS11_datastructure_avn->data;
|
||||||
|
// for (uint32_t i = 0; i < 2048; i++)
|
||||||
|
// {
|
||||||
|
// xValues[i] = b0 * i * i * i + b1 * i * i + b2 * i+ b3;
|
||||||
|
|
||||||
|
// // yValues[i] = IS11_datastructure_avn->data[i];
|
||||||
|
|
||||||
|
// }
|
||||||
for (uint32_t i = 0; i < 2048; i++)
|
for (uint32_t i = 0; i < 2048; i++)
|
||||||
{
|
{
|
||||||
xValues[i] = b0 * i * i * i + b1 * i * i + b2 * i+ b3;
|
// xValues[i] = b0 * i * i * i + b1 * i * i + b2 * i+ b3;
|
||||||
|
double p_up = SensorInfo.a1 * i * i * i + SensorInfo.a2 * i * i + SensorInfo.a3 * i+ SensorInfo.a4;
|
||||||
// yValues[i] = IS11_datastructure_avn->data[i];
|
// xValues[i] = p_up + (-2.999e-7 * p_up*p_up + 0.0009475 * p_up - 0.48467);
|
||||||
|
xValues[i] = p_up + (9.4755e-11*p_up*p_up*p_up - 6.0470e-07*p_up*p_up + 0.0012166*p_up - 0.53644);
|
||||||
|
IS11_datastruct_down.data[i] = DATABUFF[i];
|
||||||
}
|
}
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
for (uint32_t i = 0; i < 2048;i++)
|
for (uint32_t i = 0; i < 2048;i++)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ struct STRSensorInfo
|
|||||||
long BandNum;
|
long BandNum;
|
||||||
String WavelenthStr;
|
String WavelenthStr;
|
||||||
float *wavelenthlist;
|
float *wavelenthlist;
|
||||||
//double *wavelenth;
|
//double * ;
|
||||||
bool isSensorInit;
|
bool isSensorInit;
|
||||||
String serialnumber;
|
String serialnumber;
|
||||||
double a1,a2,a3,a4;
|
double a1,a2,a3,a4;
|
||||||
|
|||||||
@ -68,8 +68,6 @@ void gsmm_mqtt_loop_task(void *pvParameters)
|
|||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
EventBits_t uxBits = xEventGroupGetBits(http_event_group);
|
EventBits_t uxBits = xEventGroupGetBits(http_event_group);
|
||||||
if (uxBits & mqtt_stop_bit)
|
if (uxBits & mqtt_stop_bit)
|
||||||
{
|
{
|
||||||
@ -404,7 +402,9 @@ void Update_firmware(Stream &updateSource, size_t updateSize)
|
|||||||
if (Update.isFinished())
|
if (Update.isFinished())
|
||||||
{
|
{
|
||||||
//Serial.println("Restart ESP device!");
|
//Serial.println("Restart ESP device!");
|
||||||
abort();
|
// abort();
|
||||||
|
// ESP.restart();
|
||||||
|
esp_restart();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -424,17 +424,20 @@ void Update_firmware(Stream &updateSource, size_t updateSize)
|
|||||||
size_t http_download(String url)
|
size_t http_download(String url)
|
||||||
{
|
{
|
||||||
// String url="/gaoguangpu/firmware/esp32/firmware_"+version+".bin";
|
// String url="/gaoguangpu/firmware/esp32/firmware_"+version+".bin";
|
||||||
|
write_log(log_path,"start http_download",10);
|
||||||
int err = http->get(url.c_str());
|
int err = http->get(url.c_str());
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
//Serial.println(F("Date failed to connect"));
|
//Serial.println(F("Date failed to connect"));
|
||||||
vTaskDelay(10000);
|
write_log(log_path,"Date failed to connect",10);
|
||||||
|
vTaskDelay(100);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int status = http->responseStatusCode();
|
int status = http->responseStatusCode();
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
vTaskDelay(10000);
|
write_log(log_path,"http->responseStatusCode false",10);
|
||||||
|
vTaskDelay(100);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//Serial.print(F("Response status code: "));
|
//Serial.print(F("Response status code: "));
|
||||||
@ -477,7 +480,7 @@ size_t http_download(String url)
|
|||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
http->stop();
|
http->stop();
|
||||||
|
write_log(log_path,"download finish",10);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,6 +508,7 @@ bool check_file_ota(String MD5)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Serial.println("md5 error");
|
//Serial.println("md5 error");
|
||||||
|
write_log(log_path,"md5 error",10);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -519,8 +523,10 @@ void http_OTA(String url,String MD5)
|
|||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_log(log_path,"wait mqtt stop",10);
|
||||||
xEventGroupSetBits(http_event_group, mqtt_stop_bit);
|
xEventGroupSetBits(http_event_group, mqtt_stop_bit);
|
||||||
xEventGroupWaitBits(http_event_group, Http_start_bit,pdTRUE, pdFALSE,portMAX_DELAY);
|
xEventGroupWaitBits(http_event_group, Http_start_bit,pdTRUE, pdFALSE,portMAX_DELAY);
|
||||||
|
write_log(log_path,"start http_OTA",10);
|
||||||
uint32_t count = http_download(url);
|
uint32_t count = http_download(url);
|
||||||
if(count != 0) check_file_ota(MD5);
|
if(count != 0) check_file_ota(MD5);
|
||||||
|
|
||||||
|
|||||||
119
src/main.cpp
119
src/main.cpp
@ -42,8 +42,8 @@ void OTA_task(void *pvParameters);
|
|||||||
//caiji_mode 0;停止 1:单次 2:连续 3:定标 4:高级模式 5:回传数据 6:低功耗模式
|
//caiji_mode 0;停止 1:单次 2:连续 3:定标 4:高级模式 5:回传数据 6:低功耗模式
|
||||||
volatile u_int32_t work_mode = 0,caiji_mode = 0,return_mode = 1,atuo_return = 0,return_data_type = 0x00,time_interval = 60 * 2,caiji_state = 0 ,fengbao_num=0;
|
volatile u_int32_t work_mode = 0,caiji_mode = 0,return_mode = 1,atuo_return = 0,return_data_type = 0x00,time_interval = 60 * 2,caiji_state = 0 ,fengbao_num=0;
|
||||||
// volatile float start_time = 1.0,stop_time = 20.30,maximum_temperature = 10,Minimum_temperature = 0,bc_b1,bc_b2,bc_b3,bc_b4,sun_latitude,sun_longitude;
|
// volatile float start_time = 1.0,stop_time = 20.30,maximum_temperature = 10,Minimum_temperature = 0,bc_b1,bc_b2,bc_b3,bc_b4,sun_latitude,sun_longitude;
|
||||||
volatile float start_time = 1.0,stop_time = 20.30,maximum_temperature = 10,Minimum_temperature = 0,sun_latitude,sun_longitude;
|
volatile float start_time = 0.1,stop_time = 23.59,maximum_temperature = 10,Minimum_temperature = 0,sun_latitude,sun_longitude;
|
||||||
|
volatile float sunrise, sunset;
|
||||||
volatile float calculation_bochang1,calculation_bochang2;
|
volatile float calculation_bochang1,calculation_bochang2;
|
||||||
// volatile u_int32_t http_flag = 0;
|
// volatile u_int32_t http_flag = 0;
|
||||||
|
|
||||||
@ -213,6 +213,18 @@ void setup()
|
|||||||
|
|
||||||
// 初始化DS18b20
|
// 初始化DS18b20
|
||||||
uint8_t temp_number = DS18b20_init();
|
uint8_t temp_number = DS18b20_init();
|
||||||
|
// while(1)
|
||||||
|
// {
|
||||||
|
// ////排序时使用
|
||||||
|
// float temp[8];
|
||||||
|
// getall_temp(temp);
|
||||||
|
|
||||||
|
// for(int i = 0;i<8;i++)
|
||||||
|
// {
|
||||||
|
// Serial.printf("temp[%d]: %f\n",i + 1,temp[i]);
|
||||||
|
// }
|
||||||
|
// vTaskDelay(500);
|
||||||
|
// }
|
||||||
|
|
||||||
//ADC电压采集初始化
|
//ADC电压采集初始化
|
||||||
// adc_init();
|
// adc_init();
|
||||||
@ -234,7 +246,7 @@ void setup()
|
|||||||
write_log(log_path," ",20);
|
write_log(log_path," ",20);
|
||||||
write_log(log_path,"===============================================================",20);
|
write_log(log_path,"===============================================================",20);
|
||||||
write_log(log_path,time,20);
|
write_log(log_path,time,20);
|
||||||
write_log(log_path,"system start",20);
|
write_log(log_path,"system start !",20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -256,12 +268,24 @@ void setup()
|
|||||||
vTaskDelay(1000 * 2);
|
vTaskDelay(1000 * 2);
|
||||||
InitFunction(serialwrite,serialread);
|
InitFunction(serialwrite,serialread);
|
||||||
is11Sensor = new SensorIS11();
|
is11Sensor = new SensorIS11();
|
||||||
|
|
||||||
STRSensorInfos_structure = is11Sensor->initSensor();
|
STRSensorInfos_structure = is11Sensor->initSensor();
|
||||||
//Serial.println("IS_SN :" +STRSensorInfos_structure.serialnumber);
|
// if(STRSensorInfos_structure.serialnumber.find("TFNSP") == -1 && STRSensorInfos_structure.serialnumber.find("IS") == -1);
|
||||||
|
// {
|
||||||
|
// STRSensorInfos_structure.serialnumber = "TFNSP44250004";
|
||||||
|
// is11Sensor->SensorInfo.a1 = -1.08988798e-09;
|
||||||
|
// is11Sensor->SensorInfo.a2 = -5.32620063e-05;
|
||||||
|
// is11Sensor->SensorInfo.a3 = 0.441532;
|
||||||
|
// is11Sensor->SensorInfo.a4 = 348.5026;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
Serial.println("IS_SN :" +STRSensorInfos_structure.serialnumber);
|
||||||
|
|
||||||
// is11Sensor->guangpu_bochang.a1 = 0.000000000000000;
|
// is11Sensor->guangpu_bochang.a1 = 0.000000000000000;
|
||||||
// is11Sensor->guangpu_bochang.a2 = 0.000000000;
|
// is11Sensor->guangpu_bochang.a2 = 0.000000000;
|
||||||
|
sys_sd_doc["firmware"] = "V2.0.5";
|
||||||
|
sys_sd_doc["version"] = "V2.0.5";
|
||||||
sys_info_init();
|
sys_info_init();
|
||||||
|
|
||||||
// dingbiao_init("/dingbiao/dingbiao_up_gain.bin");
|
// dingbiao_init("/dingbiao/dingbiao_up_gain.bin");
|
||||||
@ -298,7 +322,7 @@ void setup()
|
|||||||
|
|
||||||
if(is11Sensor->guangpu_bochang.b3 < 100)
|
if(is11Sensor->guangpu_bochang.b3 < 100)
|
||||||
{
|
{
|
||||||
// write_log(log_path,"guangpu_bochang.b3 < 100",10);
|
write_log(log_path,"guangpu_bochang.b3 false",10);
|
||||||
is11Sensor->guangpu_bochang.is_valid = false;
|
is11Sensor->guangpu_bochang.is_valid = false;
|
||||||
is11Sensor->guangpu_bochang.a0 = is11Sensor->SensorInfo.a1;
|
is11Sensor->guangpu_bochang.a0 = is11Sensor->SensorInfo.a1;
|
||||||
is11Sensor->guangpu_bochang.a1 = is11Sensor->SensorInfo.a2;
|
is11Sensor->guangpu_bochang.a1 = is11Sensor->SensorInfo.a2;
|
||||||
@ -309,10 +333,16 @@ void setup()
|
|||||||
is11Sensor->guangpu_bochang.b1 = is11Sensor->SensorInfo.a2;
|
is11Sensor->guangpu_bochang.b1 = is11Sensor->SensorInfo.a2;
|
||||||
is11Sensor->guangpu_bochang.b2 = is11Sensor->SensorInfo.a3;
|
is11Sensor->guangpu_bochang.b2 = is11Sensor->SensorInfo.a3;
|
||||||
is11Sensor->guangpu_bochang.b3 = is11Sensor->SensorInfo.a4;
|
is11Sensor->guangpu_bochang.b3 = is11Sensor->SensorInfo.a4;
|
||||||
|
|
||||||
|
sys_sd_doc["bochangxishu"]["a0"] = is11Sensor->guangpu_bochang.a0;
|
||||||
|
sys_sd_doc["bochangxishu"]["a1"] = is11Sensor->guangpu_bochang.a1;
|
||||||
|
sys_sd_doc["bochangxishu"]["a2"] = is11Sensor->guangpu_bochang.a2;
|
||||||
|
sys_sd_doc["bochangxishu"]["a3"] = is11Sensor->guangpu_bochang.a3;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// write_log(log_path,"guangpu_bochang.b3 >= 100",10);
|
write_log(log_path,"guangpu_bochang.b3 true",10);
|
||||||
is11Sensor->guangpu_bochang.is_valid = true;
|
is11Sensor->guangpu_bochang.is_valid = true;
|
||||||
is11Sensor->SensorInfo.a1 = is11Sensor->guangpu_bochang.a0;
|
is11Sensor->SensorInfo.a1 = is11Sensor->guangpu_bochang.a0;
|
||||||
is11Sensor->SensorInfo.a2 = is11Sensor->guangpu_bochang.a1;
|
is11Sensor->SensorInfo.a2 = is11Sensor->guangpu_bochang.a1;
|
||||||
@ -328,7 +358,7 @@ void setup()
|
|||||||
|
|
||||||
|
|
||||||
xTaskCreatePinnedToCore(task_4G_mode, "task_4G_mode",1024*23,NULL, 1,&A4G_Handler, 1);
|
xTaskCreatePinnedToCore(task_4G_mode, "task_4G_mode",1024*23,NULL, 1,&A4G_Handler, 1);
|
||||||
xTaskCreatePinnedToCore(OTA_task , "OTA_task",1024*10 ,NULL, 1,&OTA_Handler, 1);
|
xTaskCreatePinnedToCore(OTA_task , "OTA_task",1024*4 ,NULL, 1,&OTA_Handler, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -600,14 +630,17 @@ void Task1(void *pvParameters)
|
|||||||
|
|
||||||
// 推杆
|
// 推杆
|
||||||
// 日出日落控制 太阳升起前推杆缩,太阳落下后推杆伸
|
// 日出日落控制 太阳升起前推杆缩,太阳落下后推杆伸
|
||||||
double transit, sunrise, sunset;
|
double transit,sunrise_l,sunset_l;
|
||||||
double utc_offset = 8;
|
double utc_offset = 8;
|
||||||
float tuisuotime = now.hour *100 + now.minute;
|
float tuisuotime = now.hour *100 + now.minute;
|
||||||
tuisuotime = tuisuotime /100;
|
tuisuotime = tuisuotime /100;
|
||||||
calcSunriseSunset(now.year+2000,now.month,now.day,sun_latitude,sun_longitude, transit, sunrise, sunset);
|
calcSunriseSunset(now.year+2000,now.month,now.day,sun_latitude,sun_longitude, transit, sunrise_l, sunset_l);
|
||||||
|
|
||||||
sunrise += utc_offset;
|
sunrise_l += utc_offset;
|
||||||
sunset += utc_offset;
|
sunset_l += utc_offset;
|
||||||
|
|
||||||
|
sunrise = sunrise_l;
|
||||||
|
sunset = sunset_l;
|
||||||
|
|
||||||
write_log(log_path,"now.hour: " + String(now.hour),log_level);
|
write_log(log_path,"now.hour: " + String(now.hour),log_level);
|
||||||
write_log(log_path,"sunrise: " + String((int)sunrise),log_level);
|
write_log(log_path,"sunrise: " + String((int)sunrise),log_level);
|
||||||
@ -780,7 +813,8 @@ void task_4G_mode(void *pvParameters)
|
|||||||
write_log(log_path,"task 4G mode",10);
|
write_log(log_path,"task 4G mode",10);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
Serial.println("task_4G_mode 11");
|
// Serial.println("task_4G_mode 11");
|
||||||
|
write_log(log_path,"task_4G_mode 11",10);
|
||||||
// vTaskDelay(1000 * 10);
|
// vTaskDelay(1000 * 10);
|
||||||
bool warn_sta = false;
|
bool warn_sta = false;
|
||||||
float temperature[8];
|
float temperature[8];
|
||||||
@ -881,6 +915,9 @@ void task_4G_mode(void *pvParameters)
|
|||||||
{
|
{
|
||||||
sun_latitude = gps_structure.latitude;
|
sun_latitude = gps_structure.latitude;
|
||||||
sun_longitude = gps_structure.longitude;
|
sun_longitude = gps_structure.longitude;
|
||||||
|
|
||||||
|
sys_sd_doc["gps_info"]["latitude"] = sun_latitude;
|
||||||
|
sys_sd_doc["gps_info"]["longitude"] = sun_longitude;
|
||||||
xSemaphoreGive(xMutexInventory);
|
xSemaphoreGive(xMutexInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,7 +944,22 @@ void task_4G_mode(void *pvParameters)
|
|||||||
//Serial.println("start_time " + String(start_time));
|
//Serial.println("start_time " + String(start_time));
|
||||||
//Serial.println("stop_time " + String(stop_time));
|
//Serial.println("stop_time " + String(stop_time));
|
||||||
// vTaskDelay(1000 * 1);
|
// vTaskDelay(1000 * 1);
|
||||||
if((now_time >= start_time) && (now_time < stop_time))
|
float start = 7;
|
||||||
|
float stop = 19;
|
||||||
|
if(sys_sd_doc["work_time"] = "gps")
|
||||||
|
{
|
||||||
|
start = sunrise;
|
||||||
|
stop = sunset;
|
||||||
|
write_log(log_path,"work_time gps",10);
|
||||||
|
}
|
||||||
|
else if(sys_sd_doc["work_time"] = "manual")
|
||||||
|
{
|
||||||
|
start = start_time;
|
||||||
|
stop = stop_time;
|
||||||
|
write_log(log_path,"manual",10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((now_time >= start) && (now_time < stop))
|
||||||
{
|
{
|
||||||
is11Sensor->TakeOneJob();
|
is11Sensor->TakeOneJob();
|
||||||
is11Sensor->get_fanshelv();
|
is11Sensor->get_fanshelv();
|
||||||
@ -968,12 +1020,23 @@ void task_4G_mode(void *pvParameters)
|
|||||||
|
|
||||||
void OTA_task(void *pvParameters)
|
void OTA_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
|
vTaskDelay(10);
|
||||||
|
write_log(log_path,"ota task start",10);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
xEventGroupWaitBits(Main_EventGroup, OTA_BIT, pdTRUE, pdFALSE, portMAX_DELAY);
|
xEventGroupWaitBits(Main_EventGroup, OTA_BIT, pdTRUE, pdFALSE, portMAX_DELAY);
|
||||||
|
write_log(log_path,"ota start",10);
|
||||||
vTaskDelay(100);
|
vTaskDelay(100);
|
||||||
|
// vTaskSuspend(Task0_Handler);
|
||||||
|
// vTaskSuspend(Task1_Handler);
|
||||||
|
|
||||||
|
vTaskSuspend(A4G_Handler);
|
||||||
|
|
||||||
String url = sys_sd_doc["version_url"];
|
String url = sys_sd_doc["version_url"];
|
||||||
String MD5 = sys_sd_doc["MD5"];
|
String MD5 = sys_sd_doc["MD5"];
|
||||||
|
// write_log(log_path,"ota start",10);
|
||||||
|
write_log(log_path,"ota url: " + url,10);
|
||||||
|
write_log(log_path,"ota MD5: " + MD5,10);
|
||||||
http_OTA(url, MD5);
|
http_OTA(url, MD5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -995,10 +1058,10 @@ void receive_command_unpack(uint8_t * read_buf,uint16_t data_length,uint8_t port
|
|||||||
// write_log(log_path,"ret: " + String(ret),10);
|
// write_log(log_path,"ret: " + String(ret),10);
|
||||||
|
|
||||||
// Serial.println("read_buf: " + String(read_buf,data_length));
|
// Serial.println("read_buf: " + String(read_buf,data_length));
|
||||||
for (int i = 0; i < data_length; i++)
|
// for (int i = 0; i < data_length; i++)
|
||||||
{
|
// {
|
||||||
Serial.printf("%02X ",read_buf[i]);
|
// Serial.printf("%02X ",read_buf[i]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
@ -2471,6 +2534,17 @@ void json_command(uint8_t port_type)
|
|||||||
else if(port_type == 2) mqtt_write(send_buff,ret);
|
else if(port_type == 2) mqtt_write(send_buff,ret);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
|
else if(doc["command"] == "set_work_time")
|
||||||
|
{
|
||||||
|
save = true;
|
||||||
|
sys_sd_doc["work_time"] = doc["work_time"];
|
||||||
|
send_str = "";
|
||||||
|
doc["state"] = "success";
|
||||||
|
serializeJson(doc, send_str);
|
||||||
|
ret = IRIS_Protocol_Pack(0x00,(uint16_t)send_str.length(), (uint8_t *)send_str.c_str(),send_buff);
|
||||||
|
if(port_type == 1) wb485Serial.write(send_buff,ret);
|
||||||
|
else if(port_type == 2) mqtt_write(send_buff,ret);
|
||||||
|
}
|
||||||
//command error
|
//command error
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2524,7 +2598,7 @@ void sys_info_init()
|
|||||||
sys_sd_doc["sensor_type"] = "IRIS-IS11";
|
sys_sd_doc["sensor_type"] = "IRIS-IS11";
|
||||||
sys_sd_doc["serialnumber"] = STRSensorInfos_structure.serialnumber;
|
sys_sd_doc["serialnumber"] = STRSensorInfos_structure.serialnumber;
|
||||||
// sys_sd_doc["serialnumber"] = "is110008";
|
// sys_sd_doc["serialnumber"] = "is110008";
|
||||||
sys_sd_doc["version"] = doc["version"].as<String>();
|
// sys_sd_doc["version"] = doc["version"].as<String>();
|
||||||
sys_sd_doc["date"] = rtcdate_now;
|
sys_sd_doc["date"] = rtcdate_now;
|
||||||
|
|
||||||
sys_sd_doc["status_4g"] = doc["status_4g"].as<String>();
|
sys_sd_doc["status_4g"] = doc["status_4g"].as<String>();
|
||||||
@ -2646,8 +2720,10 @@ void sys_info_init()
|
|||||||
{
|
{
|
||||||
atuo_return = 0;
|
atuo_return = 0;
|
||||||
}
|
}
|
||||||
sys_sd_doc["gps_info"]["latitude"] = gps_structure.latitude;
|
sys_sd_doc["gps_info"]["latitude"] = sun_latitude;
|
||||||
sys_sd_doc["gps_info"]["longitude"] = gps_structure.longitude;
|
sys_sd_doc["gps_info"]["longitude"] = sun_longitude;
|
||||||
|
sys_sd_doc["work_time"] = doc["work_time"];
|
||||||
|
|
||||||
|
|
||||||
system_info = "";
|
system_info = "";
|
||||||
serializeJson(sys_sd_doc, system_info);
|
serializeJson(sys_sd_doc, system_info);
|
||||||
@ -2687,6 +2763,7 @@ void sys_info_init()
|
|||||||
sys_sd_doc["atuo_return"] = "no";
|
sys_sd_doc["atuo_return"] = "no";
|
||||||
sys_sd_doc["gps_info"]["latitude"] = gps_structure.latitude;
|
sys_sd_doc["gps_info"]["latitude"] = gps_structure.latitude;
|
||||||
sys_sd_doc["gps_info"]["longitude"] = gps_structure.longitude;
|
sys_sd_doc["gps_info"]["longitude"] = gps_structure.longitude;
|
||||||
|
sys_sd_doc["work_time"] = "manual";
|
||||||
|
|
||||||
serializeJson(sys_sd_doc, system_info);
|
serializeJson(sys_sd_doc, system_info);
|
||||||
write_log(log_path, system_info,log_level);
|
write_log(log_path, system_info,log_level);
|
||||||
|
|||||||
Reference in New Issue
Block a user