diff --git a/globals.h b/globals.h index 26c89650..d6aeb4fd 100644 --- a/globals.h +++ b/globals.h @@ -46,7 +46,8 @@ const int map_page_size = 288; struct statuses { volatile boolean hasSync; unsigned int RPM; - byte MAP; + int mapADC; + int MAP; byte TPS; //The current TPS reading (0% - 100%) byte TPSlast; //The previous TPS reading unsigned long TPS_time; //The time the TPS sample was taken @@ -156,8 +157,8 @@ struct config1 { byte taeColdM; byte tpsMin; byte tpsMax; - byte unused46; - byte unused47; + byte mapMin; + unsigned int mapMax; byte unused48; byte unused49; byte unused50; diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 7bce6f0c..a233b732 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -154,9 +154,8 @@ page = 2 taeColdM = scalar, U08, 43, "%", 1.0, 0.0, 0.0, 250.0, 0 tpsMin = scalar, U08, 44, "ADC", 1.0, 0.0, 0.0, 255.0, 0 tpsMax = scalar, U08, 45, "ADC", 1.0, 0.0, 0.0, 255.0, 0 - unused46 = scalar, U08, 46, "RPM", 100.0, 0.0, 100, 25500, 0 - unused47 = scalar, U08, 47, "RPM", 100.0, 0.0, 100, 25500, 0 - unused48 = scalar, U08, 48, "RPM", 100.0, 0.0, 100, 25500, 0 + mapMin = scalar, U08, 46, "kpa", 1.0, 0.0, 0.0, 255.0, 0 + mapMax = scalar, U16, 47, "kpa", 1.0, 0.0, 0.0, 25500, 0 unused49 = scalar, U08, 49, "RPM", 100.0, 0.0, 100, 25500, 0 unused50 = scalar, U08, 50, "RPM", 100.0, 0.0, 100, 25500, 0 unused51 = scalar, U08, 51, "RPM", 100.0, 0.0, 100, 25500, 0 @@ -456,7 +455,7 @@ page = 7 menuDialog = main menu = "T&ools" - ;subMenu = sensorCal, "Calibrate MAP/Baro" + subMenu = mapCal, "Calibrate MAP" ;subMenu = battcalib, "Calibrate Battery Voltage" ;subMenu = std_separator ;---------------------------------------------- ;subMenu = flash_unlock, "Un/Lock calibrations" @@ -665,6 +664,16 @@ page = 7 ;field = "Bar 1", displayB1, { display } ;field = "Bar 2", displayB2, { display > 2 } + dialog = mapCal, "Calibrate MAP" + field = "#MAP Sensor" + settingSelector = "Common MAP Sensors" + settingOption = "MPX4115", mapMin=10, mapMax=122 + settingOption = "MPX4250", mapMin=10, mapMax=260 + settingOption = "GM 1-BAR", mapMin=10, mapMax=105 + settingOption = "GM 2-BAR", mapMin=9, mapMax=208 + settingOption = "GM 3-BAR / MPXH6300", mapMin=1, mapMax=315 + settingOption = "MPXH6400", mapMin=3, mapMax=416 + ; ------------------------------------------------------------- ; Help down here @@ -888,7 +897,7 @@ help = helpEnrichments, "Enrichments Help" ;Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld ; baroADCGauge = baroADC, "Barometer ADC", "", 0, 255, -1, -1, 256, 256, 0, 0 - mapADCGauge = mapADC, "MAP ADC", "", 0, 255, -1, -1, 256, 256, 0, 0 + ; mapADCGauge = mapADC, "MAP ADC", "", 0, 255, -1, -1, 256, 256, 0, 0 #matADCGauge = matADC, "MAT ADC", "", 0, 255, -1, -1, 256, 256, 0, 0 #cltADCGauge = cltADC, "CLT ADC", "", 0, 255, -1, -1, 256, 256, 0, 0 tpsADCGauge = tpsADC, "TPS ADC", "", 0, 255, -1, -1, 256, 256, 0, 0 @@ -1076,7 +1085,7 @@ help = helpEnrichments, "Enrichments Help" mapaccaen = bits, U08, 2, [6:6] mapaccden = bits, U08, 2, [7:7] dwell = scalar, U08, 3, "ms", 0.100, 0.000 - mapADC = scalar, U08, 4, "ADC", 1.000, 0.000 + map = scalar, U08, 4, "kpa", 0.500, 0.000 #if CELSIUS iatRaw = scalar, U08, 5, "°C", 1.000, 0.000 coolantRaw = scalar, U08, 6, "°C", 1.000, 0.000 @@ -1088,7 +1097,6 @@ 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 @@ -1106,6 +1114,7 @@ help = helpEnrichments, "Enrichments Help" freeRAM = scalar, S16, 26, "bytes", 1.000, 0.000 batCorrection = scalar, U08, 28, "%", 1.000, 0.000 dwell = scalar, U08, 29, "ms", 0.1, 0.000 + afr2 = scalar, U08, 30, "O2", 0.100, 0.000 ; Computed output channels. See "megatuneExamples.ini" for all the ; pre-defined variables, search for "???" and you'll see them. @@ -1122,10 +1131,10 @@ help = helpEnrichments, "Enrichments Help" #if MPX4250 ; barometer = { table(baroADC, "kpafactor4250.inc") } - map = { table(mapADC, "kpafactor4250.inc") } ; Manifold pressure in kPa. + ; map = { table(mapADC, "kpafactor4250.inc") } ; Manifold pressure in kPa. #else ; barometer = { table(baroADC, "kpafactor4115.inc") } - map = { table(mapADC, "kpafactor4115.inc") } + ; map = { table(mapADC, "kpafactor4115.inc") } #endif ; throttle = { table(tpsADC, "throttlefactor.inc") } throttle = { tps }, "%" diff --git a/speeduino.ino b/speeduino.ino index 48f07dbe..6199d2d8 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -480,7 +480,8 @@ void loop() //----------------------------------------------------------------------------------------------------- //currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value - currentStatus.MAP = (byte)fastMap1023toX(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value + currentStatus.mapADC = analogRead(pinMAP); + currentStatus.MAP = map(currentStatus.mapADC, 0, 1023, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value //TPS setting to be performed every 32 loops (any faster and it can upset the TPSdot sampling time) if ((mainLoopCount & 31) == 1)