Speeduino
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
vvtController.cpp File Reference
#include "vvtController.h"
#include "../../../globals.h"
#include "../../../elapsed_time.h"
#include "../../../maths.h"
#include "../../PID/integerPID.h"
#include "../../PID/integerPID_ideal.h"
#include "../../../decoders.h"
#include "../../../timers.h"
#include "../../../preprocessor.h"
#include "../../../units.h"
#include "../../../atomic.h"
#include "../../pins/fastInputPin.h"
#include "../../pins/boardOutputPin.h"
#include "../../../scheduler_fuel_controller.h"
#include "VvtOutputChannel.h"

Enumerations

enum class  NextInterruptEvent : uint8_t {
  None = 0 , VVT1Off = 1 << 0 , VVT1On = 1 << 1 , VVT2Off = 1 << 2 ,
  VVT2On = 1 << 3 , BothOff = VVT1Off | VVT2Off , BothOn = VVT1On | VVT2On
}
 

Functions

NextInterruptEvent operator| (NextInterruptEvent lhs, NextInterruptEvent rhs)
 
NextInterruptEvent operator& (NextInterruptEvent lhs, NextInterruptEvent rhs)
 
static void setVvtPidTunings (integerPID &pid, const config10 &page10, bool isReverse)
 
static void initialiseVvtPid (integerPID &pid, const config10 &page10, bool isReverse, int16_t currentAngle)
 
void initialiseVvtWmi (statuses &current, const pinNumbers_t &pins, const config4 &page4, const config6 &page6, config10 &page10)
 Initialise the VVT & WMI controllers.
 
static uint16_t getVvtLoad (const statuses &current, const config6 &page6)
 
static void updateVvtDutyOl (vvtStatus_t &vvtStatus, const statuses &current, const config6 &page6, const table3d8RpmLoad &lookupTable)
 
static void updateVvtDutyOnOff (vvtStatus_t &vvtStatus, const statuses &current, const config6 &page6, const table3d8RpmLoad &lookupTable)
 
static void updateVvtDutyCl (vvtStatus_t &vvtStatus, integerPID &pid, const statuses &current, const config6 &page6, const config10 &page10, const table3d8RpmLoad &lookupTable)
 
static void updateVvtDuty (vvtStatus_t &vvtStatus, integerPID &pid, const statuses &current, const config6 &page6, const config10 &page10, const table3d8RpmLoad &lookupTable)
 
static void setTimerState (void) noexcept
 
static bool isVvtActive (const statuses &current, const config4 &page4, const config6 &page6)
 
void vvtControl (statuses &current, const config4 &page4, const config6 &page6, config10 &page10)
 VVT control. Should be called from the main loop.
 
static bool isWmiTankEmpty (const config10 &page10)
 
static bool isWmiActive (const statuses &current, const config10 &page10)
 
static uint8_t calculateWmiPw (const statuses &current, const config10 &page10)
 
void wmiControl (statuses &current, const config10 &page10)
 WMI control. Should be called from the main loop.
 
static void setVvtTimerCompare (uint16_t offset)
 
static bool isVvtOff (const VvtOutputChannel &channel)
 
static NextInterruptEvent overrideNextEvent (NextInterruptEvent next, const VvtOutputChannel &channel1, const VvtOutputChannel &channel2) noexcept
 
static void applyEventToChannel (VvtOutputChannel &channel, NextInterruptEvent event, NextInterruptEvent onEvent, NextInterruptEvent offEvent) noexcept
 
static NextInterruptEvent calculateNextInterruptSingleOff (const VvtOutputChannel &primary, NextInterruptEvent primaryOff, const VvtOutputChannel &other, uint16_t &offset) noexcept
 
static NextInterruptEvent calculateNextInterrupt (NextInterruptEvent currentEvent, const VvtOutputChannel &channel1, const VvtOutputChannel &channel2, uint16_t &offset) noexcept
 
void vvtInterrupt (void)
 VVT timer callback for PWM control.
 

Variables

TESTABLE_STATIC VvtOutputChannel vvtChannel1
 
TESTABLE_STATIC VvtOutputChannel vvtChannel2
 
TESTABLE_STATIC NextInterruptEvent nextVVT
 
TESTABLE_STATIC uint32_t vvtWarmStartTime
 
TESTABLE_STATIC inputPin_t wmiTankEmptyPin
 
TESTABLE_STATIC outputPin_t wmiIsEnabledPin
 
static integerPID vvtPID
 
static integerPID vvt2PID
 

Enumeration Type Documentation

◆ NextInterruptEvent

enum class NextInterruptEvent : uint8_t
strong
Enumerator
None 
VVT1Off 
VVT1On 
VVT2Off 
VVT2On 
BothOff 
BothOn 

Function Documentation

◆ applyEventToChannel()

static void applyEventToChannel ( VvtOutputChannel channel,
NextInterruptEvent  event,
NextInterruptEvent  onEvent,
NextInterruptEvent  offEvent 
)
staticnoexcept

◆ calculateNextInterrupt()

static NextInterruptEvent calculateNextInterrupt ( NextInterruptEvent  currentEvent,
const VvtOutputChannel channel1,
const VvtOutputChannel channel2,
uint16_t &  offset 
)
staticnoexcept

◆ calculateNextInterruptSingleOff()

static NextInterruptEvent calculateNextInterruptSingleOff ( const VvtOutputChannel primary,
NextInterruptEvent  primaryOff,
const VvtOutputChannel other,
uint16_t &  offset 
)
staticnoexcept

◆ calculateWmiPw()

static uint8_t calculateWmiPw ( const statuses current,
const config10 page10 
)
static

◆ getVvtLoad()

static uint16_t getVvtLoad ( const statuses current,
const config6 page6 
)
static

◆ initialiseVvtPid()

static void initialiseVvtPid ( integerPID pid,
const config10 page10,
bool  isReverse,
int16_t  currentAngle 
)
static

◆ initialiseVvtWmi()

void initialiseVvtWmi ( statuses current,
const pinNumbers_t pins,
const config4 page4,
const config6 page6,
config10 page10 
)

Initialise the VVT & WMI controllers.

◆ isVvtActive()

static bool isVvtActive ( const statuses current,
const config4 page4,
const config6 page6 
)
static

◆ isVvtOff()

static bool isVvtOff ( const VvtOutputChannel channel)
static

◆ isWmiActive()

static bool isWmiActive ( const statuses current,
const config10 page10 
)
static

◆ isWmiTankEmpty()

static bool isWmiTankEmpty ( const config10 page10)
static

◆ operator&()

NextInterruptEvent operator& ( NextInterruptEvent  lhs,
NextInterruptEvent  rhs 
)
inline

◆ operator|()

NextInterruptEvent operator| ( NextInterruptEvent  lhs,
NextInterruptEvent  rhs 
)
inline

◆ overrideNextEvent()

static NextInterruptEvent overrideNextEvent ( NextInterruptEvent  next,
const VvtOutputChannel channel1,
const VvtOutputChannel channel2 
)
staticnoexcept

◆ setTimerState()

static void setTimerState ( void  )
staticnoexcept

◆ setVvtPidTunings()

static void setVvtPidTunings ( integerPID pid,
const config10 page10,
bool  isReverse 
)
static

◆ setVvtTimerCompare()

static void setVvtTimerCompare ( uint16_t  offset)
static

◆ updateVvtDuty()

static void updateVvtDuty ( vvtStatus_t vvtStatus,
integerPID pid,
const statuses current,
const config6 page6,
const config10 page10,
const table3d8RpmLoad &  lookupTable 
)
static

◆ updateVvtDutyCl()

static void updateVvtDutyCl ( vvtStatus_t vvtStatus,
integerPID pid,
const statuses current,
const config6 page6,
const config10 page10,
const table3d8RpmLoad &  lookupTable 
)
static

◆ updateVvtDutyOl()

static void updateVvtDutyOl ( vvtStatus_t vvtStatus,
const statuses current,
const config6 page6,
const table3d8RpmLoad &  lookupTable 
)
static

◆ updateVvtDutyOnOff()

static void updateVvtDutyOnOff ( vvtStatus_t vvtStatus,
const statuses current,
const config6 page6,
const table3d8RpmLoad &  lookupTable 
)
static

◆ vvtControl()

void vvtControl ( statuses current,
const config4 page4,
const config6 page6,
config10 page10 
)

VVT control. Should be called from the main loop.

◆ vvtInterrupt()

void vvtInterrupt ( void  )

VVT timer callback for PWM control.

◆ wmiControl()

void wmiControl ( statuses current,
const config10 page10 
)

WMI control. Should be called from the main loop.

Variable Documentation

◆ nextVVT

◆ vvt2PID

integerPID vvt2PID
static

◆ vvtChannel1

◆ vvtChannel2

◆ vvtPID

integerPID vvtPID
static

◆ vvtWarmStartTime

TESTABLE_STATIC uint32_t vvtWarmStartTime

◆ wmiIsEnabledPin

TESTABLE_STATIC outputPin_t wmiIsEnabledPin

◆ wmiTankEmptyPin

TESTABLE_STATIC inputPin_t wmiTankEmptyPin