Northeastern-Electric-Racing / Shepherd-BMS

Our from-scratch Battery Management Application
3 stars 0 forks source link

Send CAN messages only when we should be sending them #117

Open Sabramz opened 2 weeks ago

Sabramz commented 2 weeks ago

Description

We currently send CAN messages in sm_handle_state, which is a) not the function of a state machine b) inefficient. We should only be sending a CAN message if a) the data in the message needs to be sent periodically b) there is new data to be sent. Once this issue is complete, we can extend this to adjust the how often we send CAN messages.

Acceptance Criteria

Proposed Solution

This should be done on the branch linked to #108. Go into each individual function where data is collected or transformed and add the function to send the relevant CAN message there. Functions where data is collected or transformed can be found in analyzer.c, and the function to send the message can be found in compute.c. The only call to can_send_msg should be inside of vCanDispatch; all other occurrences of can_send_msg should be replaced with can_queue_msg. Also, use the CHARGING define to send CAN messages on can line 2 when we are charging the car.