-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from Northeastern-Electric-Racing/feature/crc…
…-can Crc over CAN, permanent debug can msg
- Loading branch information
Showing
5 changed files
with
199 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,79 @@ | ||
#ifndef BMS_STATES_H | ||
#define BMS_STATES_H | ||
|
||
#include "analyzer.h" | ||
#include "compute.h" | ||
#include "datastructs.h" | ||
#include "segment.h" | ||
#include "compute.h" | ||
#include "analyzer.h" | ||
#include "timer.h" | ||
|
||
/* global that can be read for debugging in main */ | ||
extern BMSState_t current_state; | ||
|
||
/* global defined in segment.c that keeps an eye on the number of crc errors */ | ||
extern uint16_t crc_error_check; | ||
|
||
#define NUM_FAULTS 8 | ||
|
||
/** | ||
* @brief Returns if we want to balance cells during a particular frame | ||
* | ||
* @param bmsdata | ||
* @return true | ||
* @return false | ||
*/ | ||
* @brief Returns if we want to balance cells during a particular frame | ||
* | ||
* @param bmsdata | ||
* @return true | ||
* @return false | ||
*/ | ||
bool sm_balancing_check(acc_data_t *bmsdata); | ||
|
||
/** | ||
* @brief Returns if we want to charge cells during a particular frame | ||
* | ||
* @param bmsdata | ||
* @return true | ||
* @return false | ||
*/ | ||
* @brief Returns if we want to charge cells during a particular frame | ||
* | ||
* @param bmsdata | ||
* @return true | ||
* @return false | ||
*/ | ||
bool sm_charging_check(acc_data_t *bmsdata); | ||
|
||
/** | ||
* @brief Returns any new faults or current faults that have come up | ||
* @note Should be bitwise OR'ed with the current fault status | ||
* | ||
* @param accData | ||
* @return uint32_t | ||
*/ | ||
* @brief Returns any new faults or current faults that have come up | ||
* @note Should be bitwise OR'ed with the current fault status | ||
* | ||
* @param accData | ||
* @return uint32_t | ||
*/ | ||
uint32_t sm_fault_return(acc_data_t *accData); | ||
|
||
/** | ||
* @brief Used in parellel to faultReturn(), calculates each fault to append the fault status | ||
* | ||
* @brief Used in parellel to faultReturn(), calculates each fault to append the | ||
* fault status | ||
* | ||
* @param index | ||
* @return fault_code | ||
*/ | ||
uint32_t sm_fault_eval(fault_eval_t *index); | ||
|
||
/** | ||
* @brief handles the state machine, calls the appropriate handler function and runs every loop functions | ||
* | ||
* @param bmsdata | ||
* @brief handles the state machine, calls the appropriate handler function and | ||
* runs every loop functions | ||
* | ||
* @param bmsdata | ||
*/ | ||
void sm_handle_state(acc_data_t *bmsdata); | ||
|
||
/** | ||
* @brief Algorithm behind determining which cells we want to balance | ||
* @note Directly interfaces with the segments | ||
* | ||
* @param bms_data | ||
*/ | ||
* @brief Algorithm behind determining which cells we want to balance | ||
* @note Directly interfaces with the segments | ||
* | ||
* @param bms_data | ||
*/ | ||
void sm_balance_cells(acc_data_t *bms_data); | ||
void sm_broadcast_current_limit(acc_data_t *bmsdata); | ||
|
||
/** | ||
* @brief algorithm to calculate and set fan speed based on temperature | ||
* | ||
* @param bmsdata | ||
* | ||
*/ | ||
* @param bmsdata | ||
* | ||
*/ | ||
void calculate_pwm(acc_data_t *bmsdata); | ||
|
||
#endif //BMS_STATES_H | ||
#endif // BMS_STATES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.