GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 4 / 0 / 4
Functions: 100.0% 2 / 0 / 2
Branches: -% 0 / 0 / 0
Decisions: -% 0 / - / 0

firmware/controllers/max_limit_with_hysteresis.h
Line Branch Decision Exec Source
1 //
2 // Created by kifir on 8/20/24.
3 //
4
5 #pragma once
6
7 #include "hysteresis.h"
8
9 template <typename RisingChecker = StrictChecker, typename FallingChecker = StrictChecker>
10 class MaxLimitWithHysteresis {
11 public:
12 bool checkIfLimitIsExceeded(const float value, const float maxLimit, const float hysteresis);
13 private:
14 Hysteresis m_hysteresis;
15 };
16
17 template <typename RisingChecker, typename FallingChecker>
18 91143 bool MaxLimitWithHysteresis<RisingChecker, FallingChecker>::checkIfLimitIsExceeded(
19 const float value,
20 const float maxLimit,
21 const float hysteresis
22 ) {
23 91143 return m_hysteresis.test<RisingChecker, FallingChecker>(value, maxLimit, maxLimit - hysteresis);
24 }
25