Improved flex error checking
This commit is contained in:
parent
5847ee5330
commit
a90d13b038
|
@ -262,7 +262,8 @@ void sendValues(int length)
|
||||||
response[31] = lowByte(currentStatus.rpmDOT);
|
response[31] = lowByte(currentStatus.rpmDOT);
|
||||||
response[32] = highByte(currentStatus.rpmDOT);
|
response[32] = highByte(currentStatus.rpmDOT);
|
||||||
|
|
||||||
response[33] = currentStatus.flex;
|
response[33] = currentStatus.flex; //Flex sensor value (or 0 if not used)
|
||||||
|
|
||||||
cli();
|
cli();
|
||||||
Serial.write(response, (size_t)packetSize);
|
Serial.write(response, (size_t)packetSize);
|
||||||
sei();
|
sei();
|
||||||
|
|
|
@ -465,7 +465,7 @@ page = 8
|
||||||
requiresPowerCycle = launchPin
|
requiresPowerCycle = launchPin
|
||||||
requiresPowerCycle = launchEnable
|
requiresPowerCycle = launchEnable
|
||||||
requiresPowerCycle = launchHiLo
|
requiresPowerCycle = launchHiLo
|
||||||
; requiresPowerCycle = flexEnabled
|
requiresPowerCycle = flexEnabled
|
||||||
|
|
||||||
defaultValue = pinLayout, 1
|
defaultValue = pinLayout, 1
|
||||||
defaultValue = TrigPattern, 0
|
defaultValue = TrigPattern, 0
|
||||||
|
|
20
timers.ino
20
timers.ino
|
@ -99,9 +99,25 @@ void timer2Overflowinterrupt() //Most ARM chips can simply call a function
|
||||||
//Set the flex reading (if enabled). The flexCounter is updated with every pulse from the sensor. If cleared once per second, we get a frequency reading
|
//Set the flex reading (if enabled). The flexCounter is updated with every pulse from the sensor. If cleared once per second, we get a frequency reading
|
||||||
if(configPage1.flexEnabled)
|
if(configPage1.flexEnabled)
|
||||||
{
|
{
|
||||||
if(flexCounter > 150 || flexCounter < 50)
|
if(flexCounter < 50)
|
||||||
{
|
{
|
||||||
//This indicated an error condition. Spec of the sensor is that errors are above 170Hz)
|
currentStatus.flex = 0; //Standard GM Continental sensor reads from 50Hz (0 ethanol) to 150Hz (Pure ethanol). Subtracting 50 from the frequency therefore gives the ethanol percentage.
|
||||||
|
flexCounter = 0;
|
||||||
|
}
|
||||||
|
else if (flexCounter > 151) //1 pulse buffer
|
||||||
|
{
|
||||||
|
|
||||||
|
if(flexCounter < 169)
|
||||||
|
{
|
||||||
|
currentStatus.flex = 100; //Standard GM Continental sensor reads from 50Hz (0 ethanol) to 150Hz (Pure ethanol). Subtracting 50 from the frequency therefore gives the ethanol percentage.
|
||||||
|
flexCounter = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//This indicates an error condition. Spec of the sensor is that errors are above 170Hz)
|
||||||
|
currentStatus.flex = 0;
|
||||||
|
flexCounter = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue