diff --git a/lib/ConvoyFollower/src/DrivingState.h b/lib/ConvoyFollower/src/DrivingState.h index 515c81dd..50960688 100644 --- a/lib/ConvoyFollower/src/DrivingState.h +++ b/lib/ConvoyFollower/src/DrivingState.h @@ -285,7 +285,7 @@ class DrivingState : public IState int32_t m_cumulativeQueueDistance; /** Average distance to the predecessor in mm. */ - MovAvg m_avgIvs; + MovAvg m_avgIvs; /** * Get latest waypoint from the queue, validate it and set it to as the current target. diff --git a/lib/HALTarget/src/Battery.h b/lib/HALTarget/src/Battery.h index 119ac053..d5b16cd3 100644 --- a/lib/HALTarget/src/Battery.h +++ b/lib/HALTarget/src/Battery.h @@ -93,7 +93,7 @@ class Battery : public IBattery static const uint32_t REFERENCE_VOLTAGE = 3300U; /**< Reference voltage of the ADCs in millivolts*/ static const uint32_t CONVERSION_FACTOR = 10000U; /**< Conversion factor from measured to real battery voltage. */ - MovAvg m_voltMovAvg; /**< The moving average of the measured voltage over 2 calling cycles. */ + MovAvg m_voltMovAvg; /**< The moving average of the measured voltage over 2 calling cycles. */ }; /****************************************************************************** diff --git a/lib/Utilities/src/MovAvg.hpp b/lib/Utilities/src/MovAvg.hpp index fada3d00..838b7762 100644 --- a/lib/Utilities/src/MovAvg.hpp +++ b/lib/Utilities/src/MovAvg.hpp @@ -58,9 +58,10 @@ * It is designed for fix point integers. * * @tparam T The data type of the moving average result and input values. + * @tparam U The data type of the moving average sum. Must be able to store the maximum value of T * length. * @tparam length The number of values, which are considered in the moving average calculation. */ -template +template class MovAvg { public: @@ -149,7 +150,7 @@ class MovAvg T m_values[length]; /**< List of values, used for moving average calculation. */ uint8_t m_wrIdx; /**< Write index to list of values */ uint8_t m_written; /**< The number of written values to the list of values, till length is reached. */ - T m_sum; /**< Sum of all values */ + U m_sum; /**< Sum of all values */ /** * Copy construction of an instance.