added flush

bp
alanbjohnston 5 years ago committed by GitHub
parent eda257a6c7
commit a08cc185f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -197,24 +197,24 @@ mode = AFSK;
// Open telemetry file with STEM Payload Data
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "r");
if (telem_file == NULL) {
printf("Creating telem file");
printf("Creating telem file\n");
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "w");
fprintf(telem_file, " ");
fclose(telem_file);
telem_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
}
printf("Opened telem file");
printf("Opened telem file\n");
// Open configuration file with callsign and reset count
FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
if (config_file == NULL) {
printf("Creating config file");
printf("Creating config file\n");
config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "w");
fprintf(config_file, "%s %d", " ", 100);
fclose(config_file);
config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
}
printf("Opened config file");
printf("Opened config file\n");
// char * cfg_buf[100];
fscanf(config_file, "%s %d %f %f", call, & reset_count, & lat_file, & long_file);
@ -956,6 +956,7 @@ void get_tlm(void) {
time_t timeStamp;
time(&timeStamp); // get timestamp
fprintf(telem_file, "%s %s", ctime(&timeStamp), sensor_payload); // write telemetry string to telem.txt file
fflush(telem_file);
// parse sensor payload
float sensor[17];

Loading…
Cancel
Save

Powered by TurnKey Linux.