Skip to content

Commit fa33038

Browse files
authoredJul 3, 2019
Fix Misra 5.3: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope (#236)
* Fix Misra 5.3
1 parent 8c11470 commit fa33038

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed
 

‎board/main.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ void started_interrupt_init(void) {
9898

9999
int get_health_pkt(void *dat) {
100100
struct __attribute__((packed)) {
101-
uint32_t voltage;
102-
uint32_t current;
103-
uint8_t started;
104-
uint8_t controls_allowed;
105-
uint8_t gas_interceptor_detected;
106-
uint8_t started_signal_detected;
107-
uint8_t started_alt;
101+
uint32_t voltage_pkt;
102+
uint32_t current_pkt;
103+
uint8_t started_pkt;
104+
uint8_t controls_allowed_pkt;
105+
uint8_t gas_interceptor_detected_pkt;
106+
uint8_t started_signal_detected_pkt;
107+
uint8_t started_alt_pkt;
108108
} *health = dat;
109109

110110
//Voltage will be measured in mv. 5000 = 5V
@@ -117,24 +117,24 @@ int get_health_pkt(void *dat) {
117117
// s = 1000/((4095/3.3)*(1/11)) = 8.8623046875
118118

119119
// Avoid needing floating point math
120-
health->voltage = (voltage * 8862) / 1000;
120+
health->voltage_pkt = (voltage * 8862) / 1000;
121121

122-
health->current = adc_get(ADCCHAN_CURRENT);
122+
health->current_pkt = adc_get(ADCCHAN_CURRENT);
123123
int safety_ignition = safety_ignition_hook();
124124
if (safety_ignition < 0) {
125125
//Use the GPIO pin to determine ignition
126-
health->started = is_gpio_started();
126+
health->started_pkt = is_gpio_started();
127127
} else {
128128
//Current safety hooks want to determine ignition (ex: GM)
129-
health->started = safety_ignition;
129+
health->started_pkt = safety_ignition;
130130
}
131131

132-
health->controls_allowed = controls_allowed;
133-
health->gas_interceptor_detected = gas_interceptor_detected;
132+
health->controls_allowed_pkt = controls_allowed;
133+
health->gas_interceptor_detected_pkt = gas_interceptor_detected;
134134

135135
// DEPRECATED
136-
health->started_alt = 0;
137-
health->started_signal_detected = 0;
136+
health->started_alt_pkt = 0;
137+
health->started_signal_detected_pkt = 0;
138138

139139
return sizeof(*health);
140140
}

0 commit comments

Comments
 (0)