|
|
|
@ -677,12 +677,17 @@ int main(int argc, char * argv[]) {
|
|
|
|
char timeStampNoNl[31], bat_string[31];
|
|
|
|
char timeStampNoNl[31], bat_string[31];
|
|
|
|
snprintf(timeStampNoNl, 30, "%.24s", ctime(&timeStamp));
|
|
|
|
snprintf(timeStampNoNl, 30, "%.24s", ctime(&timeStamp));
|
|
|
|
// printf("TimeStamp: %s\n", timeStampNoNl);
|
|
|
|
// printf("TimeStamp: %s\n", timeStampNoNl);
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (c2cStatus == DISABLED)
|
|
|
|
if (c2cStatus == DISABLED)
|
|
|
|
snprintf(bat_string, 30, "BAT %4.2f %5.1f", batteryVoltage, batteryCurrent);
|
|
|
|
snprintf(bat_string, 30, "BAT %4.2f %5.1f", batteryVoltage, batteryCurrent);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
snprintf(bat_string, 30, "BAT %4.2f %5.1f C", batteryVoltage, batteryCurrent);
|
|
|
|
snprintf(bat_string, 30, "BAT %4.2f %5.1f C", batteryVoltage, batteryCurrent);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
snprintf(bat_string, 30, "BAT %4.2f %5.1f", batteryVoltage, batteryCurrent);
|
|
|
|
|
|
|
|
if (c2cStatus != DISABLED)
|
|
|
|
|
|
|
|
strcpy(bat_string," C");
|
|
|
|
|
|
|
|
if (sim_mode || (failureMode != FAIL_NONE))
|
|
|
|
|
|
|
|
strcpy(bat_string," S");
|
|
|
|
fprintf(telem_file, "%s %s %s\n", timeStampNoNl, bat_string, sensor_payload); // write telemetry string to telem.txt file
|
|
|
|
fprintf(telem_file, "%s %s %s\n", timeStampNoNl, bat_string, sensor_payload); // write telemetry string to telem.txt file
|
|
|
|
fclose(telem_file);
|
|
|
|
fclose(telem_file);
|
|
|
|
|
|
|
|
|
|
|
|
@ -992,11 +997,21 @@ int main(int argc, char * argv[]) {
|
|
|
|
FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w");
|
|
|
|
FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w");
|
|
|
|
if (fp != NULL) {
|
|
|
|
if (fp != NULL) {
|
|
|
|
// printf("Writing telem_string.txt\n");
|
|
|
|
// printf("Writing telem_string.txt\n");
|
|
|
|
if (batteryVoltage != 4.5)
|
|
|
|
if (batteryVoltage != 4.5) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (c2cStatus == DISABLED)
|
|
|
|
if (c2cStatus == DISABLED)
|
|
|
|
fprintf(fp, "BAT %4.2fV %4.0fmA\n", batteryVoltage, batteryCurrent);
|
|
|
|
fprintf(fp, "BAT %4.2fV %4.0fmA\n", batteryVoltage, batteryCurrent);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
fprintf(fp, "BAT %4.2fV %4.0fmA C\n", batteryVoltage, batteryCurrent); // show command and control is on
|
|
|
|
fprintf(fp, "BAT %4.2fV %4.0fmA C\n", batteryVoltage, batteryCurrent); // show command and control is on
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fprintf(fp, "BAT %4.2fV %4.0fmA", batteryVoltage, batteryCurrent);
|
|
|
|
|
|
|
|
if (c2cStatus != DISABLED)
|
|
|
|
|
|
|
|
fprintf(fp," C");
|
|
|
|
|
|
|
|
if (sim_mode || (failureMode != FAIL_NONE))
|
|
|
|
|
|
|
|
fprintf(fp," S\n");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
fprintf(fp,"\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
fprintf(fp, "\n"); // don't show voltage and current if it isn't a sensor value
|
|
|
|
fprintf(fp, "\n"); // don't show voltage and current if it isn't a sensor value
|
|
|
|
|
|
|
|
|
|
|
|
@ -1233,13 +1248,19 @@ void get_tlm(void) {
|
|
|
|
// fclose(file_append);
|
|
|
|
// fclose(file_append);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} else { // APRS
|
|
|
|
} else { // APRS
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (c2cStatus == 0)
|
|
|
|
if (c2cStatus == 0)
|
|
|
|
sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent);
|
|
|
|
sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
sprintf(tlm_str, "BAT %4.2f %5.1f C ", batteryVoltage, batteryCurrent);
|
|
|
|
sprintf(tlm_str, "BAT %4.2f %5.1f C ", batteryVoltage, batteryCurrent);
|
|
|
|
|
|
|
|
*/
|
|
|
|
strcat(str, tlm_str);
|
|
|
|
snprintf(tlm_str, 30, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent);
|
|
|
|
|
|
|
|
if (c2cStatus != DISABLED)
|
|
|
|
|
|
|
|
strcpy(tlm_str,"C ");
|
|
|
|
|
|
|
|
if (sim_mode || (failureMode != FAIL_NONE))
|
|
|
|
|
|
|
|
strcpy(tlm_str,"S ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strcat(str, tlm_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// strcpy(sensor_payload, buffer2);
|
|
|
|
// strcpy(sensor_payload, buffer2);
|
|
|
|
|