Speeduino
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
comms_legacy.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  SerialStatus {
  SERIAL_INACTIVE , SERIAL_TRANSMIT_INPROGRESS , SERIAL_TRANSMIT_INPROGRESS_LEGACY , SERIAL_TRANSMIT_TOOTH_INPROGRESS ,
  SERIAL_TRANSMIT_TOOTH_INPROGRESS_LEGACY , SERIAL_TRANSMIT_COMPOSITE_INPROGRESS , SERIAL_TRANSMIT_COMPOSITE_INPROGRESS_LEGACY , SERIAL_RECEIVE_INPROGRESS ,
  SERIAL_COMMAND_INPROGRESS_LEGACY
}
 The current state of serial communication. More...
 

Functions

bool serialTransmitInProgress (void)
 Is a serial write in progress?
 
bool serialRecieveInProgress (void)
 Is a non-blocking serial receive operation in progress?
 
void legacySerialCommand (void)
 
void legacySerialHandler (byte cmd, Stream &targetPort, SerialStatus &targetStatusFlag)
 
void sendValues (uint16_t offset, uint16_t packetLength, byte cmd, Stream &targetPort, SerialStatus &targetStatusFlag)
 
void sendValues (uint16_t offset, uint16_t packetLength, byte cmd, Stream &targetPort, SerialStatus &targetStatusFlag, uint8_t(*logFunction)(uint16_t))
 
void sendValuesLegacy (void)
 
void sendPage (void)
 
void sendPageASCII (void)
 
void receiveCalibration (byte tableID)
 
void testComm (void)
 
void sendToothLog_legacy (byte startOffset)
 
void sendCompositeLog_legacy (byte startOffset)
 

Variables

SerialStatus serialStatusFlag
 Current status of serial comms.
 
SerialStatus serialSecondaryStatusFlag
 
bool firstCommsRequest
 
byte logItemsTransmitted
 
byte inProgressLength
 

Enumeration Type Documentation

◆ SerialStatus

The current state of serial communication.

Enumerator
SERIAL_INACTIVE 

No serial comms is in progress

SERIAL_TRANSMIT_INPROGRESS 

A partial write is in progress.

SERIAL_TRANSMIT_INPROGRESS_LEGACY 

A partial write is in progress (legacy send).

SERIAL_TRANSMIT_TOOTH_INPROGRESS 

We are part way through transmitting the tooth log

SERIAL_TRANSMIT_TOOTH_INPROGRESS_LEGACY 

We are part way through transmitting the tooth log (legacy send)

SERIAL_TRANSMIT_COMPOSITE_INPROGRESS 

We are part way through transmitting the composite log

SERIAL_TRANSMIT_COMPOSITE_INPROGRESS_LEGACY 

We are part way through transmitting the composite log (legacy send)

SERIAL_RECEIVE_INPROGRESS 

Whether or not a serial request has only been partially received. This occurs when a the length has been received in the serial buffer, but not all of the payload or CRC has yet been received.

Expectation is that serialReceive is called until the status reverts to SERIAL_INACTIVE

SERIAL_COMMAND_INPROGRESS_LEGACY 

We are part way through processing a legacy serial commang: call serialReceive

Function Documentation

◆ legacySerialCommand()

void legacySerialCommand ( void  )

Processes the incoming data on the serial buffer based on the command sent. Can be either data for a new command or a continuation of data for command that is already in progress:

  • cmdPending = If a command has started but is waiting on further data to complete
  • chunkPending = Specifically for the new receive value method where TS will send a known number of contiguous bytes to be written to a table

Commands are single byte (letter symbol) commands.

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

◆ legacySerialHandler()

void legacySerialHandler ( byte  cmd,
Stream targetPort,
SerialStatus targetStatusFlag 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ receiveCalibration()

void receiveCalibration ( byte  tableID)

Processes an incoming stream of calibration data (for CLT, IAT or O2) from TunerStudio. Result is store in EEPROM and memory.

Parameters
tableID- calibration table to process. 0 = Coolant Sensor. 1 = IAT Sensor. 2 = O2 Sensor.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCompositeLog_legacy()

void sendCompositeLog_legacy ( byte  startOffset)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPage()

void sendPage ( void  )

Pack the data within the current page (As set with the 'P' command) into a buffer and send it.

Creates a page iterator by page_begin() (See: pages.cpp). Sends page given in currentPage.

Note that some translation of the data is required to lay it out in the way Megasquirt / TunerStudio expect it. Data is sent in binary format, as defined by in each page in the speeduino.ini.

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

◆ sendPageASCII()

void sendPageASCII ( void  )

Send page as ASCII for debugging purposes. Similar to sendPage(), however data is sent in human readable format. Sends page given in currentPage.

This is used for testing only (Not used by TunerStudio) in order to see current map and config data without the need for TunerStudio.

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

◆ sendToothLog_legacy()

void sendToothLog_legacy ( byte  startOffset)

Send 256 tooth log entries to primarySerial. if useChar is true, the values are sent as chars to be printed out by a terminal emulator if useChar is false, the values are sent as a 2 byte integer which is readable by TunerStudios tooth logger

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

◆ sendValues() [1/2]

void sendValues ( uint16_t  offset,
uint16_t  packetLength,
byte  cmd,
Stream targetPort,
SerialStatus targetStatusFlag 
)

Send a status record back to tuning/logging SW. This will "live" information from currentStatus struct.

Parameters
offset- Start field number
packetLength- Length of actual message (after possible ack/confirm headers)
cmd- ??? - Will be used as some kind of ack on secondarySerial
targetPort- The HardwareSerial device that will be transmitted to
targetStatusFlag- The status flag that will be set to indicate the status of the transmission
logFunction- The function that should be called to retrieve the log value E.g. tuning sw command 'A' (Send all values) will send data from field number 0, LOG_ENTRY_SIZE fields.
Returns
the current values of a fixed group of variables
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendValues() [2/2]

void sendValues ( uint16_t  offset,
uint16_t  packetLength,
byte  cmd,
Stream targetPort,
SerialStatus targetStatusFlag,
uint8_t(*)(uint16_t logFunction 
)
Here is the call graph for this function:

◆ sendValuesLegacy()

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

◆ serialRecieveInProgress()

bool serialRecieveInProgress ( void  )
inline

Is a non-blocking serial receive operation in progress?

Expectation is the serialReceive is called until this returns false.

Here is the caller graph for this function:

◆ serialTransmitInProgress()

bool serialTransmitInProgress ( void  )
inline

Is a serial write in progress?

Expectation is that serialTransmit is called until this returns false

Here is the caller graph for this function:

◆ testComm()

void testComm ( void  )
Here is the caller graph for this function:

Variable Documentation

◆ firstCommsRequest

bool firstCommsRequest
extern

The number of times the A command has been issued. This is used to track whether a reset has recently been performed on the controller

◆ inProgressLength

byte inProgressLength
extern

◆ logItemsTransmitted

byte logItemsTransmitted
extern

◆ serialSecondaryStatusFlag

SerialStatus serialSecondaryStatusFlag
extern

◆ serialStatusFlag

SerialStatus serialStatusFlag
extern

Current status of serial comms.