fix sensors merge conflicts
This commit is contained in:
parent
90420359f7
commit
efdc1b5162
|
@ -47,6 +47,11 @@ byte cltErrorCount = 0;
|
||||||
* But removes the use of floats and uses 8 bits of fixed precision.
|
* But removes the use of floats and uses 8 bits of fixed precision.
|
||||||
*/
|
*/
|
||||||
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
|
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
|
||||||
|
//These functions all do checks on a pin to determine if it is already in use by another (higher importance) function
|
||||||
|
#define pinIsInjector(pin) ( (pin == pinInjector1) || (pin == pinInjector2) || (pin == pinInjector3) || (pin == pinInjector4) )
|
||||||
|
#define pinIsIgnition(pin) ( (pin == pinCoil1) || (pin == pinCoil2) || (pin == pinCoil3) || (pin == pinCoil4) )
|
||||||
|
#define pinIsSensor(pin) ( (pin == pinCLT) || (pin == pinIAT) || (pin == pinMAP) || (pin == pinTPS) || (pin == pinO2) || (pin == pinBat) )
|
||||||
|
#define pinIsUsed(pin) ( pinIsInjector(pin) || pinIsIgnition(pin) || pinIsSensor(pin) )
|
||||||
|
|
||||||
static inline void instanteneousMAPReading() __attribute__((always_inline));
|
static inline void instanteneousMAPReading() __attribute__((always_inline));
|
||||||
static inline void readMAP() __attribute__((always_inline));
|
static inline void readMAP() __attribute__((always_inline));
|
||||||
|
|
|
@ -67,19 +67,37 @@ void initialiseADC()
|
||||||
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 1 && configPage9.intcan_available == 0 )) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 2)
|
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 1 && configPage9.intcan_available == 0 )) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 2)
|
||||||
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 2)))
|
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 2)))
|
||||||
{ //if current input channel is enabled as analog local pin check caninput_selxb(bits 2:3) with &12 and caninput_selxa(bits 0:1) with &3
|
{ //if current input channel is enabled as analog local pin check caninput_selxb(bits 2:3) with &12 and caninput_selxa(bits 0:1) with &3
|
||||||
//Channel is active and analog
|
byte pinNumber = (configPage9.Auxinpina[currentStatus.current_caninchannel]&127);
|
||||||
pinMode( (configPage9.Auxinpina[currentStatus.current_caninchannel]&127), INPUT);
|
if( pinIsUsed(pinNumber) )
|
||||||
//currentStatus.canin[14] = 33; Dev test use only!
|
{
|
||||||
auxIsEnabled = true;
|
//Do nothing here as the pin is already in use.
|
||||||
|
//Need some method of reporting this back to the user
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Channel is active and analog
|
||||||
|
pinMode( pinNumber, INPUT);
|
||||||
|
//currentStatus.canin[14] = 33; Dev test use only!
|
||||||
|
auxIsEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((((configPage9.enable_secondarySerial == 1) || ((configPage9.enable_intcan == 1) && (configPage9.intcan_available == 1))) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&12) == 12)
|
else if ((((configPage9.enable_secondarySerial == 1) || ((configPage9.enable_intcan == 1) && (configPage9.intcan_available == 1))) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&12) == 12)
|
||||||
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 1 && configPage9.intcan_available == 0 )) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)
|
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 1 && configPage9.intcan_available == 0 )) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)
|
||||||
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)))
|
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)))
|
||||||
{ //if current input channel is enabled as digital local pin check caninput_selxb(bits 2:3) wih &12 and caninput_selxa(bits 0:1) with &3
|
{ //if current input channel is enabled as digital local pin check caninput_selxb(bits 2:3) wih &12 and caninput_selxa(bits 0:1) with &3
|
||||||
//Channel is active and digital
|
byte pinNumber = (configPage9.Auxinpinb[currentStatus.current_caninchannel]&127);
|
||||||
pinMode( (configPage9.Auxinpinb[currentStatus.current_caninchannel]&127), INPUT);
|
if( pinIsUsed(pinNumber) )
|
||||||
//currentStatus.canin[14] = 44; Dev test use only!
|
{
|
||||||
auxIsEnabled = true;
|
//Do nothing here as the pin is already in use.
|
||||||
|
//Need some method of reporting this back to the user
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Channel is active and digital
|
||||||
|
pinMode( pinNumber, INPUT);
|
||||||
|
//currentStatus.canin[14] = 44; Dev test use only!
|
||||||
|
auxIsEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue