From 6c20f6d5b82eae7ed6722f2a61efd59020904842 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Mon, 12 May 2014 21:50:02 +1000 Subject: [PATCH] Add free mem gauge and output channel (Disable testing mode) --- comms.ino | 10 +++++----- reference/speeduino 0.1.ini | 7 ++++--- speeduino.ino | 18 ++---------------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/comms.ino b/comms.ino index f490f7aa..34f00894 100644 --- a/comms.ino +++ b/comms.ino @@ -88,7 +88,7 @@ This function returns the current values of a fixed group of variables */ void sendValues(int length) { - byte packetSize = 26; + byte packetSize = 28; byte response[packetSize]; 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) @@ -118,12 +118,12 @@ void sendValues(int length) //Need to split the int loopsPerSecond value into 2 bytes response[24] = highByte(currentStatus.loopsPerSecond); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF); response[25] = lowByte(currentStatus.loopsPerSecond); //(byte)(currentStatus.loopsPerSecond & 0xFF); - /* + //The following can be used to show the amount of free memory int mem = freeRam(); - response[24] = highByte(mem); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF); - response[25] = lowByte(mem); - */ + response[26] = highByte(mem); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF); + response[27] = lowByte(mem); + Serial.write(response, (size_t)packetSize); Serial.flush(); diff --git a/reference/speeduino 0.1.ini b/reference/speeduino 0.1.ini index 64ea315d..3de61a24 100644 --- a/reference/speeduino 0.1.ini +++ b/reference/speeduino 0.1.ini @@ -243,7 +243,6 @@ menu = "&Settings" subMenu = std_constants, "&Constants" - subMenu = std_enrichments, "&Enrichments" menu = "&Tuning" subMenu = std_realtime, "&Realtime Display" @@ -589,7 +588,8 @@ help = helpEnrichments, "Enrichments Help" matGauge = mat, "Manifold Air Temp", "%TEMP", -40, 215, 0, 30, 200, 210, 0, 0 #endif advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0, - loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 20000, -1, 500,1800, 4000, 0, 0 + loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 20000, -1, 500,1800, 4000, 0, 0 + memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0 ;------------------------------------------------------------------------------- @@ -722,7 +722,7 @@ help = helpEnrichments, "Enrichments Help" ochGetCommand = "A" - ochBlockSize = 26 + ochBlockSize = 28 secl = scalar, U08, 0, "sec", 1.000, 0.000 squirt = scalar, U08, 1, "bits", 1.000, 0.000 @@ -757,6 +757,7 @@ help = helpEnrichments, "Enrichments Help" advance = scalar, U08, 22, "deg", 1.000, 0.000 tps = scalar, U08, 23, "%", 1.000, 0.000 loopsPerSecond = scalar, S16, 24, "loops", 1.000, 0.000 + freeRAM = scalar, S16, 26, "bytes", 1.000, 0.000 ; Computed output channels. See "megatuneExamples.ini" for all the ; pre-defined variables, search for "???" and you'll see them. diff --git a/speeduino.ino b/speeduino.ino index 732fe65d..409fef18 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -198,20 +198,6 @@ void loop() } } - /* - Serial.print("RPM: "); - Serial.println(currentStatus.RPM); - - Serial.print("toothLastToothTime: "); - Serial.println(toothLastToothTime); - Serial.print("toothOneMinusOneTime: "); - Serial.println(toothOneMinusOneTime); - Serial.print("RevolutionTime: "); - Serial.println(toothOneTime-toothOneMinusOneTime); - Serial.print("Tooth Number: "); - Serial.println(toothCurrentCount); - */ - //Calculate the RPM based on the uS between the last 2 times tooth One was seen. previousLoopTime = currentLoopTime; currentLoopTime = micros(); @@ -232,10 +218,10 @@ void loop() } //Uncomment the following for testing - + /* currentStatus.hasSync = true; currentStatus.RPM = 5500; - + */ //***SET STATUSES*** //-----------------------------------------------------------------------------------------------------