Skip to content

Commit

Permalink
Heartbeat Hotfix (#1426)
Browse files Browse the repository at this point in the history
### Changelist 
<!-- Give a list of the changes covered in this PR. This will help both
you and the reviewer keep this PR within scope. -->

### Testing Done
<!-- Outline the testing that was done to demonstrate the changes are
solid. This could be unit tests, integration tests, testing on the car,
etc. Include relevant code snippets, screenshots, etc as needed. -->

### Resolved Tickets
<!-- Link any tickets that this PR resolves. -->
  • Loading branch information
Lucien950 authored Jan 19, 2025
1 parent e1a903a commit f26130c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions firmware/quadruna/BMS/src/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "app_globals.h"
#include "states/app_initState.h"
#include "app_stateMachine.h"
#include "app_heartbeatMonitors.h"

#include "shared.pb.h"
#include "BMS.pb.h"
Expand Down Expand Up @@ -289,6 +290,7 @@ void tasks_init(void)
app_soc_init();
app_globals_init(&globals_config);
app_stateMachine_init(app_initState_get());
app_heartbeatMonitor_init(&hb_monitor);

// broadcast commit info
app_canTx_BMS_Hash_set(GIT_COMMIT_HASH);
Expand Down
3 changes: 2 additions & 1 deletion firmware/quadruna/CRIT/src/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "shared.pb.h"
#include "CRIT.pb.h"
// app
#include "app_heartbeatMonitor.h"
#include "app_heartbeatMonitors.h"
#include "app_stateMachine.h"
#include "app_mainState.h"
// io
Expand Down Expand Up @@ -386,6 +386,7 @@ void tasks_init(void)
app_canTx_init();
app_canRx_init();

app_heartbeatMonitor_init(&hb_monitor);
app_stateMachine_init(app_mainState_get());

// broadcast commit info
Expand Down
3 changes: 2 additions & 1 deletion firmware/quadruna/RSM/src/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "app_canAlerts.h"
#include "app_commitInfo.h"
#include "app_coolant.h"
#include "app_heartbeatMonitor.h"
#include "app_heartbeatMonitors.h"

#include "io_jsoncan.h"
#include "io_canRx.h"
Expand Down Expand Up @@ -147,6 +147,7 @@ void tasks_init(void)
io_brake_light_init(&brake_light);
app_coolant_init();

app_heartbeatMonitor_init(&hb_monitor);
app_stateMachine_init(app_mainState_get());

app_canTx_RSM_Hash_set(GIT_COMMIT_HASH);
Expand Down
2 changes: 2 additions & 0 deletions firmware/quadruna/VC/src/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "app_canDataCapture.h"
#include "app_commitInfo.h"
#include "app_faultCheck.h"
#include "app_heartbeatMonitors.h"

#include "io_jsoncan.h"
#include "io_log.h"
Expand Down Expand Up @@ -324,6 +325,7 @@ void tasks_init(void)
app_canAlerts_VC_Warning_HighNumberOfCanDataLogs_set(io_canLogging_getCurrentLog() > HIGH_NUMBER_OF_LOGS_THRESHOLD);
app_canAlerts_VC_Warning_CanLoggingSdCardNotPresent_set(!sd_card_present);

app_heartbeatMonitor_init(&hb_monitor);
app_stateMachine_init(app_initState_get());
io_telemMessage_init(&modem);

Expand Down
8 changes: 8 additions & 0 deletions firmware/shared/src/app/app_heartbeatMonitor.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#include "app_heartbeatMonitor.h"

void app_heartbeatMonitor_init(const HeartbeatMonitor *hbm)
{
for (int i = 0; i < hbm->board_count; i++)
{
app_heartbeatBoard_init(&hbm->boards[i]);
}
}

void app_heartbeatMonitor_checkIn(const HeartbeatMonitor *hbm)
{
hbm->own_heartbeat(true);
Expand Down
2 changes: 2 additions & 0 deletions firmware/shared/src/app/app_heartbeatMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ typedef struct
void (*own_heartbeat)(bool);
} HeartbeatMonitor;

void app_heartbeatMonitor_init(const HeartbeatMonitor *hbm);

void app_heartbeatMonitor_checkIn(const HeartbeatMonitor *hbm);

void app_heartbeatMonitor_broadcastFaults(const HeartbeatMonitor *hbm);
Expand Down

0 comments on commit f26130c

Please sign in to comment.