diff --git a/doc/architecture/uml/LogicalView/Service.plantuml b/doc/architecture/uml/LogicalView/Service.plantuml index d2528ec8..6982642d 100644 --- a/doc/architecture/uml/LogicalView/Service.plantuml +++ b/doc/architecture/uml/LogicalView/Service.plantuml @@ -36,7 +36,7 @@ package "Service" as serviceLayer { on the track. end note - class MovAvg < T, length > <> + class MovAvg < T, U, length > <> note top of MovAvg Moving average filter which can be diff --git a/lib/APPConvoyFollower/src/App.h b/lib/APPConvoyFollower/src/App.h index 9b9ca35f..9bad6259 100644 --- a/lib/APPConvoyFollower/src/App.h +++ b/lib/APPConvoyFollower/src/App.h @@ -171,7 +171,7 @@ class App /** * Moving average filter for proximity sensors. */ - MovAvg m_movAvgProximitySensor; + MovAvg m_movAvgProximitySensor; /** * Report the current vehicle data. diff --git a/lib/APPConvoyLeader/src/App.h b/lib/APPConvoyLeader/src/App.h index a3568197..b78ba2f3 100644 --- a/lib/APPConvoyLeader/src/App.h +++ b/lib/APPConvoyLeader/src/App.h @@ -172,7 +172,7 @@ class App /** * Moving average filter for proximity sensors. */ - MovAvg m_movAvgProximitySensor; + MovAvg m_movAvgProximitySensor; /** * Report the current vehicle data. diff --git a/lib/APPConvoyLeader/src/DrivingState.h b/lib/APPConvoyLeader/src/DrivingState.h index daf4d09d..6b5423e0 100644 --- a/lib/APPConvoyLeader/src/DrivingState.h +++ b/lib/APPConvoyLeader/src/DrivingState.h @@ -141,7 +141,7 @@ class DrivingState : public IState LineStatus m_lineStatus; /**< Status of start-/end line detection */ TrackStatus m_trackStatus; /**< Status of track which means on track or track lost, etc. */ uint8_t m_startEndLineDebounce; /**< Counter used for easys debouncing of the start-/end line detection. */ - MovAvg m_posMovAvg; /**< The moving average of the position over 2 calling cycles. */ + MovAvg m_posMovAvg; /**< The moving average of the position over 2 calling cycles. */ /** * Default constructor. diff --git a/lib/APPRemoteControl/src/App.h b/lib/APPRemoteControl/src/App.h index 9f9f21c2..eab2e93e 100644 --- a/lib/APPRemoteControl/src/App.h +++ b/lib/APPRemoteControl/src/App.h @@ -171,7 +171,7 @@ class App /** * Moving average filter for proximity sensors. */ - MovAvg m_movAvgProximitySensor; + MovAvg m_movAvgProximitySensor; /** * Report the current vehicle data. diff --git a/lib/Service/src/MovAvg.hpp b/lib/Service/src/MovAvg.hpp index 1d9f7313..e68fce1c 100644 --- a/lib/Service/src/MovAvg.hpp +++ b/lib/Service/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.