From 7e337668aae169407a179fdbef6527b7e2e07d87 Mon Sep 17 00:00:00 2001 From: lm Date: Fri, 11 Feb 2011 19:08:23 +0100 Subject: [PATCH] Working on proper battery status reading --- src/uas/UAS.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index d406a1d45..0ffca054c 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -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) temp = parts.at(2).toFloat(&ok); if (ok) fullVoltage = temp; } + else + { + emit textMessageReceived(0, 0, 0, "Could not set battery options, format is wrong"); + } } } -- 2.22.0