From 9c8fe3135434eb7c2b08cba913e793218c054b84 Mon Sep 17 00:00:00 2001 From: lsdlsd88 Date: Wed, 7 Feb 2018 19:50:43 +0100 Subject: [PATCH 1/4] fix bins in MX5 NA6 Base Tune fixing temperature bins makes possible to actually use these functions. in the current state these points appear one over each other in Tunerstudio and you can't drag them properly. --- reference/Base Tunes/NA6 PNP base tune.msq | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/Base Tunes/NA6 PNP base tune.msq b/reference/Base Tunes/NA6 PNP base tune.msq index 4cec1979..a01b55ef 100644 --- a/reference/Base Tunes/NA6 PNP base tune.msq +++ b/reference/Base Tunes/NA6 PNP base tune.msq @@ -628,9 +628,9 @@ -40.0 - -40.0 - -40.0 - -40.0 + 0.0 + 40.0 + 80.0 "None" "1" @@ -647,9 +647,9 @@ 0.0 -40.0 - -40.0 - -40.0 - -40.0 + 0.0 + 40.0 + 80.0 From c1ebde3ce53c0106496f3b66eb6f0b0a9d37ca6f Mon Sep 17 00:00:00 2001 From: lsdlsd88 Date: Wed, 7 Feb 2018 19:59:14 +0100 Subject: [PATCH 2/4] fix for NA6 PNP base tune Disabling Launch control from base tune... --- reference/Base Tunes/NA6 PNP base tune.msq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/Base Tunes/NA6 PNP base tune.msq b/reference/Base Tunes/NA6 PNP base tune.msq index 4cec1979..2c372da0 100644 --- a/reference/Base Tunes/NA6 PNP base tune.msq +++ b/reference/Base Tunes/NA6 PNP base tune.msq @@ -546,7 +546,7 @@ 300.0 160.0 "Board Default" -"Yes" +"No" "LOW" 2500.0 -15.0 From 7477ba33228171bc40123dcee1259e2ce342584a Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Mon, 12 Feb 2018 10:45:02 +1100 Subject: [PATCH 3/4] MISRA errors cleanup --- speeduino/decoders.ino | 9 +++------ speeduino/globals.h | 3 --- speeduino/table.ino | 2 +- speeduino/updates.ino | 4 +++- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/speeduino/decoders.ino b/speeduino/decoders.ino index b67a048f..93670e99 100644 --- a/speeduino/decoders.ino +++ b/speeduino/decoders.ino @@ -376,8 +376,6 @@ void triggerSec_DualWheel() if(currentStatus.hasSync == false) { toothLastToothTime = micros(); - //CONFIRM THE BELOW! IT DOESN'T LOOK RIGHT (toothOneTime??) - //toothLastMinusOneToothTime = (toothOneTime - 6000000) / configPage4.triggerTeeth; //Fixes RPM at 10rpm until a full revolution has taken place toothLastMinusOneToothTime = micros() - (6000000 / configPage4.triggerTeeth); //Fixes RPM at 10rpm until a full revolution has taken place toothCurrentCount = configPage4.triggerTeeth; @@ -1027,7 +1025,6 @@ void triggerSetup_24X() MAX_STALL_TIME = (3333UL * triggerToothAngle); //Minimum 50rpm. (3333uS is the time per degree at 50rpm) if(initialisationComplete == false) { toothCurrentCount = 25; toothLastToothTime = micros(); } //Set a startup value here to avoid filter errors when starting. This MUST have the initi check to prevent the fuel pump just staying on all the time - //We set the initial tooth value to be something that should never be reached. This indicates no sync secondDerivEnabled = false; decoderIsSequential = true; } @@ -1087,7 +1084,7 @@ int getCrankAngle_24X(int timePerDegree) interrupts(); int crankAngle; - if (toothCurrentCount == 0) { crankAngle = 0 + configPage4.triggerAngle; } //This is the special case to handle when the 'last tooth' seen was the cam tooth. 0 is the angle at which the crank tooth goes high (Within 360 degrees). + if (tempToothCurrentCount == 0) { crankAngle = 0 + configPage4.triggerAngle; } //This is the special case to handle when the 'last tooth' seen was the cam tooth. 0 is the angle at which the crank tooth goes high (Within 360 degrees). else { crankAngle = toothAngles[(tempToothCurrentCount - 1)] + configPage4.triggerAngle;} //Perform a lookup of the fixed toothAngles array to find what the angle of the last tooth passed was. //Estimate the number of degrees travelled since the last tooth} @@ -1096,7 +1093,7 @@ int getCrankAngle_24X(int timePerDegree) else { crankAngle += ldiv(elapsedTime, timePerDegree).quot; } //Sequential check (simply sets whether we're on the first or 2nd revoltuion of the cycle) - if (tempRevolutionOne) { crankAngle += 360; } + if (tempRevolutionOne == 1) { crankAngle += 360; } if (crankAngle >= 720) { crankAngle -= 720; } if (crankAngle > CRANK_ANGLE_MAX) { crankAngle -= CRANK_ANGLE_MAX; } @@ -1134,7 +1131,7 @@ void triggerSetup_Jeep2000() toothAngles[11] = 474; MAX_STALL_TIME = (3333UL * 60); //Minimum 50rpm. (3333uS is the time per degree at 50rpm). Largest gap between teeth is 60 degrees. - toothCurrentCount = 13; //We set the initial tooth value to be something that should never be reached. This indicates no sync + if(initialisationComplete == false) { toothCurrentCount = 13; toothLastToothTime = micros(); } //Set a startup value here to avoid filter errors when starting. This MUST have the initi check to prevent the fuel pump just staying on all the time secondDerivEnabled = false; decoderIsSequential = false; } diff --git a/speeduino/globals.h b/speeduino/globals.h index 42124ac4..271d8002 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -20,7 +20,6 @@ #define word(h, l) ((h << 8) | l) //word() function not defined for this platform in the main library #if defined (STM32F1) || defined(__STM32F1__) #define BOARD_DIGITAL_GPIO_PINS 34 - #undef BOARD_NR_GPIO_PINS //This is declared as 49 in .../framework-arduinoststm32/STM32F1/variants/generic_stm32f103r8/board/board.h #define BOARD_NR_GPIO_PINS 34 #define LED_BUILTIN 33 #elif defined(ARDUINO_BLACK_F407VE) || defined(STM32F4) @@ -41,8 +40,6 @@ #define portInputRegister(port) (volatile byte *)( &(port->IDR) ) #else //libmaple core aka STM32DUINO //These are defined in STM32F1/variants/generic_stm32f103c/variant.h but return a non byte* value - #undef portOutputRegister - #undef portInputRegister #define portOutputRegister(port) (volatile byte *)( &(port->regs->ODR) ) #define portInputRegister(port) (volatile byte *)( &(port->regs->IDR) ) #endif diff --git a/speeduino/table.ino b/speeduino/table.ino index ce6a5427..ba59a8c2 100644 --- a/speeduino/table.ino +++ b/speeduino/table.ino @@ -64,7 +64,7 @@ int table2D_getValue(struct table2D *fromTable, int X_in) int xMax = 0; //Check whether the X input is the same as last time this ran - if(X_in == fromTable->lastInput && fromTable->cacheTime == currentStatus.secl) + if( (X_in == fromTable->lastInput) && (fromTable->cacheTime == currentStatus.secl) ) { returnValue = fromTable->lastOutput; valueFound = true; diff --git a/speeduino/updates.ino b/speeduino/updates.ino index d8f5d73f..85d9dccd 100644 --- a/speeduino/updates.ino +++ b/speeduino/updates.ino @@ -102,7 +102,9 @@ void doUpdates() for (uint8_t x = 1; x < 6; x++) { uint8_t pct = x * 20; - configPage10.flexBoostBins[x] = configPage10.flexFuelBins[x] = configPage10.flexAdvBins[x] = pct; + configPage10.flexBoostBins[x] = pct; + configPage10.flexFuelBins[x] = pct; + configPage10.flexAdvBins[x] = pct; int16_t boostAdder = (((configPage2.unused2_2 - (int8_t)configPage2.unused2_1) * pct) / 100) + (int8_t)configPage2.unused2_1; configPage10.flexBoostAdj[x] = boostAdder; From f39d425dafd403280504048403b7665dc5e9d2ef Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Mon, 12 Feb 2018 10:45:17 +1100 Subject: [PATCH 4/4] Update MISRA script to traverse all #ifdef paths --- misra/check_misra.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misra/check_misra.sh b/misra/check_misra.sh index 5f1672d0..19ee894e 100755 --- a/misra/check_misra.sh +++ b/misra/check_misra.sh @@ -4,7 +4,7 @@ fi for i in speeduino/speeduino/*.ino; do #cppcheck --xml --include=${i%.*}.h --include=speeduino/speeduino/globals.h $i > /dev/null - cppcheck --dump --suppress=syntaxError:speeduino/speeduino/src/PID_v1/PID_v1.h --include=${i%.*}.h --include=speeduino/speeduino/globals.h $i > /dev/null + cppcheck --force --dump --suppress=syntaxError:speeduino/speeduino/src/PID_v1/PID_v1.h --include=${i%.*}.h --include=speeduino/speeduino/globals.h $i > /dev/null done mv speeduino/speeduino/*.dump ./ rm ./utils.*.dump