Skip to content

Commit

Permalink
small io_airs fix, bug from Thruna days (#1418)
Browse files Browse the repository at this point in the history
### Changelist 
Small bug fix io_airs.c and io_airs.h, reamining from Thruna hardware
days

### Testing Done
No testing needed

### Resolved Tickets
No tickets
  • Loading branch information
DJ90864 authored Jan 11, 2025
1 parent 3bb1b48 commit 6694f9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
25 changes: 0 additions & 25 deletions firmware/quadruna/BMS/src/io/io_airs.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,3 @@ bool io_airs_isPrechargeClosed(void)
{
return hw_gpio_readPin(&config->precharge_gpio);
}

float io_airs_getLoopCurrent()
{
const float adc_voltage = hw_adc_getVoltage(config->loop_isense_channel);

if (adc_voltage < 0.0f)
{
return NAN;
}

// +-------<0.075>-------+
// | |
// | +---------------+ |
// +--| Current Sense |--+
// | Amplifier |------
// +---------------+
//
// Gain = 20V/V
// ADC Voltage
// Current = -----------------------------
// Sense Resistance * Gain

// return the current corresponding to the ADC voltage
return adc_voltage * AIR_LOOP_SHUNT_RES * AIR_LOOP_GAIN;
}
7 changes: 3 additions & 4 deletions firmware/quadruna/BMS/src/io/io_airs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

typedef struct
{
const Gpio air_p_gpio;
const Gpio air_n_gpio;
const Gpio precharge_gpio;
const AdcChannel *loop_isense_channel;
const Gpio air_p_gpio;
const Gpio air_n_gpio;
const Gpio precharge_gpio;
} AirsConfig;
#else
EMPTY_STRUCT(AirsConfig);
Expand Down

0 comments on commit 6694f9b

Please sign in to comment.