Speeduino
Loading...
Searching...
No Matches
Functions | Variables
tsCommandController.cpp File Reference
#include "tsCommandController.h"
#include "../../../sensors.h"
#include "../../../storage.h"
#include "../../../SD_logger.h"
#include "../../../pages.h"
#include "../../../scheduledIO_ign.h"
#include "../../../scheduledIO_inj.h"
#include "../../../scheduler_fuel_controller.h"
#include "../../../scheduler_ignition_controller.h"

Functions

static bool commandRequiresStoppedEngine (uint16_t command)
 
static void injectorOn (const statuses &current, uint8_t injector)
 
static void injectorOff (const statuses &current, uint8_t injector)
 
static void injectorPulse (const statuses &current, uint8_t injector)
 
static uint8_t computeChannel (uint16_t cmd, uint16_t baseCmd2, uint16_t baseCmd1)
 Given 3 command indexes, calculate the channel number.
 
static void coilOn (const statuses &current, uint8_t channel)
 
static void coilOff (const statuses &current, uint8_t channel)
 
static void coilPulse (const statuses &current, uint8_t channel)
 
static void computeVssRatio (statuses &current, config2 &page2, uint8_t ratioIndex)
 
TESTABLE_STATIC uint16_t calcPulsesPerKm (const statuses &current, const config2 &page2, uint32_t(*pGetGap)(byte))
 
bool handleTsCommand (uint16_t command, statuses &current, config2 &page2)
 Process a command from TunerStudio.
 
static uint8_t nextPulseCount (uint8_t current, uint8_t max)
 
static void openPulsedInjectors (void)
 
static void closePulsedInjectors (const config13 &page13)
 
static void beginChargingPulsedCoils (void)
 
static void dischargePulsedCoils (const config13 &page13)
 
void pulsedCommandController (const statuses &current, const config13 &page13)
 Start/stop pulsing injectors & coils based on configuration set by handleTsCommand.
 

Variables

TESTABLE_STATIC uint8_t testInjectorPulseCount = 0
 
TESTABLE_STATIC uint8_t testIgnitionPulseCount = 0
 
TESTABLE_STATIC byte HWTest_INJ_Pulsed
 
TESTABLE_STATIC byte HWTest_IGN_Pulsed
 

Detailed Description

Header file for the TunerStudio command handler The command handler manages all the inputs FROM TS which are issued when a command button is clicked by the user

Function Documentation

◆ beginChargingPulsedCoils()

static void beginChargingPulsedCoils ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcPulsesPerKm()

TESTABLE_STATIC uint16_t calcPulsesPerKm ( const statuses current,
const config2 page2,
uint32_t(*)(byte pGetGap 
)
Here is the caller graph for this function:

◆ closePulsedInjectors()

static void closePulsedInjectors ( const config13 page13)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coilOff()

static void coilOff ( const statuses current,
uint8_t  channel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coilOn()

static void coilOn ( const statuses current,
uint8_t  channel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coilPulse()

static void coilPulse ( const statuses current,
uint8_t  channel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ commandRequiresStoppedEngine()

static bool commandRequiresStoppedEngine ( uint16_t  command)
static
Here is the caller graph for this function:

◆ computeChannel()

static uint8_t computeChannel ( uint16_t  cmd,
uint16_t  baseCmd2,
uint16_t  baseCmd1 
)
static

Given 3 command indexes, calculate the channel number.

Note
THIS ASSUMES THE COMMAND INDICES ARE REGULARLY SPACED.
Parameters
cmdCommand index to convert to channel. E.g. TS_CMD_IGN5_ON
baseCmd2First command index. E.g. TS_CMD_IGN2_ON
baseCmd1First command index. E.g. TS_CMD_IGN1_ON
Returns
uint8_t
Here is the caller graph for this function:

◆ computeVssRatio()

static void computeVssRatio ( statuses current,
config2 page2,
uint8_t  ratioIndex 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dischargePulsedCoils()

static void dischargePulsedCoils ( const config13 page13)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTsCommand()

bool handleTsCommand ( uint16_t  command,
statuses current,
config2 page2 
)

Process a command from TunerStudio.

Parameters
commandThe command number of the button that was clicked. See TS_CommendButtonHandler.h for a list of button IDs
Here is the call graph for this function:
Here is the caller graph for this function:

◆ injectorOff()

static void injectorOff ( const statuses current,
uint8_t  injector 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ injectorOn()

static void injectorOn ( const statuses current,
uint8_t  injector 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ injectorPulse()

static void injectorPulse ( const statuses current,
uint8_t  injector 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextPulseCount()

static uint8_t nextPulseCount ( uint8_t  current,
uint8_t  max 
)
static
Here is the caller graph for this function:

◆ openPulsedInjectors()

static void openPulsedInjectors ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pulsedCommandController()

void pulsedCommandController ( const statuses current,
const config13 page13 
)

Start/stop pulsing injectors & coils based on configuration set by handleTsCommand.

Must be called at least once a millisecond from the main loop

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ HWTest_IGN_Pulsed

TESTABLE_STATIC byte HWTest_IGN_Pulsed

Each bit in this variable represents one of the ignition channels and it's 50% HW test status

◆ HWTest_INJ_Pulsed

TESTABLE_STATIC byte HWTest_INJ_Pulsed

Each bit in this variable represents one of the injector channels and it's 50% HW test status

◆ testIgnitionPulseCount

TESTABLE_STATIC uint8_t testIgnitionPulseCount = 0

◆ testInjectorPulseCount

TESTABLE_STATIC uint8_t testInjectorPulseCount = 0