From 5cd7159bb0070680938a95e154c7777f7d165fc5 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 26 Jun 2016 14:01:41 -0400 Subject: [PATCH] auto-sync --- firmware/config/engines/mazda_miata_1_6.cpp | 9 +++++++++ firmware/controllers/sensors/map.cpp | 5 +++-- firmware/controllers/sensors/map.h | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index f82ed3c2d9..c9e34538a0 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -62,6 +62,15 @@ void setMiataNA_1_6_Configuration(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->hasMapSensor = true; // Frankenso analog #6 pin 3R, W56 top <> W45 bottom jumper, not OEM engineConfiguration->map.sensor.hwChannel = EFI_ADC_7; + engineConfiguration->map.sensor.type = MT_CUSTOM; + + engineConfiguration->map.sensor.lowValue = 33.322271; + engineConfiguration->mapLowValueVoltage = 0.95; + + engineConfiguration->map.sensor.highValue = 100; + engineConfiguration->mapHighValueVoltage = 2.95; + + engineConfiguration->mafAdcChannel = EFI_ADC_0; copyTimingTable(mapBased16IgnitionTable, config->ignitionTable); diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index 75b5566ad7..cfbc06afe9 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -70,7 +70,7 @@ float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DEC case MT_CUSTOM: // todo: migrate to 'FastInterpolation customMap' return interpolate(engineConfiguration->mapLowValueVoltage, mapConfig->lowValue, - 5, mapConfig->highValue, voltage); + engineConfiguration->mapHighValueVoltage, mapConfig->highValue, voltage); case MT_DENSO183: return denso183.getValue(voltage); case MT_MPX4250: @@ -191,7 +191,8 @@ static void printMAPInfo(void) { getMap()); if (engineConfiguration->map.sensor.type == MT_CUSTOM) { - scheduleMsg(logger, "at %f=%f at %f=%f", + scheduleMsg(logger, "MAP %fv", getVoltage("mapinfo", engineConfiguration->map.sensor.hwChannel)); + scheduleMsg(logger, "at %fv=%f at %fv=%f", engineConfiguration->mapLowValueVoltage, engineConfiguration->map.sensor.lowValue, engineConfiguration->mapHighValueVoltage, diff --git a/firmware/controllers/sensors/map.h b/firmware/controllers/sensors/map.h index c46387c92b..72d20cb489 100644 --- a/firmware/controllers/sensors/map.h +++ b/firmware/controllers/sensors/map.h @@ -24,4 +24,7 @@ float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_S); float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DECLARE_ENGINE_PARAMETER_S); float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_S); +#define INHG2KPA(inhg) ((inhg * 3.386375)) +#define KPA2INHG(kpa) ((kpa) / 3.386375) + #endif