[Pkg-running-devel] [openambit] 105/131: Check valid temperature range Fixes #31

Christian Perrier bubulle at moszumanska.debian.org
Thu Jul 17 20:19:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

bubulle pushed a commit to branch master
in repository openambit.

commit 8257fe0dba4170f30cec81fdffa179366c2baf73
Author: Emil Ljungdahl <emil at kratern.se>
Date:   Mon Apr 21 22:36:04 2014 +0200

    Check valid temperature range
    Fixes #31
---
 src/openambit/movescount/movescountjson.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/openambit/movescount/movescountjson.cpp b/src/openambit/movescount/movescountjson.cpp
index c6450c4..1503dd9 100644
--- a/src/openambit/movescount/movescountjson.cpp
+++ b/src/openambit/movescount/movescountjson.cpp
@@ -263,9 +263,13 @@ int MovesCountJSON::generateLogData(LogEntry *logEntry, QByteArray &output)
     content.insert("Marks", marksContent);
     content.insert("MaxCadence", QVariant::Invalid);
     content.insert("MaxSpeed", (double)logEntry->logEntry->header.speed_max/3600.0);
-    content.insert("MaxTemp", (double)logEntry->logEntry->header.temperature_max/10.0);
+    if (logEntry->logEntry->header.temperature_max >= -1000 && logEntry->logEntry->header.temperature_max <= 1000) {
+        content.insert("MaxTemp", (double)logEntry->logEntry->header.temperature_max/10.0);
+    }
     content.insert("MinHR", logEntry->logEntry->header.heartrate_min);
-    content.insert("MinTemp", (double)logEntry->logEntry->header.temperature_min/10.0);
+    if (logEntry->logEntry->header.temperature_min >= -1000 && logEntry->logEntry->header.temperature_min <= 1000) {
+        content.insert("MinTemp", (double)logEntry->logEntry->header.temperature_min/10.0);
+    }
     content.insert("PeakHR", logEntry->logEntry->header.heartrate_max);
     content.insert("PeakTrainingEffect", (double)logEntry->logEntry->header.peak_training_effect/10.0);
     content.insert("RecoveryTime", (double)logEntry->logEntry->header.recovery_time/1000.0);
@@ -360,7 +364,9 @@ bool MovesCountJSON::writePeriodicSample(ambit_log_sample_t *sample, QVariantMap
             }
             break;
         case ambit_log_sample_periodic_type_temperature:
-            output.insert("Temperature", (double)value->u.temperature/10.0);
+            if (value->u.temperature >= -1000 && value->u.temperature <= 1000) {
+                output.insert("Temperature", (double)value->u.temperature/10.0);
+            }
             break;
         case ambit_log_sample_periodic_type_charge:
             if (value->u.charge <= 100) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/openambit.git



More information about the Pkg-running-devel mailing list