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
[ ] CAN messages are only sent when either of the two conditions is met for the data in the message
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.
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.