1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

LP-574 Use loop for ADCRouting

This commit is contained in:
Laurent Lalanne 2018-02-06 11:41:30 +01:00
parent bdf66cafd7
commit 773bc084e5

View File

@ -319,23 +319,13 @@ function batteryModuleEnabled() {
} }
function batteryModuleADCConfigured() { function batteryModuleADCConfigured() {
if ((hwSettings.adcRoutingadc0 == HwSettings.ADCRouting.BatteryVoltage) || for (var adc = 0; adc < 8; adc++) {
(hwSettings.adcRoutingadc0 == HwSettings.ADCRouting.BatteryCurrent) || var adc_set = hwSettings.getADCRouting(adc);
(hwSettings.adcRoutingadc1 == HwSettings.ADCRouting.BatteryVoltage) || if (adc_set == HwSettings.ADCRouting.BatteryVoltage) {
(hwSettings.adcRoutingadc1 == HwSettings.ADCRouting.BatteryCurrent) || return true;
(hwSettings.adcRoutingadc2 == HwSettings.ADCRouting.BatteryVoltage) || } else if (adc_set == HwSettings.ADCRouting.BatteryCurrent) {
(hwSettings.adcRoutingadc2 == HwSettings.ADCRouting.BatteryCurrent) || return true;
(hwSettings.adcRoutingadc3 == HwSettings.ADCRouting.BatteryVoltage) || }
(hwSettings.adcRoutingadc3 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc4 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc4 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc5 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc5 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc6 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc6 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc7 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc7 == HwSettings.ADCRouting.BatteryCurrent)) {
return true;
} }
return false; return false;
} }