diff --git a/main.c b/main.c index 1c89e9b3..de207ac0 100644 --- a/main.c +++ b/main.c @@ -90,7 +90,8 @@ int main(int argc, char * argv[]) { if (strcmp(sim_yes, "yes") == 0) { sim_mode = TRUE; - fprintf(stderr, "Sim mode is ON\n"); + fprintf(stderr, "Sim mode is turned ON by configuration\n"); + sim_config = TRUE; } if (strcmp(hab_yes, "yes") == 0) { hab_mode = TRUE; @@ -641,8 +642,13 @@ int main(int argc, char * argv[]) { } if (voltage[map[BAT]] == 0.0) batteryVoltage = 4.5; - else + else { batteryVoltage = voltage[map[BAT]]; + 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]]; } diff --git a/main.h b/main.h index 7e7a8507..2f5b3fe6 100644 --- a/main.h +++ b/main.h @@ -149,6 +149,7 @@ long int newGpsTime; float axis[3], angle[3], volts_max[3], amps_max[3], batt, speed, period, tempS, temp_max, temp_min, eclipse; int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; +int sim_config = FALSE; // sim mode not set by configuration double eclipse_time; float voltage[9], current[9], sensor[SENSOR_FIELDS], other[3];