-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heartbeat Refactor #1325
Heartbeat Refactor #1325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall a huge improvement over the configuration blocks we had earlier - way cleaner. Just some minor notes about the intermediate API layer that we have on every board that wants to use the heartbeat monitor. Other than that lets get this money!
#include "app_canTx.h" | ||
#include "app_canAlerts.h" | ||
|
||
HeartbeatMonitorBoard vc_hbmonitor = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This should probably be named something more consistent with the naming scheme on the rest of the codebase (VC_heartbeat_monitor
or VC_hb_monitor
?)
|
||
void app_heartbeatMonitor_checkIn(void) | ||
{ | ||
app_canTx_BMS_Heartbeat_set(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can pass the heartbeat setter function to HeartbeatMonitorBoard
, so that the hb monitor library can handle this step - then we can expose a method like app_heartbeatMonitorBoard_tick
rather than app_heartbeatMonitorBoard_checkIn
...
I'm just thinking that for the next dev using the heartbeat monitor, it seems like a reasonable mistake to forget to broadcast the heartbeat manually.
|
||
void app_heartbeatMonitor_broadcastFaults(void) | ||
{ | ||
if (block_faults) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fault blocking can also be set as a flag in the HeartbeatMonitorBoard
struct if we want the end developer to use a flag to disable faults rather than manually checking it.
} | ||
|
||
#ifdef TARGET_TEST | ||
void app_heartbeatMonitor_clearFaults(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this target check in the heartbeat monitor library?
{ | ||
block_faults = block; | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can move a lot of the logic in this intermediate heartbeat layer to the heartbeat monitor library, that way the only thing left here will be configuration. Should help the next dev when they need to port a board (this looks like a site for a lot of potential mistakes).
@@ -0,0 +1,84 @@ | |||
#include "app_heartbeatMonitor.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same notes from BMS apply here - I think we can move any remaining logic in this file and move it to the heartbeat monitor library, making this just a configuration file.
|
||
static bool block_faults = false; | ||
|
||
void app_heartbeatMonitor_init(bool block_faults_init) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The init wrapper here is nice though - we should keep this method here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits - Commented on the BMS implementation but I think most of the comments apply across all boards, ping me when you want another review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changelist
firmware/shared/src/app/app_heartbeatMonitorBoard.h
)Testing Done
Resolved Tickets