2015-02-14 05:11:43 -08:00
|
|
|
#ifndef COMMS_H
|
|
|
|
#define COMMS_H
|
2015-10-13 15:49:17 -07:00
|
|
|
//These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages.
|
2015-06-05 00:28:31 -07:00
|
|
|
#define veMapPage 1
|
2015-10-13 15:49:17 -07:00
|
|
|
#define veSetPage 2//Config Page 1
|
2015-06-05 00:28:31 -07:00
|
|
|
#define ignMapPage 3
|
2015-10-13 15:49:17 -07:00
|
|
|
#define ignSetPage 4//Config Page 2
|
2015-06-05 00:28:31 -07:00
|
|
|
#define afrMapPage 5
|
2015-10-13 15:49:17 -07:00
|
|
|
#define afrSetPage 6//Config Page 3
|
|
|
|
#define iacPage 7//Config Page 4
|
2015-09-24 13:24:40 -07:00
|
|
|
#define boostvvtPage 8
|
2016-10-15 03:52:20 -07:00
|
|
|
#define seqFuelPage 9
|
2017-01-26 14:58:21 -08:00
|
|
|
#define canbusPage 10//Config Page 10
|
2013-07-08 21:06:45 -07:00
|
|
|
|
2017-06-19 18:29:55 -07:00
|
|
|
#define packetSize 73
|
2016-12-26 22:03:27 -08:00
|
|
|
|
2015-10-13 15:49:17 -07:00
|
|
|
byte currentPage = 1;//Not the same as the speeduino config page numbers
|
2017-06-02 04:56:21 -07:00
|
|
|
bool isMap = true;
|
2016-08-18 03:10:47 -07:00
|
|
|
unsigned long requestCount = 0; //The number of times the A command has been issued
|
2017-04-22 06:31:13 -07:00
|
|
|
byte currentCommand;
|
|
|
|
bool cmdPending = false;
|
2017-03-15 05:19:08 -07:00
|
|
|
byte cmdGroup = 0;
|
|
|
|
byte cmdValue = 0;
|
|
|
|
int cmdCombined = 0; //the cmdgroup as high byte and cmdvalue as low byte
|
|
|
|
byte cmdStore[8]; //array storing pre test values
|
2017-05-08 15:15:03 -07:00
|
|
|
byte tsCanId = 0; // current tscanid requested
|
2016-08-18 03:10:47 -07:00
|
|
|
|
2015-10-13 15:49:17 -07:00
|
|
|
const char pageTitles[] PROGMEM //This is being stored in the avr flash instead of SRAM which there is not very much of
|
2015-10-10 05:43:45 -07:00
|
|
|
{
|
2015-10-13 15:49:17 -07:00
|
|
|
"\nVolumetric Efficiancy Map\0"//This is an alternative to using a 2D array which would waste space because of the different lengths of the strings
|
|
|
|
"\nPage 1 Config\0"//The configuration page titles' indexes are found by counting the chars
|
|
|
|
"\nIgnition Map\0"//The map page titles' indexes are put into a var called currentTitleIndex. That represents the first char of each string.
|
2015-10-10 05:43:45 -07:00
|
|
|
"\nPage 2 Config\0"
|
|
|
|
"\nAir/Fuel Ratio Map\0"
|
|
|
|
"\nPage 3 Config\0"
|
2016-09-11 16:12:01 -07:00
|
|
|
"\nPage 4 Config\0"
|
|
|
|
"\nBoost Map\0"
|
2017-01-26 14:58:21 -08:00
|
|
|
"\nVVT Map\0"//No need to put a trailing null because it's the last string and the compliler does it for you.
|
|
|
|
"\nPage 10 Config"
|
2015-10-10 05:43:45 -07:00
|
|
|
};
|
2017-02-11 17:31:37 -08:00
|
|
|
|
2015-10-13 15:49:17 -07:00
|
|
|
void command();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
|
2017-06-12 18:58:00 -07:00
|
|
|
void sendValues(uint16_t offset, uint16_t packetlength,byte cmd, byte portnum);
|
2015-06-05 00:28:31 -07:00
|
|
|
void receiveValue(int offset, byte newValue);
|
2013-07-08 17:43:41 -07:00
|
|
|
void saveConfig();
|
2015-10-10 05:43:45 -07:00
|
|
|
void sendPage(bool useChar);
|
2014-10-11 15:44:42 -07:00
|
|
|
void receiveCalibration(byte tableID);
|
|
|
|
void sendToothLog(bool useChar);
|
2013-07-08 17:43:41 -07:00
|
|
|
void testComm();
|
2017-03-15 05:19:08 -07:00
|
|
|
void commandButtons();
|
2015-02-14 05:11:43 -08:00
|
|
|
|
2016-10-15 03:52:20 -07:00
|
|
|
#endif // COMMS_H
|