Merge pull request #40 from noisymime/pr/39
Merged pull request for #39 Closes #39
This commit is contained in:
commit
de5ceaf4b2
6
comms.h
6
comms.h
|
@ -22,7 +22,9 @@ const char pageTitles[] PROGMEM //This is being stored in the avr flash instead
|
|||
"\nPage 2 Config\0"
|
||||
"\nAir/Fuel Ratio Map\0"
|
||||
"\nPage 3 Config\0"
|
||||
"\nPage 4 Config"//No need to put a trailing null because it's the last string and the compliler does it for you.
|
||||
"\nPage 4 Config\0"
|
||||
"\nBoost Map\0"
|
||||
"\nVVT Map"//No need to put a trailing null because it's the last string and the compliler does it for you.
|
||||
};
|
||||
|
||||
void command();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
|
||||
|
@ -34,4 +36,4 @@ void receiveCalibration(byte tableID);
|
|||
void sendToothLog(bool useChar);
|
||||
void testComm();
|
||||
|
||||
#endif // COMMS_H
|
||||
#endif // COMMS_H
|
||||
|
|
99
comms.ino
99
comms.ino
|
@ -45,7 +45,7 @@ void command()
|
|||
if (currentPage >= '0') {//This converts the ascii number char into binary
|
||||
currentPage -= '0';
|
||||
}
|
||||
if (currentPage == veMapPage || currentPage == ignMapPage || currentPage == afrMapPage) {// Detecting if the current page is a table/map
|
||||
if (currentPage == veMapPage || currentPage == ignMapPage || currentPage == afrMapPage || currentPage == boostvvtPage) {// Detecting if the current page is a table/map
|
||||
isMap = true;
|
||||
}
|
||||
else {
|
||||
|
@ -66,9 +66,9 @@ void command()
|
|||
currentStatus.secl = 0; //This is required in TS3 due to its stricter timings
|
||||
break;
|
||||
|
||||
case 'Q': // send code signature
|
||||
case 'Q': // send code version
|
||||
Serial.print("speeduino 201609-dev");
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'V': // send VE table and constants in binary
|
||||
sendPage(false);
|
||||
|
@ -207,7 +207,7 @@ void sendValues(int length)
|
|||
requestCount++;
|
||||
|
||||
currentStatus.spark ^= (-currentStatus.hasSync ^ currentStatus.spark) & (1 << BIT_SPARK_SYNC); //Set the sync bit of the Spark variable to match the hasSync variable
|
||||
|
||||
|
||||
response[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0)
|
||||
response[1] = currentStatus.squirt; //Squirt Bitfield
|
||||
response[2] = currentStatus.engine; //Engine Status Bitfield
|
||||
|
@ -628,7 +628,12 @@ void sendPage(bool useChar)
|
|||
|
||||
case boostvvtPage:
|
||||
{
|
||||
if(!useChar)
|
||||
if(useChar)
|
||||
{
|
||||
currentTable = boostTable;
|
||||
currentTitleIndex = 121;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Need to perform a translation of the values[MAP/TPS][RPM] into the MS expected format
|
||||
byte response[160]; //Bit hacky, but the size is: (8x8 + 8 + 8) + (8x8 + 8 + 8) = 160
|
||||
|
@ -644,6 +649,7 @@ void sendPage(bool useChar)
|
|||
Serial.write((byte *)&response, sizeof(response));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
@ -656,49 +662,68 @@ void sendPage(bool useChar)
|
|||
{
|
||||
if (useChar)
|
||||
{
|
||||
const char spaceChar = ' ';
|
||||
/*while(pageTitles[currentTitleIndex])
|
||||
do //This is a do while loop that kicks in for the boostvvtPage
|
||||
{
|
||||
Serial.print(pageTitles[currentTitleIndex]);
|
||||
currentTitleIndex++;
|
||||
}*/
|
||||
Serial.println((const __FlashStringHelper *)&pageTitles[currentTitleIndex]);// F macro hack
|
||||
Serial.print(F("\n "));
|
||||
for (int x = 0; x < currentTable.xSize; x++)// Horizontal bins
|
||||
{
|
||||
byte axisX = byte(currentTable.axisX[x] / 100);
|
||||
if (axisX < 100)
|
||||
const char spaceChar = ' ';
|
||||
/*while(pageTitles[currentTitleIndex])
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
if (axisX < 10)
|
||||
Serial.print(pageTitles[currentTitleIndex]);
|
||||
currentTitleIndex++;
|
||||
}*/
|
||||
Serial.println((const __FlashStringHelper *)&pageTitles[currentTitleIndex]);// F macro hack
|
||||
Serial.println();
|
||||
for (int y = 0; y < currentTable.ySize; y++)
|
||||
{
|
||||
byte axisY = byte(currentTable.axisY[y]);
|
||||
if (axisY < 100)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
}
|
||||
Serial.print(axisX);
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
Serial.println();
|
||||
for (int y = 0; y < currentTable.ySize; y++)
|
||||
{
|
||||
Serial.print(byte(currentTable.axisY[y]));// Vertical Bins
|
||||
Serial.write(spaceChar);
|
||||
for (int x = 0; x < currentTable.xSize; x++)
|
||||
{
|
||||
byte value = currentTable.values[y][x];
|
||||
if (value < 100)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
if (value < 10)
|
||||
if (axisY < 10)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
}
|
||||
Serial.print(value);
|
||||
Serial.print(axisY);// Vertical Bins
|
||||
Serial.write(spaceChar);
|
||||
for (int x = 0; x < currentTable.xSize; x++)
|
||||
{
|
||||
byte value = currentTable.values[y][x];
|
||||
if (value < 100)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
if (value < 10)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
}
|
||||
Serial.print(value);
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
Serial.print(F(" "));
|
||||
for (int x = 0; x < currentTable.xSize; x++)// Horizontal bins
|
||||
{
|
||||
byte axisX = byte(currentTable.axisX[x] / 100);
|
||||
if (axisX < 100)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
if (axisX < 10)
|
||||
{
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
}
|
||||
Serial.print(axisX);
|
||||
Serial.write(spaceChar);
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
if(currentTitleIndex == 121) //Check to see if on boostTable
|
||||
{
|
||||
currentTitleIndex = 132; //Change over to vvtTable mid display
|
||||
currentTable = vvtTable;
|
||||
}
|
||||
else currentTitleIndex = 0;
|
||||
}while(currentTitleIndex == 132); //Should never loop unless going to display vvtTable
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue