From fc81909d9e78192f900e1961ae9a666ca0e08b45 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 13 Dec 2023 11:43:27 -0500 Subject: [PATCH] Update main.c don't show voltage and current in sstv if not sensor --- main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c09d269a..4191c9d9 100644 --- a/main.c +++ b/main.c @@ -919,9 +919,13 @@ int main(int argc, char * argv[]) { //#endif FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); - if (fp != NULL) { - printf("Writing telem_string.txt\n"); - fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); + if ((fp != NULL) { + printf("Writing telem_string.txt\n"); + if (batteryVoltage != 4.5) + fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); + else + fprintf(fp, "\n"); // don't show voltage and current if it isn't a sensor value + fclose(fp); } else printf("Error writing to telem_string.txt\n");