Merge pull request #19 from Autohome2/aj30

added second o2 support and new daz board layout
This commit is contained in:
Josh Stewart 2015-09-14 09:31:37 +10:00
commit 0d2f0d3ae6
5 changed files with 61 additions and 5 deletions

View File

@ -138,7 +138,7 @@ This function returns the current values of a fixed group of variables
*/
void sendValues(int length)
{
byte packetSize = 30;
byte packetSize = 31;
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)
@ -176,7 +176,7 @@ void sendValues(int length)
response[28] = currentStatus.batCorrection; //Battery voltage correction (%)
response[29] = (byte)(currentStatus.dwell / 100);
response[30] = currentStatus.O2_2; //O2
Serial.write(response, (size_t)packetSize);
//Serial.flush();

View File

@ -55,12 +55,14 @@ struct statuses {
byte tpsDOT;
byte VE;
byte O2;
byte O2_2;
int coolant;
int cltADC;
int IAT;
int iatADC;
int batADC;
int O2ADC;
int O2_2ADC;
int dwell;
byte dwellCorrection; //The amount of correction being applied to the dwell time.
byte battery10; //The current BRV in volts (multiplied by 10. Eg 12.5V = 125)
@ -326,12 +328,14 @@ byte pinCoil3; //Pin for coil 3
byte pinCoil4; //Pin for coil 4
byte pinTrigger; //The CAS pin
byte pinTrigger2; //The Cam Sensor pin
byte pinTrigger3; //the 2nd cam sensor pin
byte pinTPS;//TPS input pin
byte pinMAP; //MAP sensor pin
byte pinMAP2; //2nd MAP sensor (Currently unused)
byte pinIAT; //IAT sensor pin
byte pinCLT; //CLS sensor pin
byte pinO2; //O2 Sensor pin
byte pinO2_2; //second O2 pin
byte pinBat; //O2 Sensor pin
byte pinDisplayReset; // OLED reset pin
byte pinTachOut; //Tacho output
@ -346,6 +350,16 @@ byte pinSpareOut3; //Generic output
byte pinSpareOut4; //Generic output
byte pinSpareOut5; //Generic output
byte pinSpareOut6; //Generic output
byte pinSpareHOut1; //spare high current output
byte pinSpareHOut2; // spare high current output
byte pinSpareLOut1; // spare low current output
byte pinSpareLOut2; // spare low current output
byte pinSpareLOut3;
byte pinSpareLOut4;
byte pinSpareLOut5;
byte pinBoost;
byte pinVVt_1; // vvt output 1
byte pinVVt_2; // vvt output 2
byte pinFan; // Cooling fan output
byte pinStepperDir; //Direction pin for the stepper motor driver
byte pinStepperStep; //Step pin for the stepper motor driver

View File

@ -101,7 +101,7 @@ page = 2
aseCount = scalar, U08, 3, "s", 1.0, 0.0, 0.0, 255, 0
wueBins = array, U08, 4, [ 10], "%", 1.0, 0.0, 0.0, 255, 0
crankingPct= scalar, U08, 14, "%", 1.0, 0.0, 0.0, 255, 0
pinLayout = bits, U08, 15, [0:7], "Speeduino v0.1", "Speeduino v0.2", "Speeduino v0.3", "Speeduino v0.4", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Turtana PCB", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Plazomat I/O 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
pinLayout = bits, U08, 15, [0:7], "Speeduino v0.1", "Speeduino v0.2", "Speeduino v0.3", "Speeduino v0.4", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Turtana PCB", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Plazomat I/O 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Daz V6 Shield 0.1", "INVALID", "INVALID"
unused16 = scalar, U08, 16, "ms", 0.1, 0.0, 0.0, 25.5, 1
tdePct = scalar, U08, 17, "ms", 0.1, 0.0, 0.0, 25.5, 1
taeColdA = scalar, U08, 18, "ms", 0.1, 0.0, 0.0, 25.5, 1
@ -903,6 +903,7 @@ help = helpEnrichments, "Enrichments Help"
accelEnrichGauge = accelEnrich, "Accel Enrich", "%", 50, 150, -1, -1, 999, 999, 0, 0
afrGauge = afr, "Air:Fuel Ratio", "", 7, 25, 12, 13, 15, 16, 2, 2
afrGauge2 = afr2, "Air:Fuel Ratio 2", "", 7, 25, 12, 13, 15, 16, 2, 2
clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0
deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0
dutyCycleGauge = dutyCycle, "Duty Cycle", "%", 0, 100, -1, -1, 70, 80, 1, 1
@ -1061,7 +1062,7 @@ help = helpEnrichments, "Enrichments Help"
ochGetCommand = "A"
ochBlockSize = 30
ochBlockSize = 31
secl = scalar, U08, 0, "sec", 1.000, 0.000
squirt = scalar, U08, 1, "bits", 1.000, 0.000
@ -1087,6 +1088,7 @@ help = helpEnrichments, "Enrichments Help"
batteryVoltage = scalar, U08, 8, "V", 0.100, 0.000
#egoADC = scalar, U08, 9, "ADC", 1.000, 0.000
afr = scalar, U08, 9, "O2", 0.100, 0.000
afr2 = scalar, U08, 30, "O2", 0.100, 0.000
egoCorrection = scalar, U08, 10, "%", 1.000, 0.000
airCorrection = scalar, U08, 11, "%", 1.000, 0.000
warmupEnrich = scalar, U08, 12, "%", 1.000, 0.000

View File

@ -217,6 +217,7 @@ void setup()
}
pinMode(pinTrigger, INPUT);
pinMode(pinTrigger2, INPUT);
pinMode(pinTrigger3, INPUT);
//digitalWrite(pinTrigger, HIGH);
@ -497,6 +498,7 @@ void loop()
currentStatus.cltADC = map(analogRead(pinCLT), 0, 1023, 0, 511); //Get the current raw CLT value
currentStatus.iatADC = map(analogRead(pinIAT), 0, 1023, 0, 511); //Get the current raw IAT value
currentStatus.O2ADC = map(analogRead(pinO2), 0, 1023, 0, 511); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP
currentStatus.O2_2ADC = map(analogRead(pinO2_2), 0, 1023, 0, 511); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP
//currentStatus.battery10 = map(analogRead(pinBat), 0, 1023, 0, 245); //Get the current raw Battery value. Permissible values are from 0v to 24.5v (245)
currentStatus.battery10 = fastMap1023toX(analogRead(pinBat), 0, 1023, 0, 245); //Get the current raw Battery value. Permissible values are from 0v to 24.5v (245)
//currentStatus.batADC = map(analogRead(pinBat), 0, 1023, 0, 255); //Get the current raw Battery value
@ -504,6 +506,7 @@ void loop()
currentStatus.coolant = cltCalibrationTable[currentStatus.cltADC] - CALIBRATION_TEMPERATURE_OFFSET; //Temperature calibration values are stored as positive bytes. We subtract 40 from them to allow for negative temperatures
currentStatus.IAT = iatCalibrationTable[currentStatus.iatADC] - CALIBRATION_TEMPERATURE_OFFSET;
currentStatus.O2 = o2CalibrationTable[currentStatus.O2ADC];
currentStatus.O2_2 = o2CalibrationTable[currentStatus.O2_2ADC];
}
//Always check for sync

View File

@ -166,6 +166,42 @@ void setPinMapping(byte boardID)
pinCLT = A1; //CLS sensor pin
pinIAT = A0; //IAT sensor pin
case 30:
//Pin mappings as per the dazv6 shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
pinInjector3 = 10; //Output pin injector 3 is on
pinInjector4 = 11; //Output pin injector 4 is on
//pinInjector5 = 12; //Placeholder only - NOT USED
//pinInjector6 = 13; //Placeholder only - NOT USED
pinCoil1 = 40; //Pin for coil 1
pinCoil2 = 38; //Pin for coil 2
pinCoil3 = 50; //Pin for coil 3
pinCoil4 = 52; //Pin for coil 4
pinTrigger = 19; //The CAS pin
pinTrigger2 = 18; //The Cam Sensor pin
pinTrigger3 = 17; // cam sensor 2 pin
pinTPS = A2;//TPS input pin
pinMAP = A3; //MAP sensor pin
pinIAT = A0; //IAT sensor pin
pinCLT = A1; //CLS sensor pin
pinO2 = A8; //O2 Sensor pin
pinO2_2 = A9; //O2 sensor pin (second sensor)
pinBat = A4; //Battery reference voltage pin
pinDisplayReset = 48; // OLED reset pin
pinTachOut = 49; //Tacho output pin
pinIdle1 = 5; //Single wire idle control
pinFuelPump = 45; //Fuel pump output
pinSpareHOut1 = 4; // high current output spare1
pinSpareHOut2 = 6; // high current output spare2
pinBoost = 7;
pinSpareLOut1 = 43; //low current output spare1
pinSpareLOut2 = 47;
pinSpareLOut3 = 49;
pinSpareLOut4 = 51;
pinSpareLOut5 = 53;
break;
default:
//Pin mappings as per the v0.2 shield
pinInjector1 = 8; //Output pin injector 1 is on
@ -205,13 +241,14 @@ void setPinMapping(byte boardID)
//And for inputs
pinMode(pinMAP, INPUT);
pinMode(pinO2, INPUT);
pinMode(pinO2_2, INPUT);
pinMode(pinTPS, INPUT);
pinMode(pinIAT, INPUT);
pinMode(pinCLT, INPUT);
pinMode(pinBat, INPUT);
pinMode(pinTrigger, INPUT);
pinMode(pinTrigger2, INPUT);
pinMode(pinTrigger3, INPUT);
//
digitalWrite(pinMAP, HIGH);
//digitalWrite(pinO2, LOW);