2016-10-04 10:03:25 -07:00
|
|
|
/*
|
|
|
|
* @file mazda_miata_vvt.cpp
|
|
|
|
*
|
2020-03-16 13:39:42 -07:00
|
|
|
* Miata NB2, also known as MX-5 Mk2.5
|
|
|
|
*
|
2020-05-21 17:44:14 -07:00
|
|
|
* Frankenso MAZDA_MIATA_2003
|
2017-01-06 07:04:41 -08:00
|
|
|
* set engine_type 47
|
2016-10-04 12:02:36 -07:00
|
|
|
*
|
2019-09-20 22:21:53 -07:00
|
|
|
* coil1/4 (p1 +5 VP) GPIOE_14
|
|
|
|
* coil2/2 (p1 +5 VP) GPIOC_9
|
|
|
|
* tachometer +5 VP (p3 +12 VP) GPIOE_8
|
|
|
|
* alternator +5 VP (p3 +12 VP) GPIOE_10
|
|
|
|
* ETB PWM GPIOE_6 inverted low-side with pull-up
|
|
|
|
* ETB dir1 GPIOE_12
|
|
|
|
* ETB dir2 GPIOC_7
|
|
|
|
*
|
|
|
|
* COP ion #1 GPIOD_8
|
|
|
|
* COP ion #3 GPIOD_9
|
|
|
|
*
|
2016-10-04 10:03:25 -07:00
|
|
|
* @date Oct 4, 2016
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2016-10-04 10:03:25 -07:00
|
|
|
* http://rusefi.com/forum/viewtopic.php?f=3&t=1095
|
2017-02-14 20:03:57 -08:00
|
|
|
*
|
|
|
|
*
|
2018-02-03 09:04:28 -08:00
|
|
|
* See also TT_MAZDA_MIATA_VVT_TEST for trigger simulation
|
2017-04-17 19:09:12 -07:00
|
|
|
*
|
|
|
|
* Based on http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board#Default_Pinout
|
|
|
|
*
|
2018-12-26 17:25:03 -08:00
|
|
|
* board #70 - red car, hunchback compatible
|
2018-01-17 17:52:46 -08:00
|
|
|
* set engine_type 55
|
|
|
|
*
|
2017-04-19 19:48:05 -07:00
|
|
|
* Crank primary trigger PA5 (3E in Miata board) white
|
|
|
|
* Cam vvt input PC6 (3G in Miata board) blue
|
2017-04-21 16:05:02 -07:00
|
|
|
* Wideband input PA3 (3J in Miata board)
|
2017-04-17 19:09:12 -07:00
|
|
|
*
|
2019-09-20 22:21:53 -07:00
|
|
|
* coil1/4 (p1 +5 VP) GPIOE_14
|
|
|
|
* coil2/2 (p1 +5 VP) GPIOC_7
|
2017-04-17 19:09:12 -07:00
|
|
|
*
|
2019-09-20 22:21:53 -07:00
|
|
|
* tachometer +5 VP (p3 +12 VP) GPIOE_8
|
|
|
|
* alternator +5 VP (p3 +12 VP) GPIOE_10
|
|
|
|
*
|
|
|
|
* VVT solenoid on aux PID#1 GPIOE_3
|
|
|
|
* warning light GPIOE_6
|
2017-04-17 19:09:12 -07:00
|
|
|
*
|
|
|
|
*
|
2018-01-15 12:27:14 -08:00
|
|
|
* idle solenoid PC13 on middle harness plug. diodes seem to be in the harness
|
2016-10-04 10:03:25 -07:00
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2016-10-04 10:03:25 -07:00
|
|
|
#include "mazda_miata_vvt.h"
|
2016-10-04 12:02:36 -07:00
|
|
|
#include "custom_engine.h"
|
2016-12-28 19:01:57 -08:00
|
|
|
#include "fsio_impl.h"
|
2020-08-02 07:18:14 -07:00
|
|
|
#include "mazda_miata_base_maps.h"
|
2021-01-10 15:57:27 -08:00
|
|
|
#include "hip9011_logic.h"
|
2016-10-04 10:03:25 -07:00
|
|
|
|
2021-10-02 20:56:43 -07:00
|
|
|
|
2021-10-25 17:51:07 -07:00
|
|
|
#if HW_PROTEUS
|
2021-10-02 20:56:43 -07:00
|
|
|
#include "proteus_meta.h"
|
|
|
|
#endif
|
|
|
|
|
2021-10-26 07:27:10 -07:00
|
|
|
#include "mre_meta.h"
|
|
|
|
|
2017-04-18 19:30:14 -07:00
|
|
|
static const float injectorLagBins[VBAT_INJECTOR_CURVE_SIZE] = {
|
|
|
|
6.0, 8.0, 10.0, 11.0,
|
|
|
|
12.0, 13.0, 14.0, 15.0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const float injectorLagCorrection[VBAT_INJECTOR_CURVE_SIZE] = {
|
|
|
|
4.0 , 3.0 , 2.0 , 1.7,
|
|
|
|
1.5 , 1.35, 1.25 , 1.20
|
|
|
|
};
|
|
|
|
|
2021-11-14 08:04:51 -08:00
|
|
|
static const float vvt18fsioRpmBins[SCRIPT_TABLE_8] =
|
2017-02-13 17:02:46 -08:00
|
|
|
{700.0, 1000.0, 2000.0, 3000.0, 3500.0, 4500.0, 5500.0, 6500.0}
|
|
|
|
;
|
2017-01-21 14:02:37 -08:00
|
|
|
|
2021-11-14 08:04:51 -08:00
|
|
|
static const float vvt18fsioLoadBins[SCRIPT_TABLE_8] =
|
2017-02-13 17:02:46 -08:00
|
|
|
{30.0, 40.0, 50.0, 60.0, 70.0, 75.0, 82.0, 85.0}
|
|
|
|
;
|
2017-01-21 14:02:37 -08:00
|
|
|
|
2021-11-14 08:04:51 -08:00
|
|
|
static const uint8_t SCRIPT_TABLE_vvt_target[SCRIPT_TABLE_8][SCRIPT_TABLE_8] = {
|
2017-02-13 17:02:46 -08:00
|
|
|
/* Generated by TS2C on Mon Feb 13 19:11:32 EST 2017*/
|
2021-05-09 11:37:16 -07:00
|
|
|
{/* 0 30 *//* 0 700.0*/1, /* 1 1000.0*/3, /* 2 2000.0*/10, /* 3 3000.0*/20, /* 4 3500.0*/27, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 1 40 *//* 0 700.0*/3, /* 1 1000.0*/10, /* 2 2000.0*/19, /* 3 3000.0*/26, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 2 50 *//* 0 700.0*/7, /* 1 1000.0*/16, /* 2 2000.0*/24, /* 3 3000.0*/28, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 3 60 *//* 0 700.0*/11, /* 1 1000.0*/20, /* 2 2000.0*/27, /* 3 3000.0*/28, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 4 70 *//* 0 700.0*/13, /* 1 1000.0*/24, /* 2 2000.0*/31, /* 3 3000.0*/28, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 5 75 *//* 0 700.0*/15, /* 1 1000.0*/27, /* 2 2000.0*/33, /* 3 3000.0*/28, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 6 82 *//* 0 700.0*/17, /* 1 1000.0*/28, /* 2 2000.0*/33, /* 3 3000.0*/28, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
|
|
|
{/* 7 85 *//* 0 700.0*/17, /* 1 1000.0*/28, /* 2 2000.0*/33, /* 3 3000.0*/28, /* 4 3500.0*/30, /* 5 4500.0*/28, /* 6 5500.0*/11, /* 7 6500.0*/5, },
|
2017-01-21 14:02:37 -08:00
|
|
|
};
|
|
|
|
|
2019-09-20 14:46:54 -07:00
|
|
|
const float mazda_miata_nb2_RpmBins[FUEL_RPM_COUNT] = {700.0, 820.0, 950.0, 1100.0,
|
2017-04-18 19:30:14 -07:00
|
|
|
1300.0, 1550.0, 1800.0, 2150.0,
|
|
|
|
2500.0, 3000.0, 3500.0, 4150.0,
|
|
|
|
4900.0, 5800.0, 6800.0, 8000.0}
|
|
|
|
;
|
|
|
|
|
2019-09-20 14:46:54 -07:00
|
|
|
const float mazda_miata_nb2_LoadBins[FUEL_LOAD_COUNT] = {20.0, 25.0, 30.0, 35.0,
|
2017-04-18 19:30:14 -07:00
|
|
|
40.0, 46.0, 54.0, 63.0,
|
|
|
|
73.0, 85.0, 99.0, 116.0,
|
|
|
|
135.0, 158.0, 185.0, 220.0}
|
|
|
|
;
|
2017-01-21 14:02:37 -08:00
|
|
|
|
2017-04-18 19:30:14 -07:00
|
|
|
static const float ignition18vvtRpmBins[FUEL_RPM_COUNT] = {
|
2016-12-15 20:02:59 -08:00
|
|
|
700.0, 850.0 , 943.0 ,
|
|
|
|
1112.0 , 1310.0 , 1545.0 ,
|
|
|
|
1821.0, 2146.0, 2530.0,
|
|
|
|
2982.0, 3515.0 , 4144.0 ,
|
|
|
|
4884.0 , 5757.0 , 6787.0, 8000.0};
|
|
|
|
|
2017-04-18 19:30:14 -07:00
|
|
|
static const float ignition18vvtLoadBins[FUEL_LOAD_COUNT] = {
|
2016-12-15 20:02:59 -08:00
|
|
|
25.0 , 29.10009765625 , 34.0 , 39.60009765625 ,
|
|
|
|
46.2001953125 , 53.89990234375 , 62.7998046875 ,
|
|
|
|
73.2001953125 , 85.400390625 , 99.5 , 116.0 ,
|
|
|
|
135.30078125 , 157.69921875 , 183.900390625 , 214.400390625 ,
|
|
|
|
250.0};
|
|
|
|
|
2021-05-09 11:37:16 -07:00
|
|
|
static const int8_t mapBased18vvtVeTable_NB_fuel_rail[16][16] = {
|
2017-04-18 19:30:14 -07:00
|
|
|
/* Generated by TS2C on Tue Apr 18 21:46:03 EDT 2017*/
|
2021-05-09 11:37:16 -07:00
|
|
|
{/* 0 20 *//* 0 700.0*/35, /* 1 820.0*/36, /* 2 950.0*/37, /* 3 1100.0*/35, /* 4 1300.0*/36, /* 5 1550.0*/37, /* 6 1800.0*/33, /* 7 2150.0*/31, /* 8 2500.0*/25, /* 9 3000.0*/24, /* 10 3500.0*/24, /* 11 4150.0*/25, /* 12 4900.0*/26, /* 13 5800.0*/29, /* 14 6800.0*/33, /* 15 8000.0*/36, },
|
|
|
|
{/* 1 25 *//* 0 700.0*/35, /* 1 820.0*/37, /* 2 950.0*/38, /* 3 1100.0*/37, /* 4 1300.0*/36, /* 5 1550.0*/37, /* 6 1800.0*/41, /* 7 2150.0*/39, /* 8 2500.0*/40, /* 9 3000.0*/37, /* 10 3500.0*/35, /* 11 4150.0*/36, /* 12 4900.0*/37, /* 13 5800.0*/35, /* 14 6800.0*/38, /* 15 8000.0*/40, },
|
|
|
|
{/* 2 30 *//* 0 700.0*/37, /* 1 820.0*/40, /* 2 950.0*/39, /* 3 1100.0*/37, /* 4 1300.0*/38, /* 5 1550.0*/41, /* 6 1800.0*/45, /* 7 2150.0*/47, /* 8 2500.0*/54, /* 9 3000.0*/48, /* 10 3500.0*/47, /* 11 4150.0*/55, /* 12 4900.0*/55, /* 13 5800.0*/49, /* 14 6800.0*/50, /* 15 8000.0*/51, },
|
|
|
|
{/* 3 35 *//* 0 700.0*/39, /* 1 820.0*/44, /* 2 950.0*/42, /* 3 1100.0*/40, /* 4 1300.0*/45, /* 5 1550.0*/48, /* 6 1800.0*/48, /* 7 2150.0*/52, /* 8 2500.0*/56, /* 9 3000.0*/53, /* 10 3500.0*/52, /* 11 4150.0*/58, /* 12 4900.0*/62, /* 13 5800.0*/57, /* 14 6800.0*/58, /* 15 8000.0*/58, },
|
|
|
|
{/* 4 40 *//* 0 700.0*/45, /* 1 820.0*/56, /* 2 950.0*/49, /* 3 1100.0*/45, /* 4 1300.0*/54, /* 5 1550.0*/53, /* 6 1800.0*/55, /* 7 2150.0*/54, /* 8 2500.0*/57, /* 9 3000.0*/55, /* 10 3500.0*/57, /* 11 4150.0*/59, /* 12 4900.0*/62, /* 13 5800.0*/59, /* 14 6800.0*/63, /* 15 8000.0*/62, },
|
|
|
|
{/* 5 46 *//* 0 700.0*/54, /* 1 820.0*/61, /* 2 950.0*/56, /* 3 1100.0*/52, /* 4 1300.0*/53, /* 5 1550.0*/58, /* 6 1800.0*/57, /* 7 2150.0*/59, /* 8 2500.0*/58, /* 9 3000.0*/58, /* 10 3500.0*/60, /* 11 4150.0*/64, /* 12 4900.0*/66, /* 13 5800.0*/64, /* 14 6800.0*/65, /* 15 8000.0*/63, },
|
|
|
|
{/* 6 54 *//* 0 700.0*/60, /* 1 820.0*/67, /* 2 950.0*/66, /* 3 1100.0*/60, /* 4 1300.0*/59, /* 5 1550.0*/59, /* 6 1800.0*/61, /* 7 2150.0*/63, /* 8 2500.0*/63, /* 9 3000.0*/60, /* 10 3500.0*/62, /* 11 4150.0*/69, /* 12 4900.0*/71, /* 13 5800.0*/67, /* 14 6800.0*/65, /* 15 8000.0*/63, },
|
|
|
|
{/* 7 63 *//* 0 700.0*/65, /* 1 820.0*/70, /* 2 950.0*/71, /* 3 1100.0*/67, /* 4 1300.0*/62, /* 5 1550.0*/61, /* 6 1800.0*/65, /* 7 2150.0*/63, /* 8 2500.0*/63, /* 9 3000.0*/64, /* 10 3500.0*/66, /* 11 4150.0*/69, /* 12 4900.0*/73, /* 13 5800.0*/71, /* 14 6800.0*/67, /* 15 8000.0*/65, },
|
|
|
|
{/* 8 73 *//* 0 700.0*/70, /* 1 820.0*/74, /* 2 950.0*/73, /* 3 1100.0*/75, /* 4 1300.0*/71, /* 5 1550.0*/66, /* 6 1800.0*/66, /* 7 2150.0*/65, /* 8 2500.0*/67, /* 9 3000.0*/69, /* 10 3500.0*/68, /* 11 4150.0*/72, /* 12 4900.0*/76, /* 13 5800.0*/75, /* 14 6800.0*/66, /* 15 8000.0*/65, },
|
|
|
|
{/* 9 85 *//* 0 700.0*/71, /* 1 820.0*/75, /* 2 950.0*/76, /* 3 1100.0*/74, /* 4 1300.0*/73, /* 5 1550.0*/72, /* 6 1800.0*/71, /* 7 2150.0*/70, /* 8 2500.0*/72, /* 9 3000.0*/72, /* 10 3500.0*/74, /* 11 4150.0*/76, /* 12 4900.0*/78, /* 13 5800.0*/76, /* 14 6800.0*/68, /* 15 8000.0*/64, },
|
|
|
|
{/* 10 99 *//* 0 700.0*/75, /* 1 820.0*/76, /* 2 950.0*/78, /* 3 1100.0*/76, /* 4 1300.0*/73, /* 5 1550.0*/74, /* 6 1800.0*/74, /* 7 2150.0*/74, /* 8 2500.0*/77, /* 9 3000.0*/76, /* 10 3500.0*/77, /* 11 4150.0*/76, /* 12 4900.0*/77, /* 13 5800.0*/76, /* 14 6800.0*/69, /* 15 8000.0*/65, },
|
|
|
|
{/* 11 116 *//* 0 700.0*/80, /* 1 820.0*/80, /* 2 950.0*/80, /* 3 1100.0*/80, /* 4 1300.0*/80, /* 5 1550.0*/80, /* 6 1800.0*/80, /* 7 2150.0*/80, /* 8 2500.0*/80, /* 9 3000.0*/80, /* 10 3500.0*/80, /* 11 4150.0*/80, /* 12 4900.0*/80, /* 13 5800.0*/80, /* 14 6800.0*/80, /* 15 8000.0*/80, },
|
|
|
|
{/* 12 135 *//* 0 700.0*/80, /* 1 820.0*/80, /* 2 950.0*/80, /* 3 1100.0*/80, /* 4 1300.0*/80, /* 5 1550.0*/80, /* 6 1800.0*/80, /* 7 2150.0*/80, /* 8 2500.0*/80, /* 9 3000.0*/80, /* 10 3500.0*/80, /* 11 4150.0*/80, /* 12 4900.0*/80, /* 13 5800.0*/80, /* 14 6800.0*/80, /* 15 8000.0*/80, },
|
|
|
|
{/* 13 158 *//* 0 700.0*/80, /* 1 820.0*/80, /* 2 950.0*/80, /* 3 1100.0*/80, /* 4 1300.0*/80, /* 5 1550.0*/80, /* 6 1800.0*/80, /* 7 2150.0*/80, /* 8 2500.0*/80, /* 9 3000.0*/80, /* 10 3500.0*/80, /* 11 4150.0*/80, /* 12 4900.0*/80, /* 13 5800.0*/80, /* 14 6800.0*/80, /* 15 8000.0*/80, },
|
|
|
|
{/* 14 185 *//* 0 700.0*/80, /* 1 820.0*/80, /* 2 950.0*/80, /* 3 1100.0*/80, /* 4 1300.0*/80, /* 5 1550.0*/80, /* 6 1800.0*/80, /* 7 2150.0*/80, /* 8 2500.0*/80, /* 9 3000.0*/80, /* 10 3500.0*/80, /* 11 4150.0*/80, /* 12 4900.0*/80, /* 13 5800.0*/80, /* 14 6800.0*/80, /* 15 8000.0*/80, },
|
|
|
|
{/* 15 220 *//* 0 700.0*/80, /* 1 820.0*/80, /* 2 950.0*/80, /* 3 1100.0*/80, /* 4 1300.0*/80, /* 5 1550.0*/80, /* 6 1800.0*/80, /* 7 2150.0*/80, /* 8 2500.0*/80, /* 9 3000.0*/80, /* 10 3500.0*/80, /* 11 4150.0*/80, /* 12 4900.0*/80, /* 13 5800.0*/80, /* 14 6800.0*/80, /* 15 8000.0*/80, },
|
2016-12-15 20:02:59 -08:00
|
|
|
};
|
|
|
|
|
2019-06-10 12:45:18 -07:00
|
|
|
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
|
2021-05-09 11:37:16 -07:00
|
|
|
static const uint8_t mapBased18vvtTimingTable[16][16] = {
|
2017-04-18 19:30:14 -07:00
|
|
|
/* Generated by TS2C on Tue Apr 18 21:43:57 EDT 2017*/
|
2021-05-09 11:37:16 -07:00
|
|
|
{/* 0 25 *//* 0 700.0*/14, /* 1 850.0*/13, /* 2 943.0*/13, /* 3 1112.0*/16, /* 4 1310.0*/21, /* 5 1545.0*/25, /* 6 1821.0*/28, /* 7 2146.0*/31, /* 8 2530.0*/34, /* 9 2982.0*/36, /* 10 3515.0*/38, /* 11 4144.0*/39, /* 12 4884.0*/40, /* 13 5757.0*/40, /* 14 6787.0*/40, /* 15 8000.0*/41, },
|
|
|
|
{/* 1 29.100 *//* 0 700.0*/14, /* 1 850.0*/13, /* 2 943.0*/13, /* 3 1112.0*/16, /* 4 1310.0*/21, /* 5 1545.0*/25, /* 6 1821.0*/28, /* 7 2146.0*/31, /* 8 2530.0*/34, /* 9 2982.0*/36, /* 10 3515.0*/38, /* 11 4144.0*/39, /* 12 4884.0*/40, /* 13 5757.0*/40, /* 14 6787.0*/40, /* 15 8000.0*/40, },
|
|
|
|
{/* 2 34 *//* 0 700.0*/14, /* 1 850.0*/13, /* 2 943.0*/13, /* 3 1112.0*/16, /* 4 1310.0*/21, /* 5 1545.0*/24, /* 6 1821.0*/27, /* 7 2146.0*/30, /* 8 2530.0*/33, /* 9 2982.0*/35, /* 10 3515.0*/37, /* 11 4144.0*/38, /* 12 4884.0*/39, /* 13 5757.0*/40, /* 14 6787.0*/40, /* 15 8000.0*/40, },
|
|
|
|
{/* 3 39.600 *//* 0 700.0*/15, /* 1 850.0*/13, /* 2 943.0*/13, /* 3 1112.0*/17, /* 4 1310.0*/21, /* 5 1545.0*/24, /* 6 1821.0*/27, /* 7 2146.0*/30, /* 8 2530.0*/33, /* 9 2982.0*/35, /* 10 3515.0*/36, /* 11 4144.0*/38, /* 12 4884.0*/38, /* 13 5757.0*/39, /* 14 6787.0*/39, /* 15 8000.0*/39, },
|
|
|
|
{/* 4 46.200 *//* 0 700.0*/15, /* 1 850.0*/13, /* 2 943.0*/13, /* 3 1112.0*/18, /* 4 1310.0*/21, /* 5 1545.0*/24, /* 6 1821.0*/26, /* 7 2146.0*/29, /* 8 2530.0*/32, /* 9 2982.0*/33, /* 10 3515.0*/36, /* 11 4144.0*/37, /* 12 4884.0*/38, /* 13 5757.0*/38, /* 14 6787.0*/38, /* 15 8000.0*/39, },
|
|
|
|
{/* 5 53.900 *//* 0 700.0*/15, /* 1 850.0*/14, /* 2 943.0*/14, /* 3 1112.0*/18, /* 4 1310.0*/21, /* 5 1545.0*/24, /* 6 1821.0*/26, /* 7 2146.0*/28, /* 8 2530.0*/30, /* 9 2982.0*/32, /* 10 3515.0*/34, /* 11 4144.0*/36, /* 12 4884.0*/37, /* 13 5757.0*/37, /* 14 6787.0*/38, /* 15 8000.0*/38, },
|
|
|
|
{/* 6 62.800 *//* 0 700.0*/15, /* 1 850.0*/15, /* 2 943.0*/14, /* 3 1112.0*/19, /* 4 1310.0*/21, /* 5 1545.0*/23, /* 6 1821.0*/25, /* 7 2146.0*/27, /* 8 2530.0*/29, /* 9 2982.0*/31, /* 10 3515.0*/33, /* 11 4144.0*/34, /* 12 4884.0*/35, /* 13 5757.0*/36, /* 14 6787.0*/36, /* 15 8000.0*/37, },
|
|
|
|
{/* 7 73.200 *//* 0 700.0*/16, /* 1 850.0*/16, /* 2 943.0*/15, /* 3 1112.0*/19, /* 4 1310.0*/21, /* 5 1545.0*/23, /* 6 1821.0*/24, /* 7 2146.0*/26, /* 8 2530.0*/28, /* 9 2982.0*/30, /* 10 3515.0*/31, /* 11 4144.0*/32, /* 12 4884.0*/33, /* 13 5757.0*/34, /* 14 6787.0*/34, /* 15 8000.0*/35, },
|
|
|
|
{/* 8 85.400 *//* 0 700.0*/16, /* 1 850.0*/17, /* 2 943.0*/16, /* 3 1112.0*/19, /* 4 1310.0*/20, /* 5 1545.0*/22, /* 6 1821.0*/23, /* 7 2146.0*/24, /* 8 2530.0*/26, /* 9 2982.0*/28, /* 10 3515.0*/29, /* 11 4144.0*/31, /* 12 4884.0*/31, /* 13 5757.0*/32, /* 14 6787.0*/33, /* 15 8000.0*/33, },
|
|
|
|
{/* 9 99.500 *//* 0 700.0*/16, /* 1 850.0*/16, /* 2 943.0*/17, /* 3 1112.0*/18, /* 4 1310.0*/19, /* 5 1545.0*/20, /* 6 1821.0*/21, /* 7 2146.0*/22, /* 8 2530.0*/23, /* 9 2982.0*/25, /* 10 3515.0*/26, /* 11 4144.0*/28, /* 12 4884.0*/28, /* 13 5757.0*/29, /* 14 6787.0*/30, /* 15 8000.0*/31, },
|
|
|
|
{/* 10 116 *//* 0 700.0*/15, /* 1 850.0*/15, /* 2 943.0*/16, /* 3 1112.0*/16, /* 4 1310.0*/17, /* 5 1545.0*/18, /* 6 1821.0*/19, /* 7 2146.0*/20, /* 8 2530.0*/21, /* 9 2982.0*/23, /* 10 3515.0*/24, /* 11 4144.0*/25, /* 12 4884.0*/26, /* 13 5757.0*/27, /* 14 6787.0*/28, /* 15 8000.0*/29, },
|
|
|
|
{/* 11 135.301 *//* 0 700.0*/13, /* 1 850.0*/13, /* 2 943.0*/14, /* 3 1112.0*/14, /* 4 1310.0*/15, /* 5 1545.0*/15, /* 6 1821.0*/17, /* 7 2146.0*/17, /* 8 2530.0*/19, /* 9 2982.0*/20, /* 10 3515.0*/22, /* 11 4144.0*/23, /* 12 4884.0*/24, /* 13 5757.0*/25, /* 14 6787.0*/26, /* 15 8000.0*/27, },
|
|
|
|
{/* 12 157.699 *//* 0 700.0*/11, /* 1 850.0*/11, /* 2 943.0*/11, /* 3 1112.0*/12, /* 4 1310.0*/12, /* 5 1545.0*/13, /* 6 1821.0*/14, /* 7 2146.0*/15, /* 8 2530.0*/16, /* 9 2982.0*/17, /* 10 3515.0*/19, /* 11 4144.0*/20, /* 12 4884.0*/21, /* 13 5757.0*/22, /* 14 6787.0*/24, /* 15 8000.0*/25, },
|
|
|
|
{/* 13 183.900 *//* 0 700.0*/8, /* 1 850.0*/8, /* 2 943.0*/9, /* 3 1112.0*/9, /* 4 1310.0*/9, /* 5 1545.0*/10, /* 6 1821.0*/11, /* 7 2146.0*/12, /* 8 2530.0*/13, /* 9 2982.0*/14, /* 10 3515.0*/16, /* 11 4144.0*/17, /* 12 4884.0*/18, /* 13 5757.0*/19, /* 14 6787.0*/21, /* 15 8000.0*/22, },
|
|
|
|
{/* 14 214.400 *//* 0 700.0*/5, /* 1 850.0*/5, /* 2 943.0*/5, /* 3 1112.0*/5, /* 4 1310.0*/6, /* 5 1545.0*/7, /* 6 1821.0*/7, /* 7 2146.0*/8, /* 8 2530.0*/9, /* 9 2982.0*/10, /* 10 3515.0*/12, /* 11 4144.0*/13, /* 12 4884.0*/14, /* 13 5757.0*/16, /* 14 6787.0*/17, /* 15 8000.0*/18, },
|
|
|
|
{/* 15 250 *//* 0 700.0*/1, /* 1 850.0*/1, /* 2 943.0*/1, /* 3 1112.0*/2, /* 4 1310.0*/2, /* 5 1545.0*/3, /* 6 1821.0*/3, /* 7 2146.0*/4, /* 8 2530.0*/5, /* 9 2982.0*/6, /* 10 3515.0*/7, /* 11 4144.0*/9, /* 12 4884.0*/10, /* 13 5757.0*/12, /* 14 6787.0*/13, /* 15 8000.0*/14, },
|
2016-12-15 20:02:59 -08:00
|
|
|
};
|
2019-06-10 12:45:18 -07:00
|
|
|
#endif
|
2016-12-15 20:02:59 -08:00
|
|
|
|
2020-05-12 20:37:30 -07:00
|
|
|
|
|
|
|
/*
|
2020-04-26 20:03:50 -07:00
|
|
|
#define MAF_TRANSFER_SIZE 8
|
|
|
|
|
|
|
|
static const float mafTransferVolts[MAF_TRANSFER_SIZE] = {1.365,
|
|
|
|
1.569,
|
|
|
|
2.028,
|
|
|
|
2.35,
|
|
|
|
2.611,
|
|
|
|
2.959,
|
|
|
|
3.499,
|
|
|
|
4.011,
|
|
|
|
};
|
|
|
|
|
2020-05-12 20:37:30 -07:00
|
|
|
|
|
|
|
according to internet this should be the Miata NB transfer function but in reality it seems off
|
|
|
|
this could be related to us not using proper signal conditioning hardware
|
2020-04-26 20:03:50 -07:00
|
|
|
static const float mafTransferKgH[MAF_TRANSFER_SIZE] = {
|
|
|
|
0,
|
|
|
|
3.9456,
|
|
|
|
18.7308,
|
|
|
|
45.4788,
|
|
|
|
82.278,
|
|
|
|
154.4328,
|
|
|
|
329.8104,
|
|
|
|
594.2772
|
|
|
|
};
|
|
|
|
|
2020-05-12 20:37:30 -07:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MAF_TRANSFER_SIZE 10
|
|
|
|
|
|
|
|
// this transfer function somehow works with 1K pull-down
|
|
|
|
static const float mafTransferVolts[MAF_TRANSFER_SIZE] = {
|
|
|
|
0.50,
|
|
|
|
0.87,
|
|
|
|
1.07,
|
|
|
|
1.53,
|
|
|
|
1.85,
|
|
|
|
2.11,
|
|
|
|
2.46,
|
|
|
|
3.00,
|
|
|
|
3.51,
|
|
|
|
4.50
|
|
|
|
};
|
|
|
|
|
|
|
|
static const float mafTransferKgH[MAF_TRANSFER_SIZE] = {
|
|
|
|
0.00,
|
|
|
|
0.00,
|
|
|
|
1.00,
|
|
|
|
3.00,
|
|
|
|
8.00,
|
|
|
|
19.00,
|
|
|
|
45.00,
|
|
|
|
100.00,
|
|
|
|
175.00,
|
|
|
|
350.00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-04-26 20:03:50 -07:00
|
|
|
static void setMAFTransferFunction(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
memcpy(config->mafDecoding, mafTransferKgH, sizeof(mafTransferKgH));
|
|
|
|
memcpy(config->mafDecodingBins, mafTransferVolts, sizeof(mafTransferVolts));
|
|
|
|
for (int i = MAF_TRANSFER_SIZE;i<MAF_DECODING_COUNT;i++) {
|
|
|
|
config->mafDecodingBins[i] = config->mafDecodingBins[MAF_TRANSFER_SIZE - 1] + i * 0.01;
|
|
|
|
config->mafDecoding[i] = config->mafDecoding[MAF_TRANSFER_SIZE - 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 15:41:43 -07:00
|
|
|
void setMazdaMiataNbInjectorLag(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2021-05-09 11:37:16 -07:00
|
|
|
copyArray(engineConfiguration->injector.battLagCorr, injectorLagCorrection);
|
|
|
|
copyArray(engineConfiguration->injector.battLagCorrBins, injectorLagBins);
|
2017-04-18 19:30:14 -07:00
|
|
|
}
|
|
|
|
|
2020-05-09 21:42:33 -07:00
|
|
|
void setMazdaNB2VVTSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2021-05-09 11:37:16 -07:00
|
|
|
copyArray(config->vvtTable1RpmBins, vvt18fsioRpmBins);
|
|
|
|
copyArray(config->vvtTable1LoadBins, vvt18fsioLoadBins);
|
2021-11-14 08:04:51 -08:00
|
|
|
copyTable(config->vvtTable1, SCRIPT_TABLE_vvt_target);
|
2020-05-09 21:42:33 -07:00
|
|
|
|
|
|
|
// VVT closed loop
|
|
|
|
engineConfiguration->auxPid[0].pFactor = 2;
|
|
|
|
engineConfiguration->auxPid[0].iFactor = 0.005;
|
|
|
|
engineConfiguration->auxPid[0].dFactor = 0;
|
|
|
|
engineConfiguration->auxPid[0].offset = 33;
|
|
|
|
engineConfiguration->auxPid[0].minValue = 24;
|
|
|
|
engineConfiguration->auxPid[0].maxValue = 44;
|
|
|
|
}
|
|
|
|
|
2021-10-02 20:20:30 -07:00
|
|
|
/**
|
|
|
|
* stuff common between NA1 and NB2
|
|
|
|
*/
|
|
|
|
static void setCommonMazdaNB(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2020-05-03 09:11:47 -07:00
|
|
|
engineConfiguration->displayLogicLevelsInEngineSniffer = true;
|
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
2016-11-13 20:02:33 -08:00
|
|
|
engineConfiguration->trigger.type = TT_MIATA_VVT;
|
2020-05-03 09:11:47 -07:00
|
|
|
|
2021-10-11 21:26:35 -07:00
|
|
|
engineConfiguration->idle.solenoidFrequency = 300;
|
|
|
|
|
2021-10-13 17:56:26 -07:00
|
|
|
CONFIG(isAlternatorControlEnabled) = true;
|
|
|
|
// enable altdebug
|
|
|
|
engineConfiguration->targetVBatt = 13.8;
|
|
|
|
engineConfiguration->alternatorControl.offset = 40;
|
|
|
|
engineConfiguration->alternatorControl.pFactor = 14;
|
|
|
|
engineConfiguration->alternatorControl.iFactor = 0.1;
|
|
|
|
engineConfiguration->alternatorControl.dFactor = 0;
|
|
|
|
engineConfiguration->alternatorControl.periodMs = 10;
|
|
|
|
|
2021-10-02 20:20:30 -07:00
|
|
|
copyArray(config->veRpmBins, mazda_miata_nb2_RpmBins);
|
|
|
|
copyArray(config->veLoadBins, mazda_miata_nb2_LoadBins);
|
|
|
|
copyTable(config->veTable, mapBased18vvtVeTable_NB_fuel_rail);
|
|
|
|
|
|
|
|
copyArray(config->ignitionRpmBins, ignition18vvtRpmBins);
|
|
|
|
copyArray(config->ignitionLoadBins, ignition18vvtLoadBins);
|
|
|
|
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
|
|
|
|
copyTable(config->ignitionTable, mapBased18vvtTimingTable);
|
|
|
|
#endif
|
|
|
|
// enable cylinder_cleanup
|
|
|
|
engineConfiguration->isCylinderCleanupEnabled = true;
|
|
|
|
// set_whole_ve_map 80
|
|
|
|
setMazdaMiataNbInjectorLag(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
2021-04-21 13:21:55 -07:00
|
|
|
engineConfiguration->idleMode = IM_AUTO;
|
2021-10-11 21:02:49 -07:00
|
|
|
engineConfiguration->tachPulsePerRev = 2;
|
2021-04-21 13:21:55 -07:00
|
|
|
|
2016-11-14 20:01:47 -08:00
|
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR);
|
2020-05-08 14:31:03 -07:00
|
|
|
engineConfiguration->specs.displacement = 1.839;
|
2021-01-10 15:57:27 -08:00
|
|
|
engineConfiguration->cylinderBore = 83;
|
2020-05-08 14:31:03 -07:00
|
|
|
strcpy(CONFIG(engineMake), ENGINE_MAKE_MAZDA);
|
2019-09-02 18:55:38 -07:00
|
|
|
|
2019-10-02 18:00:10 -07:00
|
|
|
setCommonNTCSensor(&engineConfiguration->clt, 2700);
|
|
|
|
setCommonNTCSensor(&engineConfiguration->iat, 2700);
|
2020-04-26 20:03:50 -07:00
|
|
|
setMAFTransferFunction(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2019-09-02 18:55:38 -07:00
|
|
|
|
2021-04-21 12:14:48 -07:00
|
|
|
// second harmonic (aka double) is usually quieter background noise
|
|
|
|
// 13.8
|
|
|
|
engineConfiguration->knockBandCustom = 2 * HIP9011_BAND(engineConfiguration->cylinderBore);
|
|
|
|
|
2021-04-01 14:05:01 -07:00
|
|
|
// set tps_min 90
|
|
|
|
engineConfiguration->tpsMin = 100; // convert 12to10 bit (ADC/4)
|
|
|
|
// set tps_max 540
|
|
|
|
engineConfiguration->tpsMax = 650; // convert 12to10 bit (ADC/4)
|
|
|
|
|
2019-09-02 14:16:36 -07:00
|
|
|
// set idle_position 35
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->manIdlePosition = 35;
|
2019-09-02 14:16:36 -07:00
|
|
|
|
|
|
|
engineConfiguration->specs.cylindersCount = 4;
|
|
|
|
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
|
|
|
|
|
|
|
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
|
|
|
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
2021-10-02 20:20:30 -07:00
|
|
|
|
|
|
|
//set idle_offset 30
|
|
|
|
engineConfiguration->idleRpmPid.offset = 30;
|
|
|
|
engineConfiguration->idleRpmPid.pFactor = 0.07;
|
|
|
|
engineConfiguration->idleRpmPid.iFactor = 01;
|
|
|
|
engineConfiguration->idleRpmPid.dFactor = 5;
|
|
|
|
engineConfiguration->idleRpmPid.periodMs = 10;
|
|
|
|
|
|
|
|
miataNA_setCltIdleCorrBins(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
miataNA_setCltIdleRpmBins(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
miataNA_setIacCoastingBins(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setMazdaMiataEngineNB1Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setCommonMazdaNB(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
strcpy(CONFIG(engineCode), "NB1");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
strcpy(CONFIG(engineCode), "NB2");
|
|
|
|
|
|
|
|
engineConfiguration->map.sensor.type = MT_GM_3_BAR;
|
|
|
|
setEgoSensor(ES_Innovate_MTX_L PASS_CONFIG_PARAMETER_SUFFIX);
|
|
|
|
|
2019-09-02 14:16:36 -07:00
|
|
|
/**
|
|
|
|
* http://miataturbo.wikidot.com/fuel-injectors
|
|
|
|
* 01-05 (purple) - #195500-4060
|
2019-09-23 16:08:15 -07:00
|
|
|
*
|
|
|
|
* NB2 Miata has an absolute pressure fuel system - NB2 fuel rail regulator has no vacuum line.
|
|
|
|
*
|
|
|
|
* Theoretically we shall have injectorFlow(MAP) curve, practically VE gets artificially high as MAP increases and
|
|
|
|
* accounts for flow change.
|
2019-09-24 19:28:33 -07:00
|
|
|
*
|
|
|
|
* Wall wetting AE could be an argument for honest injectorFlow(MAP)
|
2019-09-02 14:16:36 -07:00
|
|
|
*/
|
|
|
|
engineConfiguration->injector.flow = 265;
|
2021-03-28 05:39:26 -07:00
|
|
|
engineConfiguration->fuelReferencePressure = 400; // 400 kPa, 58 psi
|
|
|
|
engineConfiguration->injectorCompensationMode = ICM_FixedRailPressure;
|
2019-09-02 14:16:36 -07:00
|
|
|
|
2021-07-24 20:05:22 -07:00
|
|
|
engineConfiguration->crankingIACposition = 60;
|
|
|
|
engineConfiguration->afterCrankingIACtaperDuration = 250;
|
2019-09-02 14:16:36 -07:00
|
|
|
|
2019-08-31 17:17:47 -07:00
|
|
|
|
2020-05-03 09:11:47 -07:00
|
|
|
engineConfiguration->vvtCamSensorUseRise = true;
|
2019-08-31 17:17:47 -07:00
|
|
|
// set vvt_mode 3
|
2021-02-08 18:50:31 -08:00
|
|
|
engineConfiguration->vvtMode[0] = VVT_MIATA_NB2;
|
2021-07-03 09:02:00 -07:00
|
|
|
engineConfiguration->vvtOffsets[0] = 98; // 2003 red car value
|
2019-08-31 17:17:47 -07:00
|
|
|
|
2021-10-02 20:20:30 -07:00
|
|
|
setCommonMazdaNB(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2019-08-31 17:17:47 -07:00
|
|
|
|
2020-05-09 21:42:33 -07:00
|
|
|
setMazdaNB2VVTSettings(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2019-08-31 17:17:47 -07:00
|
|
|
|
|
|
|
|
2019-09-02 18:55:38 -07:00
|
|
|
|
2020-06-15 13:47:06 -07:00
|
|
|
// CONFIG(debugTriggerSync) = GPIOD_3;
|
2020-04-10 10:32:06 -07:00
|
|
|
|
2020-04-10 10:19:54 -07:00
|
|
|
// engineConfiguration->debugMode = DBG_IDLE_CONTROL;
|
|
|
|
engineConfiguration->debugMode = DBG_TRIGGER_COUNTERS;
|
|
|
|
|
2020-08-02 07:18:14 -07:00
|
|
|
|
2019-08-31 17:17:47 -07:00
|
|
|
} // end of setMazdaMiataEngineNB2Defaults
|
|
|
|
|
2019-09-20 15:12:56 -07:00
|
|
|
// MAZDA_MIATA_2003
|
2019-08-31 17:17:47 -07:00
|
|
|
void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
|
|
|
setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
// engineConfiguration->triggerInputPins[0] = GPIOA_8; // custom Frankenso wiring in order to use SPI1 for accelerometer
|
|
|
|
engineConfiguration->triggerInputPins[0] = GPIOA_5; // board still not modified
|
|
|
|
engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
2019-08-31 17:17:47 -07:00
|
|
|
engineConfiguration->camInputs[0] = GPIOC_6;
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
// engineConfiguration->is_enabled_spi_1 = true;
|
2019-08-31 17:17:47 -07:00
|
|
|
|
|
|
|
engineConfiguration->twoWireBatchInjection = true; // this is needed for #492 testing
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->alternatorControlPin = GPIOE_10;
|
|
|
|
engineConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
|
2019-08-31 17:17:47 -07:00
|
|
|
|
2019-11-30 07:24:37 -08:00
|
|
|
// engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
2017-04-10 19:11:08 -07:00
|
|
|
|
2021-10-28 20:51:46 -07:00
|
|
|
engineConfiguration->vvtPins[0] = GPIOE_3; // VVT solenoid control
|
2016-12-11 07:01:56 -08:00
|
|
|
|
2017-10-29 12:44:22 -07:00
|
|
|
// high-side driver with +12v VP jumper
|
2020-09-09 13:52:23 -07:00
|
|
|
engineConfiguration->tachOutputPin = GPIOE_8; // tachometer
|
2016-12-11 07:01:56 -08:00
|
|
|
|
2017-02-12 10:02:00 -08:00
|
|
|
// set global_trigger_offset_angle 0
|
|
|
|
engineConfiguration->globalTriggerAngleOffset = 0;
|
2016-11-23 20:02:35 -08:00
|
|
|
|
2016-11-17 20:02:17 -08:00
|
|
|
// enable trigger_details
|
2019-06-24 23:25:26 -07:00
|
|
|
engineConfiguration->verboseTriggerSynchDetails = false;
|
2016-11-12 21:01:42 -08:00
|
|
|
|
2017-02-12 15:02:01 -08:00
|
|
|
// set cranking_timing_angle 10
|
|
|
|
engineConfiguration->crankingTimingAngle = 10;
|
|
|
|
// set cranking_fuel 4
|
2020-11-03 11:12:26 -08:00
|
|
|
engineConfiguration->cranking.baseFuel = 27; // this value for return-less NB miata fuel system, higher pressure
|
2016-11-23 19:03:11 -08:00
|
|
|
|
2018-11-11 11:05:03 -08:00
|
|
|
/**
|
|
|
|
* Saab attempt
|
2018-11-11 16:57:25 -08:00
|
|
|
* Saab coil on #1 PD8 extra blue wire
|
|
|
|
* Miata coil on #2 PC9 - orange ECU wire "2&3"
|
|
|
|
* Saab coil on #3 PD9 extra white wire
|
|
|
|
* Miata coil on #4 PE14 - white ECU wire "1&4"
|
2018-11-11 11:05:03 -08:00
|
|
|
*/
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->ignitionPins[0] = GPIOE_14;
|
|
|
|
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->ignitionPins[2] = GPIOC_9;
|
|
|
|
engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
|
2016-11-23 19:03:11 -08:00
|
|
|
|
2016-12-26 20:02:07 -08:00
|
|
|
|
2016-12-15 20:02:59 -08:00
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->malfunctionIndicatorPin = GPIOD_5;
|
2017-04-25 20:55:50 -07:00
|
|
|
|
2016-12-27 20:03:42 -08:00
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
// engineConfiguration->malfunctionIndicatorPin = GPIOD_9;
|
|
|
|
// engineConfiguration->malfunctionIndicatorPinMode = OM_INVERTED;
|
2016-12-28 19:01:57 -08:00
|
|
|
|
2018-01-17 18:56:43 -08:00
|
|
|
// todo: blue jumper wire - what is it?!
|
2018-01-17 17:52:46 -08:00
|
|
|
// Frankenso analog #6 pin 3R, W56 (5th lower row pin from the end) top <> W45 bottom jumper, not OEM
|
2018-01-17 18:56:43 -08:00
|
|
|
|
|
|
|
|
2019-08-06 14:12:15 -07:00
|
|
|
// see setFrankensoConfiguration
|
2018-01-17 18:56:43 -08:00
|
|
|
// map.sensor.hwChannel = EFI_ADC_0; W53
|
|
|
|
|
2017-01-22 21:06:44 -08:00
|
|
|
/**
|
|
|
|
* PA4 Wideband O2 Sensor
|
|
|
|
*/
|
2018-01-17 17:52:46 -08:00
|
|
|
// todo: re-wire the board to use "Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM"
|
|
|
|
//engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
|
2017-01-22 21:06:44 -08:00
|
|
|
engineConfiguration->afr.hwChannel = EFI_ADC_4;
|
|
|
|
|
2017-04-27 10:06:54 -07:00
|
|
|
//
|
|
|
|
/**
|
|
|
|
* Combined RPM, CLT and VBATT warning light
|
|
|
|
*
|
|
|
|
* to test
|
|
|
|
* set_fsio_setting 2 1800
|
2017-04-27 19:16:35 -07:00
|
|
|
* set_fsio_setting 3 65
|
|
|
|
* set_fsio_setting 4 15
|
2017-04-27 10:06:54 -07:00
|
|
|
*/
|
2021-11-13 19:47:30 -08:00
|
|
|
engineConfiguration->scriptSetting[1] = 6500; // #2 RPM threshold
|
|
|
|
engineConfiguration->scriptSetting[2] = 105; // #3 CLT threshold
|
|
|
|
engineConfiguration->scriptSetting[3] = 12.0; // #4 voltage threshold
|
2017-04-27 10:06:54 -07:00
|
|
|
|
2019-05-03 15:41:43 -07:00
|
|
|
// setFsio(1, GPIOE_6, COMBINED_WARNING_LIGHT PASS_CONFIG_PARAMETER_SUFFIX);
|
2017-04-27 10:06:54 -07:00
|
|
|
|
2017-05-22 20:25:34 -07:00
|
|
|
// enable auto_idle
|
|
|
|
// enable verbose_idle
|
|
|
|
engineConfiguration->isVerboseIAC = false;
|
2017-05-25 16:48:00 -07:00
|
|
|
// set idle_p 0.05
|
2017-05-22 20:25:34 -07:00
|
|
|
// set idle_i 0
|
|
|
|
// set idle_d 0
|
|
|
|
// set debug_mode 3
|
|
|
|
// set idle_rpm 1700
|
2017-07-23 17:09:35 -07:00
|
|
|
// see setDefaultIdleParameters
|
2017-05-22 20:25:34 -07:00
|
|
|
|
2019-09-21 18:36:53 -07:00
|
|
|
engineConfiguration->adcVcc = 3.3f;
|
2020-04-26 16:16:54 -07:00
|
|
|
engineConfiguration->vbattDividerCoeff = 8.80f;
|
|
|
|
|
2019-09-23 19:56:06 -07:00
|
|
|
// by the way NB2 MAF internal diameter is about 2.5 inches / 63mm
|
2019-09-21 18:36:53 -07:00
|
|
|
// 1K pull-down to read current from this MAF
|
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_6; // PA6 W46 <> W46
|
|
|
|
|
|
|
|
engineConfiguration->throttlePedalUpVoltage = 0.65f;
|
|
|
|
|
|
|
|
|
2019-12-15 20:21:38 -08:00
|
|
|
// TLE7209 two-wire ETB control
|
2019-09-20 22:21:53 -07:00
|
|
|
// PWM
|
2019-12-15 20:21:38 -08:00
|
|
|
CONFIG(etb_use_two_wires) = true;
|
|
|
|
|
2021-06-05 13:19:01 -07:00
|
|
|
engineConfiguration->etbIo[0].controlPin = GPIO_UNASSIGNED;
|
2019-12-15 20:21:38 -08:00
|
|
|
|
2019-09-20 22:21:53 -07:00
|
|
|
//
|
2019-12-15 20:21:38 -08:00
|
|
|
engineConfiguration->etbIo[0].directionPin1 = GPIOE_12; // orange
|
2019-09-20 22:21:53 -07:00
|
|
|
//
|
2019-12-15 20:21:38 -08:00
|
|
|
engineConfiguration->etbIo[0].directionPin2 = GPIOC_7; // white/blue
|
2019-09-20 22:21:53 -07:00
|
|
|
|
|
|
|
// set_analog_input_pin tps PC3
|
2019-12-15 20:21:38 -08:00
|
|
|
engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; // PC3 blue
|
2019-09-20 22:21:53 -07:00
|
|
|
|
|
|
|
// set_analog_input_pin pps PA2
|
2019-12-25 12:58:54 -08:00
|
|
|
/* a step back - Frankenso does not use ETB
|
2019-09-20 22:21:53 -07:00
|
|
|
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_2;
|
2019-12-25 12:58:54 -08:00
|
|
|
*/
|
2019-09-20 22:21:53 -07:00
|
|
|
|
|
|
|
engineConfiguration->idleRpmPid.offset = 0;
|
|
|
|
engineConfiguration->idleRpmPid.pFactor = 0.2;
|
2021-05-09 11:37:16 -07:00
|
|
|
engineConfiguration->idleRpmPid.iFactor = 01;
|
2019-09-20 22:21:53 -07:00
|
|
|
engineConfiguration->idleRpmPid.dFactor = 5;
|
|
|
|
engineConfiguration->idleRpmPid.periodMs = 10;
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
2019-09-20 22:21:53 -07:00
|
|
|
|
|
|
|
//set etb_p 12
|
|
|
|
engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE?
|
|
|
|
engineConfiguration->etb.iFactor = 0;
|
|
|
|
engineConfiguration->etb.dFactor = 0;
|
|
|
|
engineConfiguration->etb.offset = 0;
|
2019-09-29 11:56:18 -07:00
|
|
|
engineConfiguration->etb.minValue = -60;
|
|
|
|
engineConfiguration->etb.maxValue = 50;
|
2019-09-20 22:21:53 -07:00
|
|
|
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[0] = 2.8; // base cranking fuel adjustment coefficient
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[0] = -20; // temperature in C
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[1] = 2.2;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[1] = -10;
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[2] = 1.8;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[2] = 5;
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[3] = 1.5;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[3] = 30;
|
|
|
|
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[4] = 1.0;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[4] = 35;
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[5] = 1.0;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[5] = 50;
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[6] = 1.0;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[6] = 65;
|
2020-11-03 11:12:26 -08:00
|
|
|
config->crankingFuelCoef[7] = 1.0;
|
2019-09-25 21:02:47 -07:00
|
|
|
config->crankingFuelBins[7] = 90;
|
2016-10-04 11:00:58 -07:00
|
|
|
}
|
2016-10-04 10:03:25 -07:00
|
|
|
|
2018-01-17 17:52:46 -08:00
|
|
|
/**
|
|
|
|
* red car setting with default 1991/1995 miata harness
|
2019-08-31 15:36:44 -07:00
|
|
|
* board #70 - closer to default miata NA6 harness
|
2018-01-17 17:52:46 -08:00
|
|
|
*
|
|
|
|
*/
|
2019-05-03 15:41:43 -07:00
|
|
|
void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setMazdaMiata2003EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2017-12-02 17:59:31 -08:00
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->ignitionPins[2] = GPIOC_7;
|
2018-01-17 17:52:46 -08:00
|
|
|
|
2018-01-17 18:56:43 -08:00
|
|
|
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM. Make sure 500K pull-down on Frankenso
|
2018-01-17 17:52:46 -08:00
|
|
|
engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
|
|
|
|
|
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_4; // PA4 - W47 top <>W47
|
2017-12-02 17:59:31 -08:00
|
|
|
}
|
2019-08-31 15:36:44 -07:00
|
|
|
|
2019-12-15 19:21:49 -08:00
|
|
|
static void setMiataNB2_MRE_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2019-10-31 13:06:34 -07:00
|
|
|
#if (BOARD_TLE8888_COUNT > 0)
|
2019-09-02 14:16:36 -07:00
|
|
|
setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
2019-09-02 08:07:34 -07:00
|
|
|
// MRE has a special main relay control low side pin - rusEfi firmware is totally not involved with main relay control
|
2019-09-05 20:14:28 -07:00
|
|
|
//
|
|
|
|
// fuelPumpPin output is inherited from boards/microrusefi/board_configuration.cpp
|
|
|
|
// fanPin output is inherited from boards/microrusefi/board_configuration.cpp
|
|
|
|
//
|
2019-09-02 09:34:17 -07:00
|
|
|
// crank trigger input is inherited from boards/microrusefi/board_configuration.cpp
|
2019-09-02 14:16:36 -07:00
|
|
|
// map.sensor.hwChannel input is inherited from boards/microrusefi/board_configuration.cpp
|
|
|
|
// tps1_1AdcChannel input is inherited from boards/microrusefi/board_configuration.cpp
|
|
|
|
// afr.hwChannel input is inherited from boards/microrusefi/board_configuration.cpp
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
|
2019-09-02 09:34:17 -07:00
|
|
|
|
|
|
|
engineConfiguration->camInputs[0] = GPIOA_5;
|
2020-04-23 13:57:37 -07:00
|
|
|
/**
|
|
|
|
* By default "auto detection mode for VR sensor signals" is used
|
|
|
|
* We know that for short & strange Hall (?) signals like Miata NB2 crank sensor this does not work well above certain RPM.
|
|
|
|
*/
|
|
|
|
engineConfiguration->tle8888mode = TL_MANUAL;
|
2019-09-02 09:34:17 -07:00
|
|
|
|
2019-09-02 14:16:36 -07:00
|
|
|
// GPIOD_6: "13 - GP Out 6" - selected to +12v
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->alternatorControlPin = GPIOD_6;
|
2019-09-02 14:16:36 -07:00
|
|
|
// GPIOD_7: "14 - GP Out 5" - selected to +12v
|
2020-09-09 13:52:23 -07:00
|
|
|
engineConfiguration->tachOutputPin = GPIOD_7; // tachometer
|
2020-10-05 21:56:49 -07:00
|
|
|
CONFIG(tachPulsePerRev) = 2;
|
2019-09-02 14:16:36 -07:00
|
|
|
|
2020-10-05 22:15:17 -07:00
|
|
|
CONFIG(isSdCardEnabled) = true;
|
|
|
|
|
2019-09-06 14:38:05 -07:00
|
|
|
engineConfiguration->ignitionDwellForCrankingMs = 8;
|
|
|
|
|
2021-07-03 09:02:00 -07:00
|
|
|
engineConfiguration->vvtOffsets[0] = 97;
|
2019-09-06 14:38:05 -07:00
|
|
|
|
2019-08-31 15:36:44 -07:00
|
|
|
|
2019-09-05 20:14:28 -07:00
|
|
|
// # TLE8888 high current low side: VVT1 IN10 / OUT6
|
2020-12-17 16:03:38 -08:00
|
|
|
// TLE8888_PIN_6: "7 - Lowside 1"
|
2021-10-28 20:51:46 -07:00
|
|
|
engineConfiguration->vvtPins[0] = TLE8888_PIN_6; // VVT solenoid control
|
2019-09-05 20:14:28 -07:00
|
|
|
|
|
|
|
// TLE8888_PIN_23: "33 - GP Out 3"
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->malfunctionIndicatorPin = TLE8888_PIN_23;
|
2019-09-05 20:14:28 -07:00
|
|
|
|
2020-02-27 18:28:31 -08:00
|
|
|
|
|
|
|
// todo: alternator warn
|
2020-02-29 20:15:04 -08:00
|
|
|
// ?
|
|
|
|
|
2020-02-27 18:28:31 -08:00
|
|
|
// todo: AC fan
|
2020-02-29 20:15:04 -08:00
|
|
|
// TLE8888_PIN_24: "43 - GP Out 4"
|
2020-02-27 18:28:31 -08:00
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
2019-09-04 17:38:09 -07:00
|
|
|
|
2019-08-31 17:17:47 -07:00
|
|
|
// set_analog_input_pin pps PA7
|
|
|
|
// EFI_ADC_7: "31 - AN volt 3" - PA7
|
2020-12-17 16:03:38 -08:00
|
|
|
// disabled for now since only allowed with ETB
|
|
|
|
// engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
|
2019-08-31 17:17:47 -07:00
|
|
|
|
|
|
|
// set tps_min 90
|
2019-09-01 16:37:58 -07:00
|
|
|
engineConfiguration->tpsMin = 90;
|
2019-08-31 17:17:47 -07:00
|
|
|
|
|
|
|
// set tps_max 540
|
|
|
|
engineConfiguration->tpsMax = 870;
|
|
|
|
|
2020-05-22 10:24:04 -07:00
|
|
|
// 0.3#4 has wrong R139? TODO: fix that custom board to match proper value!!!
|
|
|
|
// set vbatt_divider 10.956
|
|
|
|
// 56k high side/10k low side multiplied by analogInputDividerCoefficient
|
|
|
|
// vbattDividerCoeff = 10.956 (66.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
|
2019-10-31 13:06:34 -07:00
|
|
|
#endif /* BOARD_TLE8888_COUNT */
|
2019-08-31 15:36:44 -07:00
|
|
|
}
|
2019-12-15 19:21:49 -08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pretty much OEM 2003 Miata with ETB
|
|
|
|
* set engine_type 13
|
|
|
|
*/
|
|
|
|
void setMiataNB2_MRE_ETB(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setMiataNB2_MRE_common(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
2020-04-19 21:23:32 -07:00
|
|
|
CONFIG(useETBforIdleControl) = true;
|
|
|
|
|
2019-12-15 20:33:15 -08:00
|
|
|
#if EFI_FSIO
|
2019-12-15 19:21:49 -08:00
|
|
|
// enable ETB
|
|
|
|
// set_rpn_expression 8 "0"
|
2021-11-14 04:24:50 -08:00
|
|
|
// todo lua ETB setFsio(7, GPIOC_8, "0" PASS_CONFIG_PARAMETER_SUFFIX);
|
2019-12-15 20:33:15 -08:00
|
|
|
#endif /* EFI_FSIO */
|
2019-12-15 19:21:49 -08:00
|
|
|
|
|
|
|
//set idle_offset 0
|
|
|
|
engineConfiguration->idleRpmPid.offset = 0;
|
|
|
|
engineConfiguration->idleRpmPid.pFactor = 0.2;
|
2021-05-09 11:37:16 -07:00
|
|
|
engineConfiguration->idleRpmPid.iFactor = 01;
|
2019-12-15 19:21:49 -08:00
|
|
|
engineConfiguration->idleRpmPid.dFactor = 5;
|
|
|
|
engineConfiguration->idleRpmPid.periodMs = 10;
|
|
|
|
|
|
|
|
CONFIG(useETBforIdleControl) = true;
|
|
|
|
engineConfiguration->throttlePedalUpVoltage = 1;
|
|
|
|
// WAT? that's an interesting value, how come it's above 5v?
|
|
|
|
engineConfiguration->throttlePedalWOTVoltage = 5.47;
|
|
|
|
|
|
|
|
engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE?
|
|
|
|
engineConfiguration->etb.iFactor = 0;
|
|
|
|
engineConfiguration->etb.dFactor = 0;
|
|
|
|
engineConfiguration->etb.offset = 0;
|
|
|
|
}
|
|
|
|
|
2019-12-25 12:58:54 -08:00
|
|
|
/**
|
2020-05-21 17:44:14 -07:00
|
|
|
* Normal mechanical throttle body
|
2019-12-25 12:58:54 -08:00
|
|
|
* set engine_type 11
|
|
|
|
*/
|
2020-05-21 17:44:14 -07:00
|
|
|
void setMiataNB2_MRE_MAP(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2019-12-15 19:21:49 -08:00
|
|
|
setMiataNB2_MRE_common(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
2020-05-03 12:21:32 -07:00
|
|
|
// somehow MRE72 adapter 0.2 has TPS routed to pin 26?
|
2020-05-12 20:37:30 -07:00
|
|
|
engineConfiguration->tps1_1AdcChannel = EFI_ADC_6; // PA6
|
2020-05-03 12:21:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
// 1K pull-down to read current from this MAF
|
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_13; // J30 AV5
|
2020-05-21 17:44:14 -07:00
|
|
|
}
|
2020-05-03 12:21:32 -07:00
|
|
|
|
2020-05-21 17:44:14 -07:00
|
|
|
void setMiataNB2_MRE_MAF(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setMiataNB2_MRE_MAP(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2020-05-21 18:00:34 -07:00
|
|
|
|
|
|
|
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
2019-12-15 19:21:49 -08:00
|
|
|
}
|
2020-10-27 22:23:05 -07:00
|
|
|
|
2020-11-03 17:17:47 -08:00
|
|
|
/**
|
|
|
|
* https://github.com/rusefi/rusefi/wiki/HOWTO-TCU-A42DE-on-Proteus
|
|
|
|
*/
|
2020-12-17 14:12:24 -08:00
|
|
|
#if HW_PROTEUS
|
2020-10-27 22:23:05 -07:00
|
|
|
void setMiataNB2_Proteus_TCU(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2020-11-03 20:21:47 -08:00
|
|
|
engineConfiguration->tcuEnabled = true;
|
|
|
|
|
2020-11-04 09:42:30 -08:00
|
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
|
|
|
engineConfiguration->trigger.customTotalToothCount = 10;
|
|
|
|
engineConfiguration->trigger.customSkippedToothCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// "VR 1"
|
|
|
|
engineConfiguration->triggerInputPins[0] = GPIOE_7;
|
|
|
|
|
|
|
|
engineConfiguration->vehicleSpeedCoef = 1;
|
|
|
|
// "VR 2"
|
|
|
|
engineConfiguration->vehicleSpeedSensorInputPin = GPIOE_8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-03 20:21:47 -08:00
|
|
|
// "Highside 2"
|
|
|
|
engineConfiguration->tcu_solenoid[0] = GPIOA_8;
|
|
|
|
// "Highside 1"
|
|
|
|
engineConfiguration->tcu_solenoid[1] = GPIOA_9;
|
|
|
|
|
2020-11-03 20:59:00 -08:00
|
|
|
// "Digital 1" green
|
2020-11-03 17:17:47 -08:00
|
|
|
engineConfiguration->tcuUpshiftButtonPin = GPIOC_6;
|
2020-11-06 21:35:56 -08:00
|
|
|
CONFIG(tcuUpshiftButtonPinMode) = PI_PULLUP;
|
2020-11-03 20:59:00 -08:00
|
|
|
// "Digital 6" white
|
2020-11-03 17:17:47 -08:00
|
|
|
engineConfiguration->tcuDownshiftButtonPin = GPIOE_15;
|
2020-11-06 21:35:56 -08:00
|
|
|
CONFIG(tcuDownshiftButtonPinMode) = PI_PULLUP;
|
2020-11-03 19:18:40 -08:00
|
|
|
|
|
|
|
// R
|
|
|
|
config->tcuSolenoidTable[0][0] = 1;
|
|
|
|
config->tcuSolenoidTable[0][1] = 0;
|
|
|
|
// P/N
|
|
|
|
config->tcuSolenoidTable[1][0] = 1;
|
|
|
|
config->tcuSolenoidTable[1][1] = 0;
|
|
|
|
// 1
|
|
|
|
config->tcuSolenoidTable[2][0] = 1;
|
|
|
|
config->tcuSolenoidTable[2][1] = 0;
|
|
|
|
// 2
|
|
|
|
config->tcuSolenoidTable[3][0] = 1;
|
|
|
|
config->tcuSolenoidTable[3][1] = 1;
|
|
|
|
// 3
|
|
|
|
config->tcuSolenoidTable[4][0] = 0;
|
|
|
|
config->tcuSolenoidTable[4][1] = 1;
|
|
|
|
// 4
|
|
|
|
config->tcuSolenoidTable[5][0] = 0;
|
|
|
|
config->tcuSolenoidTable[5][1] = 0;
|
|
|
|
|
2020-10-27 22:23:05 -07:00
|
|
|
}
|
|
|
|
|
2020-12-26 08:42:09 -08:00
|
|
|
/**
|
|
|
|
* https://github.com/rusefi/rusefi/wiki/HOWTO-Miata-NB2-on-Proteus
|
|
|
|
*/
|
2020-12-14 21:09:35 -08:00
|
|
|
void setMiataNB2_ProteusEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2020-12-18 12:53:57 -08:00
|
|
|
setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
2021-01-01 15:19:52 -08:00
|
|
|
engineConfiguration->triggerInputPins[0] = GPIOC_6; // pin 10/black23
|
2020-12-18 12:53:57 -08:00
|
|
|
engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
2021-01-01 15:19:52 -08:00
|
|
|
engineConfiguration->camInputs[0] = GPIOE_11; // pin 1/black23
|
2020-12-18 12:53:57 -08:00
|
|
|
|
2021-01-01 15:19:52 -08:00
|
|
|
engineConfiguration->alternatorControlPin = GPIOA_8; // "Highside 2" # pin 1/black35
|
2020-12-18 12:53:57 -08:00
|
|
|
|
2021-10-28 20:51:46 -07:00
|
|
|
engineConfiguration->vvtPins[0] = GPIOB_5; // VVT solenoid control # pin 8/black35
|
2020-12-18 12:53:57 -08:00
|
|
|
|
|
|
|
// high-side driver with +12v VP jumper
|
|
|
|
engineConfiguration->tachOutputPin = GPIOA_9; // tachometer
|
|
|
|
engineConfiguration->tachPulsePerRev = 2;
|
|
|
|
|
|
|
|
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
|
|
|
|
2021-10-02 21:27:55 -07:00
|
|
|
#if EFI_PROD_CODE
|
2021-10-28 19:11:26 -07:00
|
|
|
engineConfiguration->ignitionPins[0] = PROTEUS_IGN_1;
|
2020-12-18 12:53:57 -08:00
|
|
|
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
2021-10-28 19:11:26 -07:00
|
|
|
engineConfiguration->ignitionPins[2] = PROTEUS_IGN_3;
|
2020-12-18 12:53:57 -08:00
|
|
|
engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
|
|
|
|
|
|
|
|
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
|
|
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
|
|
|
|
|
|
|
|
2021-10-02 20:56:43 -07:00
|
|
|
engineConfiguration->injectionPins[0] = PROTEUS_LS_1; // BLU # pin 3/black35
|
|
|
|
engineConfiguration->injectionPins[1] = PROTEUS_LS_2; // BLK
|
|
|
|
engineConfiguration->injectionPins[2] = PROTEUS_LS_3; // GRN
|
|
|
|
engineConfiguration->injectionPins[3] = PROTEUS_LS_4; // WHT
|
2020-12-18 12:53:57 -08:00
|
|
|
engineConfiguration->injectionPinMode = OM_DEFAULT;
|
|
|
|
|
|
|
|
|
2021-01-03 14:58:00 -08:00
|
|
|
CONFIG(enableSoftwareKnock) = true;
|
|
|
|
|
2021-10-02 20:56:43 -07:00
|
|
|
engineConfiguration->malfunctionIndicatorPin = PROTEUS_LS_10;
|
2020-12-18 12:53:57 -08:00
|
|
|
|
2021-10-25 17:51:07 -07:00
|
|
|
engineConfiguration->map.sensor.hwChannel = PROTEUS_IN_MAP;
|
|
|
|
|
2020-12-18 12:53:57 -08:00
|
|
|
|
|
|
|
engineConfiguration->afr.hwChannel = EFI_ADC_11;
|
|
|
|
|
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_13; // PA6 W46 <> W46
|
|
|
|
|
|
|
|
engineConfiguration->tps1_1AdcChannel = EFI_ADC_12;
|
|
|
|
|
|
|
|
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
|
|
|
|
2021-10-25 17:51:07 -07:00
|
|
|
engineConfiguration->clt.adcChannel = PROTEUS_IN_ANALOG_TEMP_1;
|
|
|
|
engineConfiguration->iat.adcChannel = PROTEUS_IN_ANALOG_TEMP_3;
|
2020-12-18 12:53:57 -08:00
|
|
|
|
2021-10-25 17:51:07 -07:00
|
|
|
engineConfiguration->fuelPumpPin = PROTEUS_LS_6;
|
2020-12-18 12:53:57 -08:00
|
|
|
|
2021-10-25 17:51:07 -07:00
|
|
|
engineConfiguration->idle.solenoidPin = PROTEUS_LS_7;
|
2020-12-18 12:53:57 -08:00
|
|
|
|
|
|
|
|
|
|
|
engineConfiguration->fanPin = GPIOB_7;
|
|
|
|
|
2021-10-25 17:51:07 -07:00
|
|
|
CONFIG(mainRelayPin) = GPIOG_12;
|
|
|
|
#endif // EFI_PROD_CODE
|
2021-01-03 14:58:00 -08:00
|
|
|
|
2020-12-14 21:09:35 -08:00
|
|
|
|
|
|
|
}
|
2020-12-17 14:12:24 -08:00
|
|
|
#endif // HW_PROTEUS
|
2021-01-21 23:02:16 -08:00
|
|
|
|
|
|
|
#if HW_HELLEN
|
2021-10-02 20:20:30 -07:00
|
|
|
void setHellenNB1(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setMazdaMiataEngineNB1Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-10-11 21:02:49 -07:00
|
|
|
|
|
|
|
engineConfiguration->injector.flow = 256;
|
2021-10-02 20:20:30 -07:00
|
|
|
}
|
|
|
|
|
2021-01-21 23:02:16 -08:00
|
|
|
void setMiataNB2_Hellen72(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2021-01-21 23:09:28 -08:00
|
|
|
setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-01-21 23:02:16 -08:00
|
|
|
strcpy(CONFIG(vehicleName), "H72 test");
|
2021-04-21 12:14:48 -07:00
|
|
|
|
2021-07-24 08:56:29 -07:00
|
|
|
|
|
|
|
// set tps_min 90
|
|
|
|
engineConfiguration->tpsMin = 110; // convert 12to10 bit (ADC/4)
|
|
|
|
|
2021-01-21 23:02:16 -08:00
|
|
|
}
|
2021-08-09 23:34:59 -07:00
|
|
|
|
|
|
|
void setMiataNB2_Hellen72_36(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setMiataNB2_Hellen72(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
|
|
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;
|
|
|
|
engineConfiguration->globalTriggerAngleOffset = 76;
|
|
|
|
}
|
|
|
|
|
2021-01-21 23:02:16 -08:00
|
|
|
#endif // HW_HELLEN
|