Skip to content

Commit

Permalink
Merge branch 'develop' into 133-adbms-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 authored Jan 25, 2025
2 parents 3dafe3b + 24bfd17 commit 7e75f6a
Show file tree
Hide file tree
Showing 22 changed files with 544 additions and 433 deletions.
19 changes: 3 additions & 16 deletions .github/ISSUE_TEMPLATE/bug-form.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,20 @@ name: Bug
description: For any issue related to a bug
title: '[Area] - Short Description'
labels: [bug]
projects: ["Northeastern-Electric-Racing/20"]
body:
- type: textarea
id: observed-behavior
attributes:
label: Observed Behavior
description: What happened?
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: What should have happened?
description: What happened? What should of happened?
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: How could someone reproduce this bug?
description: How could someone reproduce this bug? Include versions of code or PCBs as applicable.
value: "1. \n2. \n3. "
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots (as needed)
description: Add screenshots of the bug if applicable
validations:
required: false
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
blank_issues_enabled: true
blank_issues_enabled: false
64 changes: 0 additions & 64 deletions .github/ISSUE_TEMPLATE/epic.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/ISSUE_TEMPLATE/feature-request.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/other.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/spike.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/ISSUE_TEMPLATE/task.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: Task
description: Create a task that a developer can complete.
name: Feature
description: Describe a feature that a developer can add.
title: '[Area] - Short Description'
projects: ["Northeastern-Electric-Racing/20"]
body:
- type: textarea
id: description
attributes:
label: Description
description: Provide a brief summary of this issue
description: Provide a brief summary of the current shortcoming or new improvement
validations:
required: true
- type: textarea
id: acceptance-criteria
attributes:
label: Acceptance Criteria
description: What are the conditions that need to be satisified to complete this task?
description: What are the test conditions that need to be satisified to complete this task?
validations:
required: true
- type: textarea
Expand Down
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ It can be helpful to check the `Checks` and `Files changed` tabs.
Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

- [ ] All commits are tagged with the ticket number
- [ ] No merge conflicts
- [ ] All checks passing
- [ ] Remove any non-applicable sections of this template
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ on: [push]
jobs:
run-build:
runs-on: ubuntu-latest
container:
image: ghcr.io/northeastern-electric-racing/embedded-base:main
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
- name: Execute Make
run: |
if ! make; then
if ! docker compose run --rm ner-gcc-arm make -j `nproc`; then
echo "The application has failed to build."
exit 1 # This will cause the workflow to fail
fi
fi
21 changes: 20 additions & 1 deletion Core/Inc/can_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,33 @@
#define NUM_INBOUND_CAN2_IDS 1

#define CHARGE_CANID 0x176
#define CHARGE_SIZE 8
#define DISCHARGE_CANID 0x156
#define DISCHARGE_SIZE 8
#define ACC_STATUS_CANID 0x80
#define ACC_STATUS_SIZE 8
#define BMS_STATUS_CANID 0x81
#define BMS_STATUS_SIZE 4
#define FAULT_STATUS_CANID 0x89
#define FAULT_STATUS_SIZE 8
#define SHUTDOWN_CTRL_CANID 0x82
#define SHUTDOWN_CTRL_SIZE 1
#define CELL_DATA_CANID 0x83
#define CELL_DATA_SIZE 8
#define CELL_VOLTAGE_CANID 0x87
#define CELL_VOLTAGE_SIZE 8
#define CURRENT_CANID 0x86
#define CURRENT_SIZE 6
#define CELL_TEMP_CANID 0x84
#define CELL_TEMP_SIZE 8
#define SEGMENT_TEMP_CANID 0x85
#define FAULT_CANID 0x703
#define SEGMENT_TEMP_SIZE 6
#define FAULT_CANID 0x703 // TODO: cleanup
#define FAULT_SIZE 5
#define NOISE_CANID 0x88
#define NOISE_SIZE 6
#define DEBUG_CANID 0x702

#define ALPHA_CELL_CANID 0x6FA
#define BETA_CELL_CANID 0x6FB
#define CELL_MSG_SIZE 7
Expand Down Expand Up @@ -59,6 +74,10 @@ typedef enum {
RL_MSG_COUNT
} rate_lim_t;

#define DEBUG_SIZE 8
#define FAULT_TIMER_CANID 0x6FF
#define FAULT_TIMER_SIZE 4

void can_receive_callback(CAN_HandleTypeDef *hcan);

/**
Expand Down
11 changes: 11 additions & 0 deletions Core/Inc/compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ void compute_set_fault(int fault_state);
*/
void compute_send_acc_status_message(acc_data_t *bmsdata);

/**
* @brief sends fault status message
*
* @param bms_state
*
*/
void compute_send_fault_status_message(acc_data_t *bmsdata);

/**
* @brief sends BMS status message
*
Expand Down Expand Up @@ -170,6 +178,9 @@ void compute_send_segment_temp_message(acc_data_t *bmsdata);

void compute_send_fault_message(uint8_t status, int16_t curr, int16_t in_dcl);

void compute_send_fault_timer_message(uint8_t start_stop, uint32_t fault_code,
uint16_t data_1);

/**
* @brief Send CAN message for debugging the car on the fly.
*
Expand Down
15 changes: 10 additions & 5 deletions Core/Inc/datastructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ typedef struct {
* to set or get the error codes
*/
// clang-format off
typedef enum {
enum {
FAULTS_CLEAR = 0x0,

/* Orion BMS faults */
/* Shepherd BMS faults */
CELLS_NOT_BALANCING = 0x1,
CELL_VOLTAGE_TOO_HIGH = 0x4,
CELL_VOLTAGE_TOO_LOW = 0x2,
Expand All @@ -64,7 +64,8 @@ typedef enum {
CHARGE_LIMIT_ENFORCEMENT_FAULT = 0x20000,

MAX_FAULTS = 0x80000000 /* Maximum allowable fault code */
} bms_fault_t;
};

// clang-format on

/**
Expand Down Expand Up @@ -93,6 +94,7 @@ typedef struct {
cell_asic chips[NUM_CHIPS];

int fault_status;
int fault_status; // FIXME: this field is unused

int16_t pack_current; /* this value is multiplied by 10 to account for decimal precision */
uint16_t pack_voltage;
Expand All @@ -111,7 +113,9 @@ typedef struct {
/**
* @brief Note that this is a 32 bit integer, so there are 32 max possible fault codes
*/
uint32_t fault_code;
// uint32_t fault_code;
uint32_t fault_code_crit;
uint32_t fault_code_noncrit;

/* Max, min, and avg thermistor readings */
crit_cellval_t max_temp;
Expand Down Expand Up @@ -186,7 +190,8 @@ typedef struct {
int data_2;
int lim_2;

bool is_faulted;
bool is_critical;
// bool is_faulted; /* note: unused field */
} fault_eval_t;

#endif
10 changes: 5 additions & 5 deletions Core/Inc/stateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ bool sm_charging_check(acc_data_t *bmsdata);
* @note Should be bitwise OR'ed with the current fault status
*
* @param accData
* @return uint32_t
* @return uint64_t to be cast to a bms_fault_t
*/
uint32_t sm_fault_return(acc_data_t *accData);
uint64_t sm_fault_return(acc_data_t *accData);

/**
* @brief Used in parellel to faultReturn(), calculates each fault to append the
* fault status
*
* @param index
* @return fault_code
* @param fault_item
* @return fault_status
*/
uint32_t sm_fault_eval(fault_eval_t *index);
bool sm_fault_eval(fault_eval_t *fault_item);

/**
* @brief handles the state machine, calls the appropriate handler function and
Expand Down
Loading

0 comments on commit 7e75f6a

Please sign in to comment.