From 8b3f8511b60588d6ad6872a5413d3bd23ccf1794 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 Jan 2026 15:17:53 -0500 Subject: [PATCH] Update main.c turn off sim mode for payload present --- main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index a69f37cb..22326f7b 100644 --- a/main.c +++ b/main.c @@ -372,8 +372,14 @@ int main(int argc, char * argv[]) { fprintf(stderr,"Serial opened to Pico\n"); // payload = ON; payload = get_payload_serial(FALSE); - fprintf(stderr,"Get_payload_status: %d \n", payload); // not debug - + fprintf(stderr,"Get_payload_status: %d \n", payload); // not debug + + if (sim_mode && payload && !sim_config) { + sim_mode = FALSE; + printf("Turning off Sim Mode since payload is present and Sim Mode not manually configured."); + FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto", "r"); // remove sim_mode_auto flag + pclose(sim_mode_auto); + } } else { fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno)); } @@ -706,10 +712,7 @@ int main(int argc, char * argv[]) { } } batteryCurrent = current[map[BAT]] + current[map[BAT2]]; // Sum BAT and BAT2 currents - } - - if (gps_status == OFF) {