|
|
|
@ -148,9 +148,8 @@ int DAQ(int t_hrs, int tm_s)
|
|
|
|
|
dfp = fopen(data_file_path, "w"); // open file for writing
|
|
|
|
|
time_t curtime; //current time (date)
|
|
|
|
|
time(&curtime); //saving date in curtime
|
|
|
|
|
fprintf(dfp, "Starting DAQ at %s\n"\
|
|
|
|
|
,
|
|
|
|
|
ctime(&curtime)); // send the value to the file
|
|
|
|
|
// send the value to the file
|
|
|
|
|
fprintf(dfp, "Starting DAQ at %s\n", ctime(&curtime);
|
|
|
|
|
fclose(dfp); // close the file using the file pointer
|
|
|
|
|
printf("%s", colums); //display variables colums
|
|
|
|
|
//ciclo
|
|
|
|
@ -158,8 +157,7 @@ int DAQ(int t_hrs, int tm_s)
|
|
|
|
|
new_time = t0; //saving initial time in time control variable
|
|
|
|
|
for(int i = 0; i < (t_hrs*3600); i=i+tm_s){ //cycle from 0 to adquisition time (seconds), incrementing sampling period
|
|
|
|
|
//checking if there's time to sleep
|
|
|
|
|
if (dif <= 0) printf("Ejecution time exceded.\n"\
|
|
|
|
|
"%s", colums);
|
|
|
|
|
if (dif <= 0) printf("Ejecution time exceded.\n%s", colums);
|
|
|
|
|
else usleep((int)dif); //inactivity time
|
|
|
|
|
//waiting to start measurements
|
|
|
|
|
while(new_time != time(NULL));
|
|
|
|
@ -169,13 +167,13 @@ int DAQ(int t_hrs, int tm_s)
|
|
|
|
|
uartTransmit(COAF, get_readigns);
|
|
|
|
|
uartTransmit(LuminOX, Readings_OX);
|
|
|
|
|
uartTransmit(SprintIR, get_readigns
|
|
|
|
|
//receiving replys from sensors
|
|
|
|
|
uartReceive(LuminOX);
|
|
|
|
|
//receiving replys from
|
|
|
|
|
uartReceive(COAF);
|
|
|
|
|
uartReceive(LuminOX);
|
|
|
|
|
uartReceive(SprintIR);
|
|
|
|
|
//interpreting and spliting measurements in variables
|
|
|
|
|
memcpy(co2_uf, gmeasures(receive[SprintIR], 'z', 5), 5);
|
|
|
|
|
memcpy(co2_f, gmeasures(receive[SprintIR], 'Z', 5), 5);
|
|
|
|
|
memcpy(co2_uf, gmeasures(receive[SprintIR],'z', 5), 5);
|
|
|
|
|
memcpy(co2_f, gmeasures(receive[SprintIR],'Z', 5), 5);
|
|
|
|
|
memcpy(co_uf, gmeasures(receive[COAF], 'z', 5), 5);
|
|
|
|
|
memcpy(co_f, gmeasures(receive[COAF], 'Z', 5), 5);
|
|
|
|
|
memcpy(o2_ppm, gmeasures(receive[LuminOX], 'O', 6), 6);
|
|
|
|
|