From f64297ea3c9c1d305b71fe764e17d8884158af02 Mon Sep 17 00:00:00 2001 From: dyldonahue Date: Mon, 25 Mar 2024 13:07:26 -0400 Subject: [PATCH] proper calls --- Core/Src/compute.c | 10 ++-------- Core/Src/stateMachine.c | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Core/Src/compute.c b/Core/Src/compute.c index d91c88e..3b060c4 100644 --- a/Core/Src/compute.c +++ b/Core/Src/compute.c @@ -2,19 +2,13 @@ #include "can_handler.h" #include "can.h" #include "main.h" +#include #include "stm32f405xx.h" #include #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 }; @@ -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; } diff --git a/Core/Src/stateMachine.c b/Core/Src/stateMachine.c index b547eda..74396db 100644 --- a/Core/Src/stateMachine.c +++ b/Core/Src/stateMachine.c @@ -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) {