diff --git a/daq.c b/daq.c index c0c7008..5fcd322 100644 --- a/daq.c +++ b/daq.c @@ -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,22 +167,22 @@ 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(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); - memcpy(o2_xcent, gmeasures(receive[LuminOX], '%', 6), 6); - memcpy(co2_temp, gmeasures(receive[COAF], 'T', 5), 5); - memcpy(o2_temp, gmeasures(receive[LuminOX], 'T', 5), 5); - memcpy(co2_press,gmeasures(receive[COAF], 'B', 5), 5); - memcpy(o2_press, gmeasures(receive[LuminOX], 'P', 4), 4); - memcpy(co2_relH, gmeasures(receive[COAF], 'H', 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); + memcpy(o2_xcent, gmeasures(receive[LuminOX], '%', 6), 6); + memcpy(co2_temp, gmeasures(receive[COAF], 'T', 5), 5); + memcpy(o2_temp, gmeasures(receive[LuminOX], 'T', 5), 5); + memcpy(co2_press,gmeasures(receive[COAF], 'B', 5), 5); + memcpy(o2_press, gmeasures(receive[LuminOX], 'P', 4), 4); + memcpy(co2_relH, gmeasures(receive[COAF], 'H', 5), 5); //saving formated measurements in string DATA sprintf(DATA, "%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s",