diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 720fed51..37cafc54 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -4433,6 +4433,7 @@ cmdVSSratio6 = "E\x99\x06" indicator = { resetLockOn }, "Reset Lock OFF","Reset Lock ON", red, black, green, black indicator = { bootloaderCaps > 0 }, "Std. Boot", "Custom Boot", white, black, white, black indicator = { nitrousOn }, "Nitrous Off", "Nitrous On", white, black, red, black + indicator = { IOError }, "I/O Ok", "I/O Error!", white, black, red, black ;Engine Protection status indicators indicator = { engineProtectStatus}, "Engine Protect OFF", "Engine Protect ON", white, black, red, black indicator = { engineProtectRPM }, "Rev Limiter Off", "Rev Limiter ON", white, black, red, black @@ -4557,7 +4558,8 @@ cmdVSSratio6 = "E\x99\x06" engineProtectMAP = bits, U08, 84, [1:1] engineProtectOil = bits, U08, 84, [2:2] engineProtectAFR = bits, U08, 84, [3:3] - engineProtectOth = bits, U08, 84, [4:7] ; Unused for now + engineProtectOth = bits, U08, 84, [4:6] ; Unused for now + IOError = bits, U08, 84, [7:7] unused1 = scalar, U08, 84, "ADC",1.000, 0.000 fuelLoad = scalar, S16, 85, { bitStringValue( algorithmUnits , algorithm ) }, 1.000, 0.000 ignLoad = scalar, S16, 87, { bitStringValue( algorithmUnits , ignAlgorithm ) }, 1.000, 0.000 diff --git a/speeduino/globals.h b/speeduino/globals.h index 4b06f705..caed2535 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -241,6 +241,7 @@ #define PROTECT_CUT_IGN 1 #define PROTECT_CUT_FUEL 2 #define PROTECT_CUT_BOTH 3 +#define PROTECT_IO_ERROR 7 #define AE_MODE_TPS 0 #define AE_MODE_MAP 1 @@ -495,8 +496,8 @@ extern volatile byte LOOP_TIMER; #define pinIsInjector(pin) ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) || ((pin) == pinInjector5) || ((pin) == pinInjector6) || ((pin) == pinInjector7) || ((pin) == pinInjector8) ) #define pinIsIgnition(pin) ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) || ((pin) == pinCoil5) || ((pin) == pinCoil6) || ((pin) == pinCoil7) || ((pin) == pinCoil8) ) #define pinIsSensor(pin) ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) ) -#define pinIsUsed(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || pinIsSensor((pin)) ) #define pinIsOutput(pin) ( ((pin) == pinFuelPump) || ((pin) == pinFan) || ((pin) == pinVVT_1) || ((pin) == pinVVT_2) || ((pin) == pinBoost) || ((pin) == pinIdle1) || ((pin) == pinIdle2) || ((pin) == pinTachOut) ) +#define pinIsUsed(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || pinIsSensor((pin)) || pinIsOutput((pin)) ) //The status struct contains the current values for all 'live' variables //In current version this is 64 bytes diff --git a/speeduino/init.ino b/speeduino/init.ino index f5e811ce..0e0e375f 100644 --- a/speeduino/init.ino +++ b/speeduino/init.ino @@ -265,6 +265,7 @@ void initialiseAll() initialiseFan(); initialiseAuxPWM(); initialiseCorrections(); + BIT_CLEAR(currentStatus.engineProtectStatus, PROTECT_IO_ERROR); //Clear the I/O error bit. The bit will be set in initialiseADC() if there is problem in there. initialiseADC(); initialiseProgrammableIO(); diff --git a/speeduino/sensors.ino b/speeduino/sensors.ino index 01dd3515..417b2dda 100644 --- a/speeduino/sensors.ino +++ b/speeduino/sensors.ino @@ -76,7 +76,7 @@ void initialiseADC() if( pinIsUsed(pinNumber) ) { //Do nothing here as the pin is already in use. - //Need some method of reporting this back to the user + BIT_SET(currentStatus.engineProtectStatus, PROTECT_IO_ERROR); //Tell user that there is problem by lighting up the I/O error indicator } else { @@ -94,7 +94,7 @@ void initialiseADC() if( pinIsUsed(pinNumber) ) { //Do nothing here as the pin is already in use. - //Need some method of reporting this back to the user + BIT_SET(currentStatus.engineProtectStatus, PROTECT_IO_ERROR); //Tell user that there is problem by lighting up the I/O error indicator } else {