Speeduino
|
#include "globals.h"
#include "comms.h"
#include "comms_legacy.h"
#include "comms_secondary.h"
#include "storage.h"
#include "maths.h"
#include "utilities.h"
#include "decoders.h"
#include "TS_CommandButtonHandler.h"
#include "pages.h"
#include "page_crc.h"
#include "logger.h"
#include "table3d_axis_io.h"
#include <BOARD_H>
Macros | |
#define | serial_print_space_delimited_array(array) serial_print_space_delimited(array, _end_range_address(array)) |
Variables | |
static byte | currentPage = 1 |
bool | firstCommsRequest = true |
static byte | currentCommand |
static bool | chunkPending = false |
static uint16_t | chunkComplete = 0 |
static uint16_t | chunkSize = 0 |
static int | valueOffset |
byte | logItemsTransmitted |
byte | inProgressLength |
SerialStatus | serialStatusFlag |
Current status of serial comms. | |
SerialStatus | serialSecondaryStatusFlag |
Process Incoming and outgoing serial communications.
#define serial_print_space_delimited_array | ( | array | ) | serial_print_space_delimited(array, _end_range_address(array)) |
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 | ||
) |
|
static |
The number of bytes in a chunk write that have been written so far
|
static |
The complete size of the requested chunk write
|
static |
The serial command that is currently being processed. This is only useful when cmdPending=True
|
static |
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
byte inProgressLength |
byte logItemsTransmitted |
SerialStatus serialSecondaryStatusFlag |
SerialStatus serialStatusFlag |
Current status of serial comms.
|
static |
The memory offset within a given page for a value to be read from or written to. Note that we cannot use 'offset' as a variable name, it is a reserved word for several teensy libraries