Skip to content

Commit

Permalink
proper calls
Browse files Browse the repository at this point in the history
  • Loading branch information
dyldonahue committed Mar 25, 2024
1 parent 3e23317 commit f64297e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Core/Src/compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
#include "can_handler.h"
#include "can.h"
#include "main.h"
#include <assert.h>
#include "stm32f405xx.h"
#include <string.h>

#define MAX_CAN1_STORAGE 10
#define MAX_CAN2_STORAGE 10

#define FAN1 TIM_CHANNEL_3
#define FAN2 TIM_CHANNEL_1
#define FAN3 TIM_CHANNEL_4
#define FAN4 TIM_CHANNEL_3
#define FAN5 TIM_CHANNEL_2
#define FAN6 TIM_CHANNEL_1

uint8_t fan_speed;
bool is_charging_enabled;
enum { CHARGE_ENABLED, CHARGE_DISABLED };
Expand Down Expand Up @@ -141,8 +135,8 @@ uint8_t compute_set_fan_speed(TIM_HandleTypeDef* pwmhandle, fan_select_t fan_sel
uint32_t channel = fan_channels[fan_select];

CCR_value = (pwmhandle->Instance->ARR * duty_cycle) / 100;

__HAL_TIM_SET_COMPARE(pwmhandle, channel, CCR_value);

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions Core/Src/stateMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ void sm_handle_state(acc_data_t* bmsdata)
bmsdata->is_charger_connected = compute_charger_connected();
bmsdata->max_temp.val = 75;
bmsdata->fault_code = sm_fault_return(bmsdata);

calculate_pwm(bmsdata);


if (bmsdata->fault_code != FAULTS_CLEAR) {
Expand Down

0 comments on commit f64297e

Please sign in to comment.