From 26c2d34d91519910ae8c473e80c7348098b97ea1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 10 Sep 2025 10:11:56 -0400 Subject: [PATCH] Update main.c show sim voltage and current in sstv --- main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 71624557..ae675938 100644 --- a/main.c +++ b/main.c @@ -1003,8 +1003,7 @@ int main(int argc, char * argv[]) { FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); if (fp != NULL) { // printf("Writing telem_string.txt\n"); -// if (batteryVoltage != 4.5) { - if (1) { + if (batteryVoltage != 4.5) { /* if (c2cStatus == DISABLED) fprintf(fp, "BAT %4.2fV %4.0fmA\n", batteryVoltage, batteryCurrent); @@ -1019,9 +1018,17 @@ int main(int argc, char * argv[]) { else fprintf(fp,"\n"); } - else - fprintf(fp, "\n"); // don't show voltage and current if it isn't a sensor value + else { + // fprintf(fp, "\n"); // don't show voltage and current if it isn't a sensor value + fprintf(fp, "BAT %.2fV %.0fmA", voltage[map[BAT]], current[map[BAT]]; // display simulated voltage and current + if (c2cStatus != DISABLED) + fprintf(fp," C"); + if (sim_mode || (failureMode != FAIL_NONE)) + fprintf(fp," S\n"); + else + fprintf(fp,"\n"); + } fclose(fp); } else printf("Error writing to telem_string.txt\n");