From 59afdf38533dab307d0acf4c233e135e1deab911 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 9 Aug 2025 14:30:38 -0400 Subject: [PATCH] Update main.c battery prints --- main.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 443423e0..3e26914b 100644 --- a/main.c +++ b/main.c @@ -299,7 +299,7 @@ int main(int argc, char * argv[]) { map[BAT] = BAT2; map[PLUS_Z] = BAT; map[MINUS_Z] = PLUS_Z; - snprintf(busStr, 10, "%d %d", i2c_bus1, test_i2c_bus(0)); + snprintf(busStr, 10, "Bus test: %d %d", i2c_bus1, test_i2c_bus(0)); voltageThreshold = 8.0; // check for camera @@ -591,7 +591,7 @@ int main(int argc, char * argv[]) { if (token != NULL) { voltage[count1] = (float) atof(token); #ifdef DEBUG_LOGGING -// printf("voltage: %f ", voltage[count1]); + printf("voltage: %f ", voltage[count1]); #endif token = strtok(NULL, space); if (token != NULL) { @@ -605,22 +605,22 @@ int main(int argc, char * argv[]) { } } if (voltage[map[BAT]] == 0.0) // No BAT Board - if (voltage[map[BAT2]] == 0.0) // No BAT2 Board - batteryVoltage = 4.5; - else { - batteryVoltage = voltage[map[BAT2]]; // only BAT2 Board present + if (voltage[map[BAT2]] == 0.0) // No BAT2 Board + batteryVoltage = 4.5; + else { + batteryVoltage = voltage[map[BAT2]]; // only BAT2 Board present + if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode + sim_mode = FALSE; + fprintf(stderr, "Turning off sim_mode since battery sensor 2 is present\n"); + } + } + else { + batteryVoltage = voltage[map[BAT]]; // BAT Board present if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode sim_mode = FALSE; - fprintf(stderr, "Turning off sim_mode since battery sensor 2 is present\n"); + fprintf(stderr, "Turning off sim_mode since battery sensor is present\n"); } } - else { - batteryVoltage = voltage[map[BAT]]; // BAT Board present - if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode - sim_mode = FALSE; - fprintf(stderr, "Turning off sim_mode since battery sensor is present\n"); - } - } batteryCurrent = current[map[BAT]] + current[map[BAT2]]; // Sum BAT and BAT2 currents }