Skip to content

Commit

Permalink
fix: cant stop balancing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonidotpy committed Apr 11, 2024
1 parent 07dbd06 commit ec0255e
Show file tree
Hide file tree
Showing 8 changed files with 1,706 additions and 1,705 deletions.
3 changes: 2 additions & 1 deletion cellboard/Core/Src/can_comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ void can_send(uint16_t id) {
conv_state.cellboard_id = cellboard_index;
conv_state.balancing_status = BMS_BOARD_STATUS_BALANCING_STATUS_OFF_CHOICE;

if (fsm_get_state() == STATE_DISCHARGE)
bal_state_t fsm_state = fsm_get_state();
if (fsm_state == STATE_DISCHARGE || fsm_state == STATE_COOLDOWN)
conv_state.balancing_status = BMS_BOARD_STATUS_BALANCING_STATUS_DISCHARGE_CHOICE;
else
conv_state.balancing_status = BMS_BOARD_STATUS_BALANCING_STATUS_OFF_CHOICE;
Expand Down
1 change: 1 addition & 0 deletions cellboard/Core/Src/stm32l4xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */

HAL_UART_Transmit(&huart1, (uint8_t *)"Bug\r\n", 5, 10);
HAL_NVIC_SystemReset();

/* USER CODE END HardFault_IRQn 0 */
Expand Down
4 changes: 2 additions & 2 deletions mainboard/Src/bal.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void bal_update_status(uint8_t cellboard, bool status) {
if (cellboard >= CELLBOARD_COUNT)
return;

bal_status.status &= ~(1 << cellboard);
bal_status.status |= (1 << cellboard) & status;
bal_status.status &= ~(1U << cellboard);
bal_status.status |= (1U << cellboard) * status;
}
void bal_stop(void) {
bal_change_status_request(false, BAL_THRESHOLD_DEFAULT);
Expand Down
2,448 changes: 1,224 additions & 1,224 deletions scripts/binaries/cellboard.srec

Large diffs are not rendered by default.

949 changes: 474 additions & 475 deletions scripts/binaries/fenice-bms.srec

Large diffs are not rendered by default.

0 comments on commit ec0255e

Please sign in to comment.