Speeduino
|
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 |
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 |
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:
Commands are single byte (letter symbol) commands.
void legacySerialHandler | ( | byte | cmd, |
Stream & | targetPort, | ||
SerialStatus & | targetStatusFlag | ||
) |
Processes an incoming stream of calibration data (for CLT, IAT or O2) from TunerStudio. Result is store in EEPROM and memory.
tableID | - calibration table to process. 0 = Coolant Sensor. 1 = IAT Sensor. 2 = O2 Sensor. |
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.
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.
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
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.
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. |
void sendValues | ( | uint16_t | offset, |
uint16_t | packetLength, | ||
byte | cmd, | ||
Stream & | targetPort, | ||
SerialStatus & | targetStatusFlag, | ||
uint8_t(*)(uint16_t) | logFunction | ||
) |
Is a non-blocking serial receive operation in progress?
Expectation is the serialReceive is called until this returns false.
Is a serial write in progress?
Expectation is that serialTransmit is called until this returns false
|
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
|
extern |
|
extern |
|
extern |
|
extern |
Current status of serial comms.