Speeduino
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
boostController.cpp File Reference
#include "../../pins/boardOutputPin.h"
#include "../../../globals.h"
#include "../../../unit_testing.h"
#include "../../../units.h"
#include "../../PID/integerPID_ideal.h"
#include "../../../timers.h"
#include "../../pwm/PwmOutputChannel.h"
#include "src/pwm/interruptHandlers.h"

Enumerations

enum class  BoostByGearMode : uint8_t { Off , Percent , Constant }
 

Functions

static constexpr uint16_t percentToHalfPct (uint16_t percent)
 
static constexpr uint16_t percentToDuty (uint16_t percent)
 
static void setBoostPidTunings (const config2 &page2, const config6 &page6, const config10 &page10) noexcept
 
void initialiseBoost (statuses &current, const config2 &page2, const config6 &page6, const config10 &page10, const pinNumbers_t &pins)
 Initialise the boost controller.
 
static uint16_t getBoostByGearFactor (const statuses &current, const config9 &page9) noexcept
 
static BoostByGearMode getBoostByGearMode (const config2 &page2, const config9 &page9)
 
static uint16_t lookupBoostTable (const statuses &current) noexcept
 
static uint16_t getBoostDuty (const statuses &current, const config2 &page2, const config9 &page9)
 
static uint16_t getBoostTarget (const statuses &current, const config2 &page2, const config9 &page9)
 
static int16_t getFlexCorrection (const statuses &current, const config2 &page2)
 
static uint16_t convertTargetToDuty (const statuses &current, const config2 &page2, const config6 &page6, const config10 &page10)
 
static void applyDutyToPwm (const statuses &current)
 
static bool isBoostActive (const statuses &current, const config6 &page6)
 
static bool isBoostControlBaroActive (const statuses &current, const config15 &page15)
 
static bool isBoostControlFixedActive (const statuses &current, const config15 &page15)
 
TESTABLE_STATIC void boostControlCore (statuses &current, const config2 &page2, const config4 &page4, const config6 &page6, const config9 &page9, const config10 &page10, const config15 &page15)
 
void boostControl (statuses &current, const config2 &page2, const config4 &page4, const config6 &page6, const config9 &page9, const config10 &page10, const config15 &page15)
 Run the boost control algorithm. Should be called periodically from the main loop.
 
void boostInterrupt (void)
 Boost timer ISR. The board needs to hook this into a timer.
 

Variables

TESTABLE_STATIC PwmOutputChannel< boardOutputPin_t > boostOutput
 
TESTABLE_STATIC integerPID_ideal boostPID
 
TESTABLE_CONSTEXPR table2D_u8_s16_6 flexBoostTable & configPage10
 

Enumeration Type Documentation

◆ BoostByGearMode

enum class BoostByGearMode : uint8_t
strong
Enumerator
Off 
Percent 
Constant 

Function Documentation

◆ applyDutyToPwm()

static void applyDutyToPwm ( const statuses &  current)
static

◆ boostControl()

void boostControl ( statuses &  current,
const config2 &  page2,
const config4 &  page4,
const config6 &  page6,
const config9 &  page9,
const config10 &  page10,
const config15 &  page15 
)

Run the boost control algorithm. Should be called periodically from the main loop.

Parameters
currentSystem state
page2Tune
page4Tune
page6Tune
page9Tune
page10Tune
page15Tune

◆ boostControlCore()

TESTABLE_STATIC void boostControlCore ( statuses &  current,
const config2 &  page2,
const config4 &  page4,
const config6 &  page6,
const config9 &  page9,
const config10 &  page10,
const config15 &  page15 
)

◆ boostInterrupt()

void boostInterrupt ( void  )

Boost timer ISR. The board needs to hook this into a timer.

◆ convertTargetToDuty()

static uint16_t convertTargetToDuty ( const statuses &  current,
const config2 &  page2,
const config6 &  page6,
const config10 &  page10 
)
static

◆ getBoostByGearFactor()

static uint16_t getBoostByGearFactor ( const statuses &  current,
const config9 &  page9 
)
staticnoexcept

◆ getBoostByGearMode()

static BoostByGearMode getBoostByGearMode ( const config2 &  page2,
const config9 &  page9 
)
inlinestatic

◆ getBoostDuty()

static uint16_t getBoostDuty ( const statuses &  current,
const config2 &  page2,
const config9 &  page9 
)
static

◆ getBoostTarget()

static uint16_t getBoostTarget ( const statuses &  current,
const config2 &  page2,
const config9 &  page9 
)
static

◆ getFlexCorrection()

static int16_t getFlexCorrection ( const statuses &  current,
const config2 &  page2 
)
static

◆ initialiseBoost()

void initialiseBoost ( statuses &  current,
const config2 &  page2,
const config6 &  page6,
const config10 &  page10,
const pinNumbers_t &  pins 
)

Initialise the boost controller.

Parameters
currentSystem state
page2Tune
page6Tune
page10Tune
pinsBoard pin numbers

◆ isBoostActive()

static bool isBoostActive ( const statuses &  current,
const config6 &  page6 
)
static

◆ isBoostControlBaroActive()

static bool isBoostControlBaroActive ( const statuses &  current,
const config15 &  page15 
)
inlinestatic

◆ isBoostControlFixedActive()

static bool isBoostControlFixedActive ( const statuses &  current,
const config15 &  page15 
)
inlinestatic

◆ lookupBoostTable()

static uint16_t lookupBoostTable ( const statuses &  current)
inlinestaticnoexcept

◆ percentToDuty()

static constexpr uint16_t percentToDuty ( uint16_t  percent)
staticconstexpr

◆ percentToHalfPct()

static constexpr uint16_t percentToHalfPct ( uint16_t  percent)
staticconstexpr

◆ setBoostPidTunings()

static void setBoostPidTunings ( const config2 &  page2,
const config6 &  page6,
const config10 &  page10 
)
staticnoexcept

Variable Documentation

◆ boostOutput

◆ boostPID

◆ configPage10

TESTABLE_CONSTEXPR table2D_u8_s16_6 flexBoostTable& configPage10
constexpr