GCC Code Coverage Report


Directory: components/
File: main_control_knob/src/main_control_knob.c
Date: 2025-10-25 23:12:34
Coverage Exec Excl Total
Lines: 100.0% 12 0 12
Functions: 100.0% 1 0 1
Branches: 100.0% 8 0 8

Line Branch Exec Source
1 /**
2 * @file
3 * @brief Implementation of the main control knob module
4 */
5
6 #include "main_control_knob.h"
7 #include "rte.h"
8
9 #define CONTROL_KEY_UP KEY_UP
10 #define CONTROL_KEY_DOWN KEY_DOWN
11 #define KNOB_UPDATE_INCREMENT 2u
12
13 /**
14 * ```{impl} Main Control Knob's main function
15 * :id: SWIMPL_MCK-001
16 * :implements: SWDD_MCK-100, SWDD_MCK-101, SWDD_MCK-200, SWDD_MCK-201, SWDD_MCK-202, SWDD_MCK-203
17 * ```
18 */
19 24 void mainControlKnob(void)
20 {
21 24 percentage_t currentValue = RteGetMainKnobValue();
22
2/2
✓ Branch 4 → 5 taken 16 times.
✓ Branch 4 → 8 taken 8 times.
24 if (RteIsKeyPressed(CONTROL_KEY_UP))
23 {
24 // Increase knob's percentage value by 5 with a maximum of 100.
25
2/2
✓ Branch 5 → 6 taken 12 times.
✓ Branch 5 → 7 taken 4 times.
16 if (currentValue < (100 - KNOB_UPDATE_INCREMENT))
26 {
27 12 currentValue += KNOB_UPDATE_INCREMENT;
28 }
29 else
30 {
31 4 currentValue = 100;
32 }
33 }
34
2/2
✓ Branch 9 → 10 taken 6 times.
✓ Branch 9 → 13 taken 2 times.
8 else if (RteIsKeyPressed(CONTROL_KEY_DOWN))
35 {
36 // Decrease knob's percentage value by 5 with a minimum of 0.
37
2/2
✓ Branch 10 → 11 taken 2 times.
✓ Branch 10 → 12 taken 4 times.
6 if (currentValue > KNOB_UPDATE_INCREMENT)
38 {
39 2 currentValue -= KNOB_UPDATE_INCREMENT;
40 }
41 else
42 {
43 4 currentValue = 0;
44 }
45 }
46 24 RteSetMainKnobValue(currentValue);
47 24 }
48