GCC Code Coverage Report


Directory: components/
File: rte/src/rte.c
Date: 2025-10-25 23:13:53
Coverage Exec Excl Total
Lines: 58.5% 24 0 41
Functions: 60.0% 9 0 15
Branches: 25.0% 1 0 4

Line Branch Exec Source
1 #include "rte.h"
2 #include "autoconf.h"
3 #include "button_interface.h"
4
5 static PowerState currentPowerState = POWER_STATE_OFF;
6 static boolean powerKeyPressedEvent = FALSE;
7 static RGBColor lightValue = {
8 .red = 0,
9 .green = 0,
10 .blue = 0,
11 };
12 static percentage_t mainKnobValue = 50;
13 static unsigned int brightnessValue = 0;
14
15 #ifdef CONFIG_BRIGHTNESS_ADJUSTMENT_PERIOD
16 static unsigned int brightnessAdjustmentCounter = 0;
17 #endif
18
19 // Flight Controller RTE variables
20 static boolean offCourse = FALSE;
21 static boolean abortCommanded = FALSE;
22 static boolean validAbortCommand = FALSE;
23 static boolean selfDestructState = FALSE;
24
25 1 void RteSetPowerState(PowerState state)
26 {
27 1 currentPowerState = state;
28 1 }
29
30 12 PowerState RteGetPowerState(void)
31 {
32 12 return currentPowerState;
33 }
34
35 10 void RteSetPowerKeyPressedEvent(boolean value)
36 {
37 10 powerKeyPressedEvent = value;
38 10 }
39
40 10 boolean RteGetPowerKeyPressedEvent()
41 {
42 10 return powerKeyPressedEvent;
43 }
44
45 1 void RteSetLightValue(RGBColor value)
46 {
47 1 lightValue = value;
48 1 }
49
50 1 void RteGetLightValue(RGBColor *value)
51 {
52 1 *value = lightValue;
53 1 }
54
55 20 boolean RteIsKeyPressed(KeyCodes key)
56 {
57 20 return ButtonInterfaceIsButtonPressed(key);
58 }
59
60 10 void RteSetMainKnobValue(percentage_t value)
61 {
62
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 10 times.
10 if (value > 100)
63 {
64 mainKnobValue = 100;
65 }
66 else
67 {
68 10 mainKnobValue = value;
69 }
70 10 }
71
72 20 percentage_t RteGetMainKnobValue(void)
73 {
74 20 return mainKnobValue;
75 }
76
77 void RteSetBrightnessValue(brightness_t value)
78 {
79 brightnessValue = value;
80 }
81
82 brightness_t RteGetBrightnessValue(void)
83 {
84 return brightnessValue;
85 }
86
87 #ifdef CONFIG_BRIGHTNESS_ADJUSTMENT_PERIOD
88 void RteSetBrightnessAdjustmentCounter(unsigned int counter)
89 {
90 brightnessAdjustmentCounter = counter;
91 }
92
93 void RteGetBrightnessAdjustmentCounter(unsigned int *counter)
94 {
95 *counter = brightnessAdjustmentCounter;
96 }
97 #endif // CONFIG_BRIGHTNESS_ADJUSTMENT_PERIOD
98
99 void RteGetOffCourse(boolean *value)
100 {
101 if (value != NULL)
102 {
103 *value = offCourse;
104 }
105 }
106
107 boolean RteGetAbortCommanded(void)
108 {
109 return abortCommanded;
110 }
111
112 boolean RteGetValidAbortCommand(void)
113 {
114 return validAbortCommand;
115 }
116
117 void RteSetSelfDestructState(boolean state)
118 {
119 selfDestructState = state;
120 }
121