Skip to content

Commit

Permalink
fit all of faults in alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Jan 25, 2025
1 parent cc7d7ff commit 2b7739a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Core/Inc/can_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
#define BETA_STAT_B_CANID 0x6FE
#define BETA_STAT_B_SIZE 8
#define ALPHA_STAT_A_CANID 0x6FC
#define ALPHA_STAT_A_SIZE 7
#define ALPHA_STAT_A_SIZE 8
#define ALPHA_STAT_B_CANID 0x6FF
#define ALPHA_STAT_B_SIZE 7
#define ALPHA_STAT_B_SIZE 8

typedef struct {
uint32_t prev_tick;
Expand Down
4 changes: 3 additions & 1 deletion Core/Inc/can_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ void send_alpha_status_a_message(uint16_t segment_temp, uint8_t chip,
* @param vref2 Second reference voltage for ADBMS6830.
* @param v_analog Analog power supply voltage.
* @param v_digital Digital power supply voltage.
* @param flt_reg The fault register of the chip (statc)
*/
void send_alpha_status_b_message(uint16_t v_res, uint8_t chip, uint16_t vref2,
uint16_t v_analog, uint16_t v_digital);
uint16_t v_analog, uint16_t v_digital,
stc_ *flt_reg);

#endif
12 changes: 7 additions & 5 deletions Core/Src/can_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,6 @@ void send_alpha_status_a_message(uint16_t segment_temp, uint8_t chip,
uint8_t va_uv : 1;
uint8_t vd_ov : 1;
uint8_t vd_uv : 1;
uint8_t otp1_med : 1;
uint8_t otp2_med : 1;
uint8_t vde : 1;
uint8_t vdel : 1;
uint8_t spiflt : 1;
Expand All @@ -596,8 +594,6 @@ void send_alpha_status_a_message(uint16_t segment_temp, uint8_t chip,
alpha_status_a_data.va_uv = flt_reg->va_uv;
alpha_status_a_data.vd_ov = flt_reg->vd_ov;
alpha_status_a_data.vd_uv = flt_reg->vd_uv;
alpha_status_a_data.otp1_med = flt_reg->otp1_med;
alpha_status_a_data.otp2_med = flt_reg->otp2_med;
alpha_status_a_data.vde = flt_reg->vde;
alpha_status_a_data.vdel = flt_reg->vdel;
alpha_status_a_data.spiflt = flt_reg->spiflt;
Expand All @@ -622,7 +618,8 @@ void send_alpha_status_a_message(uint16_t segment_temp, uint8_t chip,
}

void send_alpha_status_b_message(uint16_t v_res, uint8_t chip, uint16_t vref2,
uint16_t v_analog, uint16_t v_digital)
uint16_t v_analog, uint16_t v_digital,
stc_ *flt_reg)
{
endian_swap(&v_res, sizeof(v_res));
endian_swap(&vref2, sizeof(vref2));
Expand All @@ -635,8 +632,13 @@ void send_alpha_status_b_message(uint16_t v_res, uint8_t chip, uint16_t vref2,
uint16_t vref2 : 13;
uint16_t v_analog : 13;
uint16_t v_digital : 13;
uint8_t otp1_med : 1;
uint8_t otp2_med : 1;
} alpha_status_b_data;

alpha_status_b_data.otp1_med = flt_reg->otp1_med;
alpha_status_b_data.otp2_med = flt_reg->otp2_med;

alpha_status_b_data.v_res = v_res;
alpha_status_b_data.chip = chip;
alpha_status_b_data.vref2 = vref2;
Expand Down
3 changes: 2 additions & 1 deletion Core/Src/shep_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ void vDebugMode(void *pv_params)
10000 * getVoltage(bmsdata->chips[chip]
.statb.va),
10000 * getVoltage(bmsdata->chips[chip]
.statb.vd));
.statb.vd),
&bmsdata->chips[chip].statc);
}
}
}
Expand Down

0 comments on commit 2b7739a

Please sign in to comment.