From d47469a5625fde7938a310a5cd975dfd6861c026 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 9 Jul 2016 19:03:08 -0400 Subject: [PATCH] auto-sync --- firmware/config/engines/engines.mk | 1 + firmware/config/engines/honda_600.cpp | 172 ++++++++++++++++++ firmware/config/engines/honda_600.h | 14 ++ .../controllers/algo/auto_generated_enums.cpp | 2 + .../controllers/algo/engine_configuration.cpp | 4 + firmware/controllers/algo/rusefi_enums.h | 4 +- firmware/iar/ch.ewp | 6 + 7 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 firmware/config/engines/honda_600.cpp create mode 100644 firmware/config/engines/honda_600.h diff --git a/firmware/config/engines/engines.mk b/firmware/config/engines/engines.mk index b96cc02159..7c3f537596 100644 --- a/firmware/config/engines/engines.mk +++ b/firmware/config/engines/engines.mk @@ -38,5 +38,6 @@ ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \ $(PROJECT_DIR)/config/engines/lada_kalina.cpp \ $(PROJECT_DIR)/config/engines/geo_storm.cpp \ $(PROJECT_DIR)/config/engines/zil130.cpp \ + $(PROJECT_DIR)/config/engines/honda_600.cpp \ $(PROJECT_DIR)/config/engines/ford_festiva.cpp \ No newline at end of file diff --git a/firmware/config/engines/honda_600.cpp b/firmware/config/engines/honda_600.cpp new file mode 100644 index 0000000000..1ba3776754 --- /dev/null +++ b/firmware/config/engines/honda_600.cpp @@ -0,0 +1,172 @@ +/* + * @file honda_600.cpp + * + * set_engine_type 43 + * + * @date Jul 9, 2016 + * @author Andrey Belomutskiy, (c) 2012-2016 + */ + +#include "engine_template.h" +#include "honda_600.h" +#include "allsensors.h" +#include "engine_math.h" +#include "custom_engine.h" + +#if EFI_PROD_CODE +#include "can_hw.h" +#endif +static const fuel_table_t default_custom_fuel_table = { + {1.8, 1.8, 1.65, 1.65, 1.65, 1.65, 1.5, 1.5, 2.025, 1.5, 1.5, 1.5, 1.5}, + {1.8, 1.8, 1.65, 1.65, 1.65, 1.65, 1.5, 1.5, 2.025, 1.5, 1.5, 1.5, 1.5}, + {1.95, 1.95, 1.95, 1.8, 2.1, 2.25, 2.34, 2.25, 2.7, 2.7, 2.7, 2.7, 2.7}, + {2.55, 2.55, 2.55, 2.55, 2.55, 2.55, 2.55, 2.55, 2.4, 2.55, 3, 3, 2.7}, + {3, 3, 3, 3, 3, 3.3, 3.3, 3.45, 3, 3.3, 3.6, 3.6, 3.3}, + {3, 3, 3, 3, 3, 3, 3.6, 4.305, 3.6, 3.6, 3.9, 3.9, 3.3}, + {3, 3, 3, 3, 3, 3, 3.6, 3.75 , 3.9, 3.9, 4.2, 4.2, 3.9}, + {3, 3, 3, 3, 3, 3, 3.6, 3.9, 4.2, 4.5, 4.5, 4.5, 4.5}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} +}; + +static const ignition_table_t default_custom_timing_table = { + /* RPM 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 5500 6000 6500 7000 */ + /* Load 0% */{ 10, 10, 10, 12, 12, 12, 12, 15, 15, 15, 15, 26, 28, 30, 32}, + /* Load 10% */{ 10, 10, 10, 12, 12, 12, 12, 15, 15, 15, 15, 26, 28, 30, 32}, + /* Load 20% */{ 10, 10, 10, 10, 10, 10, 12, 15, 20, 22, 24, 26, 28, 30, 32}, + /* Load 30% */{ 10, 10, 10, 10, 10, 10, 12, 15, 20, 22, 24, 26, 28, 30, 32}, + /* Load 40% */{ 10, 10, 10, 10, 10, 10, 12, 15, 20, 22, 24, 26, 28, 30, 32}, + /* Load 50% */{ 10, 10, 10, 10, 10, 10, 12, 15, 20, 22, 24, 26, 28, 30, 32}, + /* Load 60% */{ 10, 10, 10, 10, 10, 10, 15, 18, 20, 22, 24, 26, 28, 30, 32}, + /* Load 70% */{ 10, 10, 10, 10, 10, 10, 15, 18, 20, 22, 24, 26, 28, 30, 32}, + /* Load 80% */{ 10, 10, 10, 10, 10, 10, 15, 18, 20, 22, 24, 26, 28, 30, 32}, + /* Load 90% */{ 10, 10, 10, 10, 10, 10, 15, 18, 20, 22, 24, 26, 28, 30, 32}, + /* Load 100% */{ 10, 10, 10, 10, 10, 10, 15, 18, 20, 22, 24, 26, 28, 30, 32}, +}; + +EXTERN_ENGINE; + +static void setDefaultCustomMaps(DECLARE_ENGINE_PARAMETER_F) { + + setFuelLoadBin(0,100 PASS_ENGINE_PARAMETER); + setFuelRpmBin(0, 7000 PASS_ENGINE_PARAMETER); + setTimingLoadBin(0,100 PASS_ENGINE_PARAMETER); + setTimingRpmBin(0,7000 PASS_ENGINE_PARAMETER); + + copyFuelTable(default_custom_fuel_table, config->fuelTable); + copyFuelTable(default_custom_fuel_table, config->veTable); + copyTimingTable(default_custom_timing_table, config->ignitionTable); +} + +void setHonda600(DECLARE_ENGINE_PARAMETER_F) { + engineConfiguration->trigger.type = TT_HONDA_CBR_600_CUSTOM; + engineConfiguration->algorithm = LM_ALPHA_N; + + // upside down wiring + boardConfiguration->triggerInputPins[0] = GPIOA_5; + boardConfiguration->triggerInputPins[1] = GPIOC_6; + + + // set_global_trigger_offset_angle 180 + // set_global_trigger_offset_angle 540 + engineConfiguration->globalTriggerAngleOffset = 540; + + engineConfiguration->isFuelPumpEnabled = true; + engineConfiguration->specs.cylindersCount = 4; + engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; + engineConfiguration->injectionMode = IM_SEQUENTIAL; + engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2; + engineConfiguration->injectionOffset = 320; + engineConfiguration->cranking.rpm = 800; +// engineConfiguration->ignitionMode = IM_WASTED_SPARK; //IM_INDIVIDUAL_COILS; + + engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; + + + //setIndividualCoilsIgnition(); + + setFrankenso_01_LCD(boardConfiguration); + commonFrankensoAnalogInputs(engineConfiguration); + setFrankenso0_1_joystick(engineConfiguration); + setMap(config->injectionPhase, 320); + /** + * Frankenso analog #1 PC2 ADC12 CLT + * Frankenso analog #2 PC1 ADC11 IAT + * Frankenso analog #3 PA0 ADC0 MAP + * Frankenso analog #4 PC3 ADC13 WBO / O2 + * Frankenso analog #5 PA2 ADC2 TPS + * Frankenso analog #6 PA1 ADC1 + * Frankenso analog #7 PA4 ADC4 + * Frankenso analog #8 PA3 ADC3 + * Frankenso analog #9 PA7 ADC7 + * Frankenso analog #10 PA6 ADC6 + * Frankenso analog #11 PC5 ADC15 + * Frankenso analog #12 PC4 ADC14 VBatt + */ + engineConfiguration->tpsAdcChannel = EFI_ADC_2; + + engineConfiguration->map.sensor.hwChannel = EFI_ADC_0; + + engineConfiguration->clt.adcChannel = EFI_ADC_12; + engineConfiguration->iat.adcChannel = EFI_ADC_11; + engineConfiguration->afr.hwChannel = EFI_ADC_13; + + setCommonNTCSensor(&engineConfiguration->clt); + engineConfiguration->clt.config.bias_resistor = 2700; + setCommonNTCSensor(&engineConfiguration->iat); + engineConfiguration->iat.config.bias_resistor = 2700; + + + /** + * http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board + */ + // Frankenso low out #1: PE6 + // Frankenso low out #2: PE5 + // Frankenso low out #3: PD7 Main Relay + // Frankenso low out #4: PC13 Idle valve solenoid + // Frankenso low out #5: PE3 + // Frankenso low out #6: PE4 fuel pump relay + // Frankenso low out #7: PE1 (do not use with discovery!) + // Frankenso low out #8: PE2 injector #2 + // Frankenso low out #9: PB9 injector #1 + // Frankenso low out #10: PE0 (do not use with discovery!) + // Frankenso low out #11: PB8 injector #3 + // Frankenso low out #12: PB7 injector #4 + + boardConfiguration->fuelPumpPin = GPIOE_4; + boardConfiguration->mainRelayPin = GPIOD_7; + boardConfiguration->idle.solenoidPin = GPIOC_13; + + boardConfiguration->fanPin = GPIOE_5; + + boardConfiguration->injectionPins[0] = GPIOB_9; // #1 + boardConfiguration->injectionPins[1] = GPIOD_5; // #2 + boardConfiguration->injectionPins[2] = GPIOB_7; // #3 + boardConfiguration->injectionPins[3] = GPIOB_8; // #4 + + setDefaultCustomMaps(PASS_ENGINE_PARAMETER_F); + setAlgorithm(LM_ALPHA_N PASS_ENGINE_PARAMETER); + + boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[7] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED; + + boardConfiguration->ignitionPins[0] = GPIOE_14; + boardConfiguration->ignitionPins[1] = GPIOC_7; + boardConfiguration->ignitionPins[2] = GPIOE_10; + boardConfiguration->ignitionPins[3] = GPIOC_9; // #4 + + // todo: 8.2 or 10k? + engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2; + +#if EFI_PROD_CODE + enableFrankensoCan(); +#endif +} + diff --git a/firmware/config/engines/honda_600.h b/firmware/config/engines/honda_600.h new file mode 100644 index 0000000000..33669bff6f --- /dev/null +++ b/firmware/config/engines/honda_600.h @@ -0,0 +1,14 @@ +/* + * @file honda_600.h + * + * @date Jul 9, 2016 + * @author Andrey Belomutskiy, (c) 2012-2016 + */ + +#ifndef CONFIG_ENGINES_HONDA_600_H_ +#define CONFIG_ENGINES_HONDA_600_H_ + +#include "engine.h" +void setHonda600(DECLARE_ENGINE_PARAMETER_F); + +#endif /* CONFIG_ENGINES_HONDA_600_H_ */ diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 50568aa393..bec06312a2 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -26,6 +26,8 @@ case MIATA_NA_1_6: return "MIATA_NA_1_6"; case ZIL_130: return "ZIL_130"; +case HONDA_600: + return "Honda 600"; case ACURA_RSX: return "ACURA_RSX"; case AUDI_AAN: diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 4bc76920e4..fef42d5a5a 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -76,6 +76,7 @@ #include "geo_storm.h" #include "mazda_miata_1_6.h" #include "zil130.h" +#include "honda_600.h" EXTERN_ENGINE; @@ -848,6 +849,9 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN case GY6_139QMB: setGy6139qmbDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; + case HONDA_600: + setHonda600(PASS_ENGINE_PARAMETER_F); + break; case MAZDA_MIATA_NB: setMazdaMiataNbEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index fbab18482c..0cf45ba43a 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -127,7 +127,9 @@ typedef enum { ZIL_130 = 42, - ET_UNUSED = 43, + HONDA_600 = 43, + + ET_UNUSED = 44, Force_4b_engine_type = ENUM_32_BITS, } engine_type_e; diff --git a/firmware/iar/ch.ewp b/firmware/iar/ch.ewp index 71a0f70d25..40b2c043b4 100644 --- a/firmware/iar/ch.ewp +++ b/firmware/iar/ch.ewp @@ -2016,6 +2016,12 @@ $PROJ_DIR$\..\config\engines\GY6_139QMB.h + + $PROJ_DIR$\..\config\engines\honda_600.cpp + + + $PROJ_DIR$\..\config\engines\honda_600.h + $PROJ_DIR$\..\config\engines\honda_accord.cpp