diff --git a/cancomms.h b/cancomms.h index e254a0f..bf87ed6 100644 --- a/cancomms.h +++ b/cancomms.h @@ -4,14 +4,14 @@ #define veMapPage 1 -uint8_t currentcanPage = 1;//Not the same as the speeduino config page numbers +uint8_t currentCanPage = 1;//Not the same as the speeduino config page numbers uint8_t nCanretry = 0; //no of retrys uint8_t cancmdfail = 0; //command fail yes/no uint8_t canlisten = 0; uint8_t Lbuffer[8]; //8 byte buffer to store incomng can data -void Cancommand();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable. +void canCommand();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable. void sendCancommand(uint8_t cmdtype , uint16_t canadddress, uint8_t candata1, uint8_t candata2); void testCanComm(); diff --git a/cancomms.ino b/cancomms.ino index c3f1cd9..8a840a4 100644 --- a/cancomms.ino +++ b/cancomms.ino @@ -15,7 +15,7 @@ sendcancommand is called when a comman d is to be sent via serial3 to the Can in //#include "globals.h" //#include "storage.h" -void Cancommand() +void canCommand() { switch (Serial3.read()) { diff --git a/globals.h b/globals.h index 4ee3105..b08123a 100644 --- a/globals.h +++ b/globals.h @@ -215,7 +215,7 @@ struct config1 { byte algorithm : 1; //"Speed Density", "Alpha-N" byte baroCorr : 1; byte injLayout : 2; - byte canenable : 1; //is can interface enabled + byte canEnable : 1; //is can interface enabled byte primePulse; byte dutyLim; diff --git a/reference/speeduino.ini b/reference/speeduino.ini index a16d598..7fa9ca4 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -187,7 +187,7 @@ page = 2 algorithm = bits, U08, 38, [2:2], "Speed Density", "Alpha-N" baroCorr = bits, U08, 38, [3:3], "Off", "On" injLayout = bits, U08, 38, [4:5], "Bank", "Semi-Sequential", "INVALID", "INVALID" - canenable = bits, U08, 38, [6:6], "Disable", "Enable" + canEnable = bits, U08, 38, [6:6], "Disable", "Enable" primePulse = scalar, U08, 39, "ms", 0.1, 0.0, 0.0, 25.5, 1 dutyLim = scalar, U08, 40, "%", 1.0, 0.0, 0.0, 100.0, 0 @@ -591,7 +591,7 @@ menuDialog = main subMenu = std_separator subMenu = tacho, "Tacho Output" subMenu = std_separator - subMenu = canio, "Canbus Interface" + subMenu = canIO, "Canbus Interface" @@ -716,8 +716,8 @@ menuDialog = main dialog = tacho, "Tacho" field = "Output pin", tachoPin - dialog = canio, "CanBus interface" - field = "Enable/Disable", canenable + dialog = canIO, "CanBus interface" + field = "Enable/Disable", canEnable dialog = accelEnrichments_center, "" field = "TPSdot Threshold", tpsThresh diff --git a/scheduler.h b/scheduler.h index a7a969d..6ee8828 100644 --- a/scheduler.h +++ b/scheduler.h @@ -126,7 +126,7 @@ static inline unsigned int setQueue(volatile Schedule *queue[], Schedule *schedu //Sort the queues. Both queues are kept in sync. //This implementes a sorting networking based on the Bose-Nelson sorting network //See: http://pages.ripco.net/~jgamble/nw.html - #define SWAP(x,y) if(tmpQueue[y] < tmpQueue[x]) { unsigned int tmp = tmpQueue[x]; tmpQueue[x] = tmpQueue[y]; tmpQueue[y] = tmp; Schedule *tmpS = queue[x]; queue[x] = queue[y]; queue[y] = tmpS; } + #define SWAP(x,y) if(tmpQueue[y] < tmpQueue[x]) { unsigned int tmp = tmpQueue[x]; tmpQueue[x] = tmpQueue[y]; tmpQueue[y] = tmp; volatile Schedule *tmpS = queue[x]; queue[x] = queue[y]; queue[y] = tmpS; } //SWAP(0, 1); //Likely not needed //SWAP(2, 3); //Likely not needed SWAP(0, 2); diff --git a/speeduino.ino b/speeduino.ino index c3f8500..2b72825 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -149,7 +149,8 @@ volatile bool fpPrimed = false; //Tracks whether or not the fuel pump priming ha void setup() { - Serial.begin(115200); + Serial.begin(115200); + if (configPage1.canEnable) { Serial3.begin(115200); } //Setup the dummy fuel and ignition tables //dummyFuelTable(&fuelTable); @@ -161,7 +162,6 @@ void setup() table3D_setSize(&vvtTable, 8); loadConfig(); - if (configPage1.canenable ==1){Serial3.begin(115200);} //Repoint the 2D table structs to the config pages that were just loaded taeTable.valueSize = SIZE_BYTE; //Set this table to use byte values @@ -755,13 +755,13 @@ void loop() } } //if Can interface is enabled then check for serial3 requests. - if (configPage1.canenable == 1) + if (configPage1.canEnable) { if ( ((mainLoopCount & 31) == 1) or (Serial3.available() > SERIAL_BUFFER_THRESHOLD) ) { if (Serial3.available() > 0) { - Cancommand(); + canCommand(); } } }