Browse Source

Working on proper battery status reading

QGC4.4
lm 14 years ago
parent
commit
7e337668aa
  1. 13
      src/uas/UAS.cc

13
src/uas/UAS.cc

@ -1919,7 +1919,14 @@ void UAS::setBatterySpecs(const QString& specs) @@ -1919,7 +1919,14 @@ void UAS::setBatterySpecs(const QString& specs)
QString percent = specs;
percent = percent.remove("%");
float temp = percent.toFloat(&ok);
if (ok) warnLevelPercent = temp;
if (ok)
{
warnLevelPercent = temp;
}
else
{
emit textMessageReceived(0, 0, 0, "Could not set battery options, format is wrong");
}
}
else
{
@ -1942,6 +1949,10 @@ void UAS::setBatterySpecs(const QString& specs) @@ -1942,6 +1949,10 @@ void UAS::setBatterySpecs(const QString& specs)
temp = parts.at(2).toFloat(&ok);
if (ok) fullVoltage = temp;
}
else
{
emit textMessageReceived(0, 0, 0, "Could not set battery options, format is wrong");
}
}
}

Loading…
Cancel
Save