From 9b7d74e7a2adfe476d1ed8452f850cc12e78e1f5 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Wed, 15 Nov 2023 08:50:13 +0100 Subject: [PATCH] Add error value for string with constexpr --- .../icubmod/embObjMotionControl/embObjMotionControl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp b/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp index 83af066e15..92d00592c6 100644 --- a/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp +++ b/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp @@ -73,6 +73,8 @@ static bool nv_not_found(void) return false; } +static constexpr double const temperatureErrorValue_s = -3500; + @@ -4772,7 +4774,7 @@ bool embObjMotionControl::getTemperatureRaw(int m, double* val) *val = NAN; if(ret) { - if (((double)status.mot_temperature) != -5000) //using -5000 as the default value on 2FOC for initializing the temperature. If cannot read from I2C the value cannot be updated + if (((double)status.mot_temperature) != temperatureErrorValue_s) //using -5000 as the default value on 2FOC for initializing the temperature. If cannot read from I2C the value cannot be updated { //if ((_foc_based_info[m].temperatureSensorType != motor_temperature_sensor_none) && (serviceConfig.ethservice.configuration.type == eomn_serv_MC_foc)) if(_temperatureSensorsVector.at(m) != nullptr)