Skip to content

Commit

Permalink
fixed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pranay-o committed Jan 7, 2025
1 parent db20a04 commit 2619f3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions firmware/quintuna/RSM/io/io_coolants.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,28 @@
// below are constants for Steinhart Hart EQN used to model temprature as a function of a resistor for a thermistor
#define BTERM_STEIN_EQN(rtherm) ((float)log((float)(rtherm / R0)) / B_COEFFIECENT)

static const Coolant a(coolantpressure1_3v3);
static const Coolant b(coolantpressure2_3v3);
const Coolant a = {coolantpressure1_3v3};
const Coolant b = {coolantpressure2_3v3};

void io_coolant_init(void)
static PwmInputFreqOnly flow_meter;

void io_coolant_init(const PwmInputFreqOnlyConfig *config)
{
coolant_config.init();
hw_pwmInputFreqOnly_init(&flow_meter, config);
}

void io_coolant_inputCaptureCallback(void)
void io_coolant_inputCaptureCallback(TIM_HandleTypeDef *htim)
{
coolant_config.tick();
if (htim == hw_pwmInputFreqOnly_getTimerHandle(&flow_meter) &&
htim->Channel == hw_pwmInputFreqOnly_getTimerActiveChannel(&flow_meter))
{
hw_pwmInputFreqOnly_tick(&flow_meter);
}
}

float io_coolant_getFlowRate(void)
{
const float freq_read = coolant_config.getFrequency();
const float freq_read = hw_pwmInputFreqOnly_getFrequency(coolant_config);
return freq_read / FLOW_RATE_CONVERSION_FACTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions firmware/quintuna/RSM/io/io_coolants.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ typedef struct
float io_coolant_getPressure(Coolant *coolant);
float io_coolant_getTemperature(Coolant *coolant)

static extern const Coolant a;
static extern const Coolant b;
extern const Coolant a;
extern const Coolant b;

0 comments on commit 2619f3f

Please sign in to comment.