rusefi/firmware/config/engines/mazda_miata_1_6.cpp

124 lines
8.7 KiB
C++
Raw Normal View History

2016-04-16 15:01:43 -07:00
/*
* @file mazda_miata_1_6.cpp
*
2016-05-01 07:10:49 -07:00
* Frankenso board
2016-04-18 20:01:43 -07:00
* set_engine_type 41
*
2016-04-16 15:01:43 -07:00
* @date Apr 16, 2016
* @author Andrey Belomutskiy, (c) 2012-2016
*/
#include "engine_template.h"
#include "custom_engine.h"
2016-04-18 20:01:43 -07:00
#include "fsio_impl.h"
2016-05-01 07:10:49 -07:00
#include "thermistors.h"
2016-04-16 15:01:43 -07:00
EXTERN_ENGINE;
2016-06-16 17:01:59 -07:00
static const ignition_table_t mapBased16IgnitionTable = {
/* Generated by TS2C on Wed Jun 15 21:22:11 EDT 2016*/
{/* 0 18.000 *//* 0 650.0*/10.000, /* 1 1100.0*/11.432, /* 2 1550.0*/12.863, /* 3 2000.0*/14.295, /* 4 2450.0*/15.726, /* 5 2900.0*/17.157, /* 6 3350.0*/18.589, /* 7 3800.0*/20.021, /* 8 4250.0*/21.452, /* 9 4700.0*/22.884, /* 10 5150.0*/24.315, /* 11 5650.0*/25.906, /* 12 6100.0*/27.337, /* 13 6550.0*/28.769, /* 14 7000.0*/30.200, /* 15 7450.0*/30.200, },
{/* 1 24.000 *//* 0 650.0*/10.222, /* 1 1100.0*/11.575, /* 2 1550.0*/12.927, /* 3 2000.0*/14.279, /* 4 2450.0*/15.632, /* 5 2900.0*/16.984, /* 6 3350.0*/18.337, /* 7 3800.0*/19.689, /* 8 4250.0*/21.055, /* 9 4700.0*/22.437, /* 10 5150.0*/23.819, /* 11 5650.0*/25.354, /* 12 6100.0*/26.736, /* 13 6550.0*/28.118, /* 14 7000.0*/29.500, /* 15 7450.0*/29.500, },
{/* 2 33.000 *//* 0 650.0*/10.556, /* 1 1100.0*/11.789, /* 2 1550.0*/13.023, /* 3 2000.0*/14.257, /* 4 2450.0*/15.490, /* 5 2900.0*/16.724, /* 6 3350.0*/17.958, /* 7 3800.0*/19.192, /* 8 4250.0*/20.426, /* 9 4700.0*/21.659, /* 10 5150.0*/22.893, /* 11 5650.0*/24.264, /* 12 6100.0*/25.497, /* 13 6550.0*/26.731, /* 14 7000.0*/27.965, /* 15 7450.0*/27.965, },
{/* 3 39.000 *//* 0 650.0*/10.778, /* 1 1100.0*/11.932, /* 2 1550.0*/13.087, /* 3 2000.0*/14.242, /* 4 2450.0*/15.396, /* 5 2900.0*/16.551, /* 6 3350.0*/17.706, /* 7 3800.0*/18.860, /* 8 4250.0*/20.015, /* 9 4700.0*/21.169, /* 10 5150.0*/22.324, /* 11 5650.0*/23.607, /* 12 6100.0*/24.761, /* 13 6550.0*/25.916, /* 14 7000.0*/27.071, /* 15 7450.0*/27.071, },
{/* 4 45.000 *//* 0 650.0*/11.000, /* 1 1100.0*/12.076, /* 2 1550.0*/13.151, /* 3 2000.0*/14.227, /* 4 2450.0*/15.302, /* 5 2900.0*/16.378, /* 6 3350.0*/17.453, /* 7 3800.0*/18.529, /* 8 4250.0*/19.604, /* 9 4700.0*/20.680, /* 10 5150.0*/21.755, /* 11 5650.0*/22.950, /* 12 6100.0*/24.026, /* 13 6550.0*/25.101, /* 14 7000.0*/26.177, /* 15 7450.0*/26.177, },
{/* 5 51.000 *//* 0 650.0*/11.000, /* 1 1100.0*/11.572, /* 2 1550.0*/12.624, /* 3 2000.0*/13.676, /* 4 2450.0*/14.727, /* 5 2900.0*/15.779, /* 6 3350.0*/16.831, /* 7 3800.0*/17.883, /* 8 4250.0*/18.929, /* 9 4700.0*/19.969, /* 10 5150.0*/21.009, /* 11 5650.0*/22.164, /* 12 6100.0*/23.203, /* 13 6550.0*/24.243, /* 14 7000.0*/25.283, /* 15 7450.0*/25.283, },
{/* 6 60.000 *//* 0 650.0*/9.800, /* 1 1100.0*/10.816, /* 2 1550.0*/11.833, /* 3 2000.0*/12.849, /* 4 2450.0*/13.865, /* 5 2900.0*/14.882, /* 6 3350.0*/15.898, /* 7 3800.0*/16.914, /* 8 4250.0*/17.917, /* 9 4700.0*/18.903, /* 10 5150.0*/19.889, /* 11 5650.0*/20.984, /* 12 6100.0*/21.970, /* 13 6550.0*/22.956, /* 14 7000.0*/23.941, /* 15 7450.0*/23.941, },
{/* 7 66.000 *//* 0 650.0*/9.320, /* 1 1100.0*/10.313, /* 2 1550.0*/11.305, /* 3 2000.0*/12.298, /* 4 2450.0*/13.291, /* 5 2900.0*/14.283, /* 6 3350.0*/15.276, /* 7 3800.0*/16.269, /* 8 4250.0*/17.242, /* 9 4700.0*/18.192, /* 10 5150.0*/19.142, /* 11 5650.0*/20.198, /* 12 6100.0*/21.147, /* 13 6550.0*/22.097, /* 14 7000.0*/23.047, /* 15 7450.0*/23.047, },
{/* 8 72.000 *//* 0 650.0*/8.840, /* 1 1100.0*/9.809, /* 2 1550.0*/10.778, /* 3 2000.0*/11.747, /* 4 2450.0*/12.716, /* 5 2900.0*/13.685, /* 6 3350.0*/14.654, /* 7 3800.0*/15.623, /* 8 4250.0*/16.567, /* 9 4700.0*/17.481, /* 10 5150.0*/18.395, /* 11 5650.0*/19.411, /* 12 6100.0*/20.325, /* 13 6550.0*/21.239, /* 14 7000.0*/22.153, /* 15 7450.0*/22.153, },
{/* 9 78.000 *//* 0 650.0*/8.360, /* 1 1100.0*/9.305, /* 2 1550.0*/10.251, /* 3 2000.0*/11.196, /* 4 2450.0*/12.141, /* 5 2900.0*/13.086, /* 6 3350.0*/14.032, /* 7 3800.0*/14.977, /* 8 4250.0*/15.892, /* 9 4700.0*/16.771, /* 10 5150.0*/17.649, /* 11 5650.0*/18.624, /* 12 6100.0*/19.502, /* 13 6550.0*/20.381, /* 14 7000.0*/21.259, /* 15 7450.0*/21.259, },
{/* 10 84.000 *//* 0 650.0*/7.880, /* 1 1100.0*/8.802, /* 2 1550.0*/9.723, /* 3 2000.0*/10.645, /* 4 2450.0*/11.566, /* 5 2900.0*/12.488, /* 6 3350.0*/13.410, /* 7 3800.0*/14.331, /* 8 4250.0*/15.253, /* 9 4700.0*/16.175, /* 10 5150.0*/17.096, /* 11 5650.0*/18.120, /* 12 6100.0*/19.042, /* 13 6550.0*/19.963, /* 14 7000.0*/20.885, /* 15 7450.0*/20.885, },
{/* 11 93.000 *//* 0 650.0*/7.160, /* 1 1100.0*/8.046, /* 2 1550.0*/8.932, /* 3 2000.0*/9.818, /* 4 2450.0*/10.704, /* 5 2900.0*/11.590, /* 6 3350.0*/12.477, /* 7 3800.0*/13.363, /* 8 4250.0*/14.249, /* 9 4700.0*/15.135, /* 10 5150.0*/16.021, /* 11 5650.0*/17.005, /* 12 6100.0*/17.891, /* 13 6550.0*/18.778, /* 14 7000.0*/19.664, /* 15 7450.0*/19.664, },
{/* 12 99.000 *//* 0 650.0*/6.680, /* 1 1100.0*/6.967, /* 2 1550.0*/8.405, /* 3 2000.0*/9.000, /* 4 2450.0*/9.937, /* 5 2900.0*/10.992, /* 6 3350.0*/11.854, /* 7 3800.0*/12.717, /* 8 4250.0*/13.579, /* 9 4700.0*/14.442, /* 10 5150.0*/15.304, /* 11 5650.0*/16.262, /* 12 6100.0*/17.125, /* 13 6550.0*/17.987, /* 14 7000.0*/18.850, /* 15 7450.0*/18.850, },
{/* 13 105.000 *//* 0 650.0*/6.200, /* 1 1100.0*/7.039, /* 2 1550.0*/7.877, /* 3 2000.0*/8.716, /* 4 2450.0*/9.555, /* 5 2900.0*/10.394, /* 6 3350.0*/11.232, /* 7 3800.0*/12.071, /* 8 4250.0*/12.910, /* 9 4700.0*/13.749, /* 10 5150.0*/14.587, /* 11 5650.0*/15.519, /* 12 6100.0*/16.358, /* 13 6550.0*/17.197, /* 14 7000.0*/18.035, /* 15 7450.0*/18.035, },
{/* 14 111.000 *//* 0 650.0*/5.720, /* 1 1100.0*/6.535, /* 2 1550.0*/7.350, /* 3 2000.0*/8.165, /* 4 2450.0*/8.980, /* 5 2900.0*/9.795, /* 6 3350.0*/10.610, /* 7 3800.0*/11.425, /* 8 4250.0*/12.240, /* 9 4700.0*/13.055, /* 10 5150.0*/13.870, /* 11 5650.0*/14.776, /* 12 6100.0*/15.591, /* 13 6550.0*/16.406, /* 14 7000.0*/17.221, /* 15 7450.0*/17.221, },
{/* 15 120.000 *//* 0 650.0*/5.000, /* 1 1100.0*/5.780, /* 2 1550.0*/6.559, /* 3 2000.0*/7.339, /* 4 2450.0*/8.118, /* 5 2900.0*/8.898, /* 6 3350.0*/9.677, /* 7 3800.0*/10.457, /* 8 4250.0*/11.236, /* 9 4700.0*/12.016, /* 10 5150.0*/12.795, /* 11 5650.0*/13.661, /* 12 6100.0*/14.441, /* 13 6550.0*/15.220, /* 14 7000.0*/16.000, /* 15 7450.0*/16.000, },
};
2016-04-16 15:01:43 -07:00
void setMiataNA_1_6_Configuration(DECLARE_ENGINE_PARAMETER_F) {
setCustomEngineConfiguration(PASS_ENGINE_PARAMETER_F);
2016-06-16 17:01:59 -07:00
engineConfiguration->hasMapSensor = true;
// Frankenso analog #6 pin 3R, W56 top <> W45 bottom jumper, not OEM
engineConfiguration->map.sensor.hwChannel = EFI_ADC_7;
2016-06-14 20:01:15 -07:00
engineConfiguration->mafAdcChannel = EFI_ADC_0;
2016-06-16 17:01:59 -07:00
copyTimingTable(mapBased16IgnitionTable, config->ignitionTable);
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM
engineConfiguration->afr.hwChannel = EFI_ADC_3;
setWholeFuelMap(6 PASS_ENGINE_PARAMETER);
2016-06-14 20:01:15 -07:00
2016-06-16 17:01:59 -07:00
// set_cranking_timing_angle 10
engineConfiguration->crankingTimingAngle = 10;
2016-06-14 20:01:15 -07:00
2016-06-16 17:01:59 -07:00
// chartsize 200
engineConfiguration->engineChartSize = 200;
2016-06-14 20:01:15 -07:00
2016-06-16 17:01:59 -07:00
// set_cranking_fuel 5
engineConfiguration->cranking.baseFuel = 5;
2016-06-14 20:01:15 -07:00
2016-04-18 20:01:43 -07:00
engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA;
2016-06-11 14:01:51 -07:00
engineConfiguration->specs.displacement = 1.6;
2016-04-16 15:01:43 -07:00
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
2016-04-18 20:01:43 -07:00
engineConfiguration->vbattDividerCoeff = 9.75;// ((float) (8.2 + 33)) / 8.2 * 2;
2016-05-01 07:10:49 -07:00
boardConfiguration->idle.solenoidFrequency = 160;
2016-04-19 17:03:53 -07:00
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
2016-04-18 20:01:43 -07:00
2016-05-01 07:10:49 -07:00
setCommonNTCSensor(&engineConfiguration->clt);
engineConfiguration->clt.config.bias_resistor = 2700;
setCommonNTCSensor(&engineConfiguration->iat);
engineConfiguration->iat.config.bias_resistor = 2700;
2016-05-05 18:01:41 -07:00
boardConfiguration->isSdCardEnabled = true;
2016-05-01 07:10:49 -07:00
/**
* oil pressure line
* adc4/pa4/W47
*/
2016-05-15 21:02:01 -07:00
engineConfiguration->fsioAdc[0] = EFI_ADC_4;
2016-05-01 07:10:49 -07:00
2016-04-18 20:01:43 -07:00
// warning light
/**
* to test
2016-04-20 10:02:00 -07:00
* set_fsio_setting 0 1800
2016-04-19 17:03:53 -07:00
* set_fsio_setting 1 95
* set_fsio_setting 3 14
2016-04-18 20:01:43 -07:00
*
2016-04-20 10:02:00 -07:00
* set_fsio_expression 1 "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |"
* eval "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |"
2016-04-18 20:01:43 -07:00
*/
2016-06-05 17:03:16 -07:00
boardConfiguration->fsio_setting[0] = 6000; // RPM threshold
boardConfiguration->fsio_setting[1] = 90; // CLT threshold
boardConfiguration->fsio_setting[2] = 13.0; // voltage threshold
2016-04-18 20:01:43 -07:00
2016-04-20 10:02:00 -07:00
setFsio(0, GPIOC_13, "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" PASS_ENGINE_PARAMETER);
2016-04-16 15:01:43 -07:00
2016-05-17 22:01:38 -07:00
boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOC_7; // Frankenso high side - pin 1H
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
boardConfiguration->injectionPins[0] = GPIOB_9; // #1
boardConfiguration->injectionPins[1] = GPIOE_2; // #2
boardConfiguration->injectionPins[2] = GPIOB_8; // #3
boardConfiguration->injectionPins[3] = GPIOB_7; // #4
2016-06-11 14:01:51 -07:00
engineConfiguration->injectionMode = IM_BATCH;
2016-05-17 22:01:38 -07:00
2016-04-16 15:01:43 -07:00
}