@ -79,10 +79,25 @@ uint8_t DS18b20_init()
|
|||||||
void getall_temp(float *temp)
|
void getall_temp(float *temp)
|
||||||
{
|
{
|
||||||
DS18b20.requestTemperatures(); // Send the command to get temperatures
|
DS18b20.requestTemperatures(); // Send the command to get temperatures
|
||||||
|
// vTaskDelay(1000);
|
||||||
|
|
||||||
for(int8_t i ;i<temp_number;i++)
|
for(int8_t i ;i<temp_number;i++)
|
||||||
{
|
{
|
||||||
temp[i] = DS18b20.getTempC(p[i]);
|
temp[i] = DS18b20.getTempC(p[i]);
|
||||||
// temp[i] = getone_temp(i);
|
uint32_t n = 0;
|
||||||
|
while(temp[i] < -110)
|
||||||
|
{
|
||||||
|
vTaskDelay(100);
|
||||||
|
// temp[i] = DS18b20.getTempC(p[i]);
|
||||||
|
temp[i] = getone_temp(i);
|
||||||
|
n++;
|
||||||
|
if (n>40)
|
||||||
|
{
|
||||||
|
write_log(log_path,"ds18b20 get temperature failed",10);
|
||||||
|
// return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// write_log(log_path,"get temperatures ok",10);
|
// write_log(log_path,"get temperatures ok",10);
|
||||||
|
|||||||
@ -894,6 +894,9 @@ void SensorIS11::get_fanshelv()
|
|||||||
IS11_datastruct_fanshelv.data[i] =IS11_datastruct_fanshelv.data[i]*fanshelv_struct.gain[i];
|
IS11_datastruct_fanshelv.data[i] =IS11_datastruct_fanshelv.data[i]*fanshelv_struct.gain[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Serial0.println("fanshelv");
|
||||||
|
Serial0.printf("fanshelv_struct.data[%d] = %f\n",1,IS11_datastruct_fanshelv.data[0]);
|
||||||
|
Serial0.printf("fanshelv_struct.data[%d] = %f\n",2047,IS11_datastruct_fanshelv.data[2047]);
|
||||||
IS11_datastruct_fanshelv.NCa = 1;
|
IS11_datastruct_fanshelv.NCa = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ void log_init()
|
|||||||
|
|
||||||
void write_log(String path,String write_data,unsigned char level)
|
void write_log(String path,String write_data,unsigned char level)
|
||||||
{
|
{
|
||||||
if(level <5) {
|
if(level <50) {
|
||||||
U0_Serial.println(write_data);
|
U0_Serial.println(write_data);
|
||||||
// Serial0.println(write_data);
|
// Serial0.println(write_data);
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main.cpp
16
src/main.cpp
@ -157,8 +157,8 @@ bool UpdateData(String path,uint8_t *data, size_t lenth, String Contenttype = ""
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
sun_latitude = 39.6;
|
sun_latitude = 39.5;
|
||||||
sun_longitude = 116.3;
|
sun_longitude = 117.6;
|
||||||
// Serial2.begin(115200, SERIAL_8N1, SIMUART_RX, SIMUART_TX);
|
// Serial2.begin(115200, SERIAL_8N1, SIMUART_RX, SIMUART_TX);
|
||||||
//关闭光谱仪
|
//关闭光谱仪
|
||||||
pinMode(36,OUTPUT);
|
pinMode(36,OUTPUT);
|
||||||
@ -711,10 +711,10 @@ void Task1(void *pvParameters)
|
|||||||
|
|
||||||
float temperature[8];
|
float temperature[8];
|
||||||
getall_temp(temperature);
|
getall_temp(temperature);
|
||||||
vTaskDelay(100);
|
// vTaskDelay(100);
|
||||||
getall_temp(temperature);
|
// getall_temp(temperature);
|
||||||
vTaskDelay(100);
|
// vTaskDelay(100);
|
||||||
getall_temp(temperature);
|
// getall_temp(temperature);
|
||||||
for(uint8_t n=0; n<8 ;n++)
|
for(uint8_t n=0; n<8 ;n++)
|
||||||
{
|
{
|
||||||
if(temperature[n] < -120) write_log(log_path,"temperature " + String(n+1) +":" + String(temperature[n])+"This sensor is broken.",20);
|
if(temperature[n] < -120) write_log(log_path,"temperature " + String(n+1) +":" + String(temperature[n])+"This sensor is broken.",20);
|
||||||
@ -853,9 +853,10 @@ void task_4G_mode(void *pvParameters)
|
|||||||
doc_4G["Voltage_value"] = Voltage;
|
doc_4G["Voltage_value"] = Voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
getall_temp(temperature);
|
// getall_temp(temperature);
|
||||||
for(uint8_t n=0; n<8 ;n++)
|
for(uint8_t n=0; n<8 ;n++)
|
||||||
{
|
{
|
||||||
|
temperature[n] = IS11_datastruct_fanshelv.temprature[n];
|
||||||
if((temperature[n] < -10) || (temperature[n] > 50))
|
if((temperature[n] < -10) || (temperature[n] > 50))
|
||||||
{
|
{
|
||||||
warn_sta = true;
|
warn_sta = true;
|
||||||
@ -918,6 +919,7 @@ void task_4G_mode(void *pvParameters)
|
|||||||
Serial0.println("now_time " + String(now_time));
|
Serial0.println("now_time " + String(now_time));
|
||||||
Serial0.println("start_time " + String(start_time));
|
Serial0.println("start_time " + String(start_time));
|
||||||
Serial0.println("stop_time " + String(stop_time));
|
Serial0.println("stop_time " + String(stop_time));
|
||||||
|
// vTaskDelay(1000 * 1);
|
||||||
if((now_time >= start_time) && (now_time < stop_time))
|
if((now_time >= start_time) && (now_time < stop_time))
|
||||||
{
|
{
|
||||||
is11Sensor->TakeOneJob();
|
is11Sensor->TakeOneJob();
|
||||||
|
|||||||
Reference in New Issue
Block a user