Skip to content

Commit a0d8d5d

Browse files
committed
fix misra 5.3: check_ignition is intended as check_started and can't be used twice
1 parent ea636de commit a0d8d5d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

board/main.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
// ********************* Serial debugging *********************
3737

38-
bool check_ignition(void) {
38+
bool check_started(void) {
3939
return current_board->check_ignition() || ignition_can;
4040
}
4141

@@ -84,10 +84,10 @@ void started_interrupt_handler(uint8_t interrupt_line) {
8484

8585
#ifdef EON
8686
// set power savings mode here if on EON build
87-
int power_save_state = check_ignition() ? POWER_SAVE_STATUS_DISABLED : POWER_SAVE_STATUS_ENABLED;
87+
int power_save_state = check_started() ? POWER_SAVE_STATUS_DISABLED : POWER_SAVE_STATUS_ENABLED;
8888
set_power_save_state(power_save_state);
8989
// set CDP usb power mode everytime that the car starts to make sure EON is charging
90-
if (check_ignition()) {
90+
if (check_started()) {
9191
current_board->set_usb_power_mode(USB_POWER_CDP);
9292
}
9393
#endif
@@ -609,7 +609,7 @@ void TIM3_IRQHandler(void) {
609609

610610
// check heartbeat counter if we are running EON code. If the heartbeat has been gone for a while, go to NOOUTPUT safety mode.
611611
#ifdef EON
612-
if (heartbeat_counter >= (check_ignition() ? EON_HEARTBEAT_IGNITION_CNT_ON : EON_HEARTBEAT_IGNITION_CNT_OFF)) {
612+
if (heartbeat_counter >= (check_started() ? EON_HEARTBEAT_IGNITION_CNT_ON : EON_HEARTBEAT_IGNITION_CNT_OFF)) {
613613
puts("EON hasn't sent a heartbeat for 0x"); puth(heartbeat_counter); puts(" seconds. Safety is set to NOOUTPUT mode.\n");
614614
if(current_safety_mode != SAFETY_NOOUTPUT){
615615
set_safety_mode(SAFETY_NOOUTPUT, 0U);
@@ -707,7 +707,7 @@ int main(void) {
707707
current_board->set_esp_gps_mode(ESP_GPS_DISABLED);
708708
}
709709
// only enter power save after the first cycle
710-
/*if (check_ignition()) {
710+
/*if (check_started()) {
711711
set_power_save_state(POWER_SAVE_STATUS_ENABLED);
712712
}*/
713713
#endif

0 commit comments

Comments
 (0)