Update main.c support just BAT2 present

pull/368/head
Alan Johnston 7 months ago committed by GitHub
parent 1afbb83910
commit e28ebc129a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -629,16 +629,24 @@ int main(int argc, char * argv[]) {
token = strtok(NULL, space); token = strtok(NULL, space);
} }
} }
if (voltage[map[BAT]] == 0.0) if (voltage[map[BAT]] == 0.0) // No BAT Board
batteryVoltage = 4.5; 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 { else {
batteryVoltage = voltage[map[BAT]]; batteryVoltage = voltage[map[BAT]]; // BAT Board present
if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode
sim_mode = FALSE; sim_mode = FALSE;
fprintf(stderr, "Turning off sim_mode since battery sensor is present\n"); fprintf(stderr, "Turning off sim_mode since battery sensor is present\n");
} }
} }
batteryCurrent = current[map[BAT]]; batteryCurrent = current[map[BAT]] + current[map[BAT2]]; // Sum BAT and BAT2 currents
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.