Merge remote-tracking branch 'origin/master' into perf-tracing

This commit is contained in:
Matthew Kennedy 2019-11-19 16:28:58 -08:00
commit 8fd603dca9
203 changed files with 1999 additions and 1107 deletions

View File

@ -35,12 +35,12 @@ endif
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = $(EXTRA_PARAMS) $(DEBUG_LEVEL_OPT) $(RFLAGS) -Wno-error=implicit-fallthrough -Wno-error=bool-operation -fomit-frame-pointer -falign-functions=16 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Werror=missing-field-initializers -Werror=type-limits -Wno-error=strict-aliasing -Wno-error=attributes
USE_OPT = $(EXTRA_PARAMS) $(DEBUG_LEVEL_OPT) $(RFLAGS) -Wno-error=implicit-fallthrough -Wno-error=bool-operation -fomit-frame-pointer -falign-functions=16 -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Werror=missing-field-initializers -Werror=type-limits -Wno-error=strict-aliasing -Wno-error=attributes
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT = -fgnu89-inline -std=gnu99
USE_COPT = -fgnu89-inline -std=gnu99 -Werror-implicit-function-declaration
endif
# C++ specific options here (added to USE_OPT).

46
firmware/build-notes.txt Normal file
View File

@ -0,0 +1,46 @@
This directory contains the source code for the RusEFI firmware.
The ideal is that typical end users should be able to use pre-built
firmware. They should not need to modify or even rebuild from the
source code for basic use, but building from the source code provides
the opportunity for optimization, supporting unexpected engine
configurations, and specialized enhancements.
TL;DR
make PROJECT_BOARD=microrusefi PROJECT_CPU=ARCH_STM32F4
Environment
Rebuilding from source code requires this firmware, a modern C/C++
compiler for embedded ARM systems, and a platform that supports 'make'
based builds.
While many compilers have the potential to work, we suggest using the
official ARM version of GCC available at launchpad.net.
Linux and MacOS systems should have the software development tools,
primarily 'make', pre-installed or readily installed. MS-Windows
requires selecting and installing a Unix-compatible system environment.
Note that the developers are volunteers, with varied motivations.
These motivations often include using leading-edge language and build
system concepts, requiring recent versions of tools. Should you
encounter build problems, review the latest version of this document.
Expected Future Changes
The firmware build is moving toward a system that separates board
features from processor features. This will require specifying both
the board type and specific processor.
The existing system evolved based on the original RusEFI boards which
used 'STM32 Discovery' development boards plugged into base boards
that held the ECU specific chips. That resulted in hard-coded
assumption about pin assignments, and associations of hardware with a
specific processor variant. That legacy is slowly being cleaned up,
but is still evident in some settings and limitations.

View File

@ -0,0 +1,10 @@
cd ../../..
set PROJECT_BOARD=microrusefi
set PROJECT_CPU=ARCH_STM32F4
set DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=MRE_BOARD_TEST
call config/boards/common_make.bat
call config/boards/clean_env_variables.bat

View File

@ -0,0 +1,9 @@
cd ../../..
set PROJECT_BOARD=microrusefi
set PROJECT_CPU=ARCH_STM32F4
call config/boards/common_make.bat
call config/boards/clean_env_variables.bat

View File

@ -0,0 +1,17 @@
cd ../../..
set LDSCRIPT = config/boards/NUCLEO_F767/STM32F76xxI.ld
set PROJECT_BOARD=microrusefi
set PROJECT_CPU=ARCH_STM32F7
set EXTRA_PARAMS=-DDUMMY ^
-DEFI_COMMUNICATION_PIN=GPIOB_7 ^
-DEFI_FATAL_ERROR_PIN=GPIOB_14 ^
-DDEFAULT_ENGINE_TYPE=BMW_M73_F
rem -DDEFAULT_ENGINE_TYPE=MRE_BOARD_TEST
call config/boards/common_make.bat
call config/boards/clean_env_variables.bat

View File

@ -1,16 +1,30 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/microrusefi/board_configuration.cpp
# Combine the related files for a specific platform and MCU.
# Required include directories
BOARDINC = $(PROJECT_DIR)/config/boards/nucleo_f767 $(PROJECT_DIR)/config/stm32f7ems
BOARDS_DIR = $(PROJECT_DIR)/config/boards
LDSCRIPT= $(PROJECT_DIR)/config/boards/nucleo_f767/STM32F76xxI.ld
# Target ECU board design
BOARDSRC_CPP = $(BOARDS_DIR)/microrusefi/board_configuration.cpp
# Target processor details
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
MCU_DEFS = -DSTM32F407xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c
BOARDINC = $(BOARDS_DIR)/microrusefi
BOARDINC += $(PROJECT_DIR)/config/stm32f4ems # For board.h
BOARDINC += $(BOARDS_DIR)/st_stm32f4
LDSCRIPT= $(BOARDS_DIR)/prometheus/STM32F405xG.ld
else
MCU_DEFS = -DSTM32F767xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld
endif
# Set this if you want a default engine type other than normal MRE
ifeq ($(DEFAULT_ENGINE_TYPE),)
DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=MICRO_RUS_EFI
endif
# Override DEFAULT_ENGINE_TYPE
DDEFS += -DSTM32F767xx -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE)
# Add them all together
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE)

View File

@ -215,3 +215,10 @@ void setBoardConfigurationOverrides(void) {
void setAdcChannelOverrides(void) {
}
/**
* @brief Board-specific SD card configuration code overrides. Needed by bootloader code.
* @todo Add your board-specific code, if any.
*/
void setSdCardConfigurationOverrides(void) {
}

View File

@ -1,3 +1,8 @@
/**
* @file board_extra.c
*/
#include "chconf_common.h"
/**
* @brief Board-specific configuration code overrides.

View File

@ -20,6 +20,7 @@ EXTERN_CONFIG
;
void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
// chartsize 450
engineConfiguration->engineChartSize = 450;

View File

@ -5,11 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef BMW_E34_H_
#define BMW_E34_H_
#pragma once
#include "engine_configuration.h"
void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* BMW_E34_H_ */

View File

@ -0,0 +1,129 @@
/*
* @file bmw_m73.cpp
*
*
* https://github.com/rusefi/rusefi_documentation/wiki/BMW_e38_750
*
* https://rusefi.com/wiki/index.php?title=Hardware:OEM_connectors#134_pin
*
* 1/2 plugs black
* 2/2 plugs grey
*
*
* ********* | | OEM | rusEfi | function
*
* Plug #1 9 pin
* ECU pin 4: GND BRN/ORG
* ECU pin 6: GND BRN
* ECU pin 7: IN RED +12v hot at all times
* ECU pin 8: IN RED/BLU +12v from ECU relay
*
* Plug #2 24 pin
* ECU pin 3: CAN xxx/xxx CAN low
* ECU pin 4: CAN xxx/xxx CAN high
* ECU pin 23: OUT BRN/BLK BLK ECU relay control, low-side
*
* Plug #3 52 pin
* ECU pin 2: OUT injector #4
* ECU pin 6: GND ECU
* ECU pin 15: OUT injector #2
* ECU pin 20: IN WHT hall effect camshaft sensor signal
* ECU pin 21: GND BRN BLK CLT sensor
* ECU pin 22: IN RED/BRN GRN CLT sensor
* ECU pin 27: OUT injector #6
* ECU pin 28: OUT injector #5
* ECU pin 32: IN ORG VR positive crankshaft sensor - only 2x 5k per channel, R111 not installed, W1002 not installed
* ECU pin 40: OUT BRN/BLK injector #3
* ECU pin 41: OUT BRN/WHT injector #1
* ECU pin 45: GND crankshaft shield
* ECU pin 46: IN BLK BLU VR negative crankshaft sensor
*
*
* Plug #4 40 pin
* ECU pin 6: IN start signal from ignition key
* ECU pin 17: OUT BLK engine speed output for gauge cluster
* ECU pin 26: IN GRN/BLK RED +12 hot in start & run
* ECU pin 40: OUT YEL/BRN BRN starter enable
*
*
* Plug #5 9 pin
* ECU pic 3: OUT BLK coil signal, low-side
* ECU pic 5: GND BRN ground
* ECU pic 6: OUT BLK coil signal, low-side
* ECU pic 9: OUT BLK coil signal, low-side
*
* Frankenso
* set engine_type 40
* Manhattan
* set engine_type 24
*
* @date Nov 1, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "engine_template.h"
#include "custom_engine.h"
EXTERN_CONFIG;
static void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 13641435991 injector
engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info
engineConfiguration->specs.cylindersCount = 12;
engineConfiguration->specs.displacement = 5.4;
engineConfiguration->specs.firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10;
engineConfiguration->vvtMode = VVT_FIRST_HALF;
engineConfiguration->globalTriggerAngleOffset = 90;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_60_2_VW;
engineConfiguration->ignitionMode = IM_TWO_COILS;
}
// BMW_M73_F
void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIOC_6;
CONFIGB(idle).solenoidPin = GPIO_UNASSIGNED;
CONFIGB(mainRelayPin) = GPIO_UNASSIGNED;
CONFIGB(fanPin) = GPIO_UNASSIGNED;
CONFIGB(fuelPumpPin) = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G
boardConfiguration->ignitionPins[ID2INDEX(2)] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(3)] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(4)] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(7)] = GPIOC_7; // Frankenso high side - pin 1H
boardConfiguration->injectionPins[0] = GPIOB_8;
boardConfiguration->injectionPins[1] = GPIOB_7;
boardConfiguration->injectionPins[2] = GPIOB_9;
boardConfiguration->injectionPins[3] = GPIOD_5;
boardConfiguration->injectionPins[4] = GPIOD_3;
boardConfiguration->injectionPins[5] = GPIOE_2;
boardConfiguration->injectionPins[6] = GPIOE_3;
boardConfiguration->injectionPins[7] = GPIOE_4;
boardConfiguration->injectionPins[8] = GPIOE_5;
boardConfiguration->injectionPins[9] = GPIOE_6;
boardConfiguration->injectionPins[10] = GPIOC_13;
boardConfiguration->injectionPins[11] = GPIOD_7;
}
// BMW_M73_M
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
}

View File

@ -0,0 +1,13 @@
/*
* @file engine_template.h
*
* @date Nov 1, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#pragma once
#include "engine_configuration.h"
void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -71,6 +71,8 @@ static const ignition_table_t default_tps_advance_table = {
EXTERN_CONFIG;
void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->engineType = CITROEN_TU3JP;
/**

View File

@ -85,6 +85,7 @@ void disableLCD(board_configuration_s *boardConfiguration) {
// todo: should this be part of more default configurations?
void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
setFrankenso_01_LCD(boardConfiguration);
@ -244,6 +245,7 @@ void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// ETB_BENCH_ENGINE
// set engine_type 58
void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
// VAG test ETB
// set tps_min 54
engineConfiguration->tpsMin = 54;
@ -389,6 +391,7 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* set engine_type 30
*/
void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0)
engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation
boardConfiguration->triggerSimulatorFrequency = 60;
@ -496,6 +499,7 @@ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// TLE8888 high current low side: VVT2 IN9 / OUT5
// GPIOE_10: "3 - Lowside 2"
boardConfiguration->injectionPins[2 - 1] = GPIOE_10;
#endif /* BOARD_TLE8888_COUNT */
}
#endif /* CONFIG_ENGINES_CUSTOM_ENGINE_CPP_ */

View File

@ -145,6 +145,8 @@ static const fuel_table_t veDodgeNeon2003Table = {
EXTERN_CONFIG;
void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_DODGE_NEON_1995;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
@ -249,6 +251,7 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM;
setFrankenso_01_LCD(boardConfiguration);
setFrankenso0_1_joystick(engineConfiguration);
@ -500,9 +503,5 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// end of setDodgeNeonNGCEngineConfiguration
}
void setDodgeNeonNGCEngineConfigurationCrankBased(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDodgeNeonNGCEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
}
#endif /* EFI_SUPPORT_DODGE_NEON */

View File

@ -2,7 +2,7 @@
* @file engine_template.cpp
*
* @date
* @author Andrey Belomutskiy, (c) 2012-2018
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "engine_template.h"

View File

@ -2,14 +2,11 @@
* @file engine_template.h
*
* @date
* @author Andrey Belomutskiy, (c) 2012-2017
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef CONFIG_ENGINES_ENGINE_TEMPLATE_H_
#define CONFIG_ENGINES_ENGINE_TEMPLATE_H_
#pragma once
#include "engine_configuration.h"
void setEngineTemplateConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_ENGINE_TEMPLATE_H_ */

View File

@ -4,6 +4,7 @@ ENGINES_SRC =
ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \
$(PROJECT_DIR)/config/engines/custom_engine.cpp \
$(PROJECT_DIR)/config/engines/bmw_e34.cpp \
$(PROJECT_DIR)/config/engines/bmw_m73.cpp \
$(PROJECT_DIR)/config/engines/mazda_miata.cpp \
$(PROJECT_DIR)/config/engines/mazda_miata_base_maps.cpp \
$(PROJECT_DIR)/config/engines/mazda_miata_1_6.cpp \
@ -22,7 +23,6 @@ ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \
$(PROJECT_DIR)/config/engines/rover_v8.cpp \
$(PROJECT_DIR)/config/engines/mazda_323.cpp \
$(PROJECT_DIR)/config/engines/mazda_626.cpp \
$(PROJECT_DIR)/config/engines/prometheus.cpp \
$(PROJECT_DIR)/config/engines/sachs.cpp \
$(PROJECT_DIR)/config/engines/test_engine.cpp \
$(PROJECT_DIR)/config/engines/mitsubishi.cpp \
@ -35,7 +35,6 @@ ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \
$(PROJECT_DIR)/config/engines/chevrolet_c20_1973.cpp \
$(PROJECT_DIR)/config/engines/toyota_jzs147.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/me7pnp.cpp \

View File

@ -24,6 +24,8 @@ EXTERN_CONFIG;
* @brief Default values for persistent properties
*/
void setFordInline6(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->specs.cylindersCount = 6;
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);

View File

@ -88,6 +88,8 @@ static void setDefaultAspireMaps(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
void setFordAspireEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->tpsMin = 100;
engineConfiguration->tpsMax = 750;
@ -121,7 +123,7 @@ void setFordAspireEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set cranking_timing_angle 37
engineConfiguration->crankingTimingAngle = -37;
setSingleCoilDwell(engineConfiguration);
setSingleCoilDwell(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->ignitionMode = IM_ONE_COIL;
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
engineConfiguration->useOnlyRisingEdgeForTrigger = true;

View File

@ -9,11 +9,8 @@
*
*/
#ifndef FORD_ASPIRE_H_
#define FORD_ASPIRE_H_
#pragma once
#include "engine_configuration.h"
void setFordAspireEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* FORD_ASPIRE_H_ */

View File

@ -69,9 +69,9 @@ EXTERN_CONFIG;
* set engine_type 14
*/
void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
common079721_2351(PASS_CONFIG_PARAMETER_SIGNATURE);
common079721_2351(engineConfiguration, boardConfiguration);
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
setFrankenso_01_LCD(boardConfiguration);
setFrankenso0_1_joystick(engineConfiguration);
@ -155,7 +155,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setWholeFuelMap(5 PASS_CONFIG_PARAMETER_SUFFIX);
setAfrMap(config->afrTable, 13.5);
setSingleCoilDwell(engineConfiguration);
setSingleCoilDwell(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->ignitionMode = IM_ONE_COIL;
boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN;

View File

@ -1,16 +0,0 @@
/*
* @file geo_storm.h
*
* @date Mar 26, 2016
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#include "geo_storm.h"
#include "custom_engine.h"
EXTERN_CONFIG;
void setGeoStormConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
}

View File

@ -1,15 +0,0 @@
/*
* @file geo_storm.h
*
* @date Mar 26, 2016
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef CONFIG_ENGINES_GEO_STORM_H_
#define CONFIG_ENGINES_GEO_STORM_H_
#include "engine_configuration.h"
void setGeoStormConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_GEO_STORM_H_ */

View File

@ -64,6 +64,7 @@ static void setDefaultCustomMaps(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_HONDA_CBR_600_CUSTOM;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;

View File

@ -8,8 +8,7 @@
* MIATA_1990 = 19 (Frankenstein board)
* MIATA_1994_DEVIATOR = 20
* MIATA_1996 = 21
* MIATA_1994_SPAGS = 24
* set engine_type 24
* set engine_type 21
*
* @date Apr 11, 2014
* @author Andrey Belomutskiy, (c) 2012-2018
@ -167,7 +166,8 @@ static void commonMiataNa(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setCommonNTCSensor(&engineConfiguration->iat, 2700);
}
void common079721_2351(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
void common079721_2351(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->engineChartSize = 300;
@ -204,7 +204,7 @@ void common079721_2351(engine_configuration_s *engineConfiguration, board_config
* Frankenstein board
*/
void setMiata1990(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
common079721_2351(engineConfiguration, boardConfiguration);
common079721_2351(PASS_CONFIG_PARAMETER_SIGNATURE);
commonMiataNa(PASS_CONFIG_PARAMETER_SIGNATURE);
@ -313,6 +313,7 @@ static void setMiata1994_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
*/
void setMiata1994_d(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMiata1994_common(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->vbattDividerCoeff = ((float) (8.2 + 33)) / 8.2 * 2;
/**
* This board was avoiding PE0 & PE1 mosfets altogether
@ -326,47 +327,6 @@ void setMiata1994_d(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
}
void setMiata1994_s(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMiata1994_common(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->vbattDividerCoeff = ((float) (10.0 + 33)) / 10 * 2;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
engineConfiguration->acSwitchAdc = EFI_ADC_1; // PA1, W50 on Frankenso
engineConfiguration->afr.hwChannel = EFI_ADC_3;
setEgoSensor(ES_Innovate_MTX_L PASS_CONFIG_PARAMETER_SUFFIX);
/**
* This board has PE0<>PD5 & PE1<>PD3 rewired in order to avoid Discovery issue
*/
boardConfiguration->injectionPins[0] = GPIOD_3; // avoiding PE1
boardConfiguration->injectionPins[1] = GPIOE_2; // injector #2
boardConfiguration->injectionPins[2] = GPIOB_8; // injector #3
boardConfiguration->injectionPins[3] = GPIOB_7; // injector #4
// setFsio(engineConfiguration, 0, GPIOD_11, "coolant 80 >");
boardConfiguration->idle.solenoidFrequency = 500;
engineConfiguration->acCutoffLowRpm = 400;
engineConfiguration->acCutoffHighRpm = 4500;
engineConfiguration->acIdleRpmBump = 200;
//engineConfiguration->idleMode != IM_AUTO;
setTargetRpmCurve(800 PASS_CONFIG_PARAMETER_SUFFIX);
engineConfiguration->tpsMax = 86;
engineConfiguration->tpsMin = 596;
boardConfiguration->malfunctionIndicatorPin = GPIOE_5;
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
setMazdaMiataNAMaf(config);
engineConfiguration->injector.flow = 230;
}
/**
* Tom tomiata, Frankenstein board
*/

View File

@ -9,15 +9,11 @@
* Injectors: Denso 195500-2180, 230-265cc (?), tan, 13.9 ohms
*/
#ifndef MAZDA_MIATA_H_
#define MAZDA_MIATA_H_
#pragma once
#include "engine_configuration.h"
void common079721_2351(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration);
void common079721_2351(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1990(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1994_d(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1994_s(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1996(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* MAZDA_MIATA_H_ */

View File

@ -198,6 +198,8 @@ static void setMiataNA6_settings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* MIATA_NA6_MAP
*/
void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->isHip9011Enabled = false;
@ -301,6 +303,7 @@ void setMiataNA6_VAF_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* set engine_type 12
*/
void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0)
// idle.solenoidPin output is inherited from boards/microrusefi/board_configuration.cpp
// CLT: "18 - AN temp 1"
// IAT: "23 - AN temp 2"
@ -345,5 +348,5 @@ void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMiataNA6_settings(PASS_CONFIG_PARAMETER_SIGNATURE);
miataNAcommonEngineSettings(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->fuelAlgorithm = LM_PLAIN_MAF;
#endif /* BOARD_TLE8888_COUNT */
}

View File

@ -5,11 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef CONFIG_ENGINES_MAZDA_MIATA_NA8_H_
#define CONFIG_ENGINES_MAZDA_MIATA_NA8_H_
#pragma once
#include "engine_configuration.h"
void setMazdaMiataNA8Configuration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_MAZDA_MIATA_NA8_H_ */

View File

@ -18,6 +18,8 @@
EXTERN_CONFIG;
void setMazdaMiataNb1EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
// set_rpm_hard_limit 3000
engineConfiguration->rpmHardLimit = 3000; // yes, 3k. let's play it safe for now

View File

@ -5,11 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef MAZDA_MIATA_NB1_H_
#define MAZDA_MIATA_NB1_H_
#pragma once
#include "engine_configuration.h"
void setMazdaMiataNb1EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* MAZDA_MIATA_NB1_H_ */

View File

@ -486,6 +486,7 @@ void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGN
* set engine_type 13
*/
void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0)
setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
// MRE has a special main relay control low side pin - rusEfi firmware is totally not involved with main relay control
@ -564,5 +565,5 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 0.3#4 has wrong R139 as well?
// 56k high side/10k low side multiplied by above analogInputDividerCoefficient = 11
engineConfiguration->vbattDividerCoeff = (66.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
#endif /* BOARD_TLE8888_COUNT */
}

View File

@ -7,8 +7,7 @@
* http://rusefi.com/forum/viewtopic.php?f=3&t=1095
*/
#ifndef CONFIG_ENGINES_MAZDA_MIATA_VVT_H_
#define CONFIG_ENGINES_MAZDA_MIATA_VVT_H_
#pragma once
#include "engine_configuration.h"
@ -20,5 +19,3 @@ void setMazdaMiata2003EngineConfigurationNaFuelRail(DECLARE_CONFIG_PARAMETER_SIG
void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_MAZDA_MIATA_VVT_H_ */

View File

@ -17,6 +17,8 @@
EXTERN_CONFIG;
void setMitsubishiConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->engineType = MITSU_4G93;
engineConfiguration->trigger.type = TT_MITSUBISHI; // same trigger as 4G63?

View File

@ -1,17 +0,0 @@
/*
* prometheus.cpp
*
* set engine_type 100
*
* @date May 6, 2017
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#include "prometheus.h"
void setPrometheusDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}

View File

@ -1,14 +0,0 @@
/*
* prometheus.h
*
* @date May 6, 2017
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef CONFIG_ENGINES_PROMETHEUS_H_
#define CONFIG_ENGINES_PROMETHEUS_H_
#include "engine_configuration.h"
void setPrometheusDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_PROMETHEUS_H_ */

View File

@ -1,9 +1,15 @@
In TunerStudio or rusEfi console please use "Popular Vehicles" dialog to apply some of these presets.
This directory contains pre-defined configurations for popular engines.
These configurations are a convenience, not a limit. Most engine types
can be manually configured.
Please do not be afraid of the content of this folder. You would NOT need your own file to start your own engine.
In TunerStudio or rusEfi console use the "Popular Vehicles" dialog to
apply one of these presets.
See http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
This folder is also used by continutes integration testing suite.
This folder is also used by the continuous integration testing suite.
New configurations should follow the pattern of <make>_<model>.cpp for
consistency. A future change may rename these to <make>_<engine>.cpp

View File

@ -28,6 +28,8 @@ void setFrankenstein_01_LCD(board_configuration_s *boardConfiguration) {
EXTERN_CONFIG;
void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
// set trigger_type 9
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;

View File

@ -15,6 +15,8 @@
EXTERN_CONFIG;
void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->specs.displacement = 0.1; // 100cc
engineConfiguration->specs.cylindersCount = 1;

View File

@ -18,6 +18,7 @@
EXTERN_CONFIG;
void setTestEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
@ -54,6 +55,7 @@ void setTestEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
void setTestVVTEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;

View File

@ -752,6 +752,9 @@
#ifndef __ASSEMBLER__
#ifdef __cplusplus
extern "C"
#endif
void chDbgPanic3(const char *msg, const char * file, int line);
#endif

View File

@ -7,8 +7,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef EFIFEATURES_STM32F4_H_
#define EFIFEATURES_STM32F4_H_
#pragma once
#define EFI_GPIO_HARDWARE TRUE
@ -404,5 +403,3 @@
#define INTERMEDIATE_LOGGING_BUFFER_SIZE 2000
#define EFI_JOYSTICK TRUE
#endif /* EFIFEATURES_STM32F4_H_ */

View File

@ -710,6 +710,9 @@
#ifndef __ASSEMBLER__
#ifdef __cplusplus
extern "C"
#endif
void chDbgPanic3(const char *msg, const char * file, int line);
#endif

View File

@ -12,8 +12,7 @@
#include "../stm32f4ems/efifeatures.h"
#ifndef EFIFEATURES_STM32F7_H_
#define EFIFEATURES_STM32F7_H_
#pragma once
// Warning! This is a test config!
@ -109,5 +108,3 @@
// todo: temporary ignore errors, this is a test config
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
#endif /* EFIFEATURES_STM32F7_H_ */

View File

@ -267,7 +267,7 @@ static const void * getStructAddr(int structId) {
case LDS_ENGINE_STATE_INDEX:
return static_cast<engine_state2_s*>(&engine->engineState);
case LDS_FUEL_TRIM_STATE_INDEX:
return static_cast<wall_fuel_state*>(&engine->wallFuel);
return static_cast<wall_fuel_state*>(&engine->wallFuel[0]);
case LDS_TRIGGER_CENTRAL_STATE_INDEX:
return static_cast<trigger_central_s*>(&engine->triggerCentral);
case LDS_TRIGGER_STATE_STATE_INDEX:
@ -308,9 +308,11 @@ static void handleGetStructContent(ts_channel_s *tsChannel, int structId, int si
* read log file content for rusEfi console
*/
static void handleReadFileContent(ts_channel_s *tsChannel, short fileId, short offset, short length) {
#if EFI_FILE_LOGGING
readLogFileContent(tsChannel->crcReadBuffer, fileId, offset, length);
#endif /* EFI_FILE_LOGGING */
//#if EFI_FILE_LOGGING
// readLogFileContent(tsChannel->crcReadBuffer, fileId, offset, length);
//#else
UNUSED(tsChannel); UNUSED(fileId); UNUSED(offset); UNUSED(length);
//#endif /* EFI_FILE_LOGGING */
}
/**
@ -720,7 +722,7 @@ static void handleExecuteCommand(ts_channel_s *tsChannel, char *data, int incomi
*/
bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command) {
// Bail fast if guaranteed not to be a plain command
if(command == 0)
if (command == 0)
{
return false;
}

View File

@ -111,6 +111,7 @@ static void sayHello(void) {
chThdSleepMilliseconds(5);
}
#if CH_DBG_THREADS_PROFILING && CH_DBG_FILL_THREADS
static uintptr_t CountFreeStackSpace(const void* wabase)
{
const uint8_t* stackBase = reinterpret_cast<const uint8_t*>(wabase);
@ -124,6 +125,7 @@ static uintptr_t CountFreeStackSpace(const void* wabase)
return stackUsage - stackBase;
}
#endif
/**
* This methods prints all threads, their stack usage, and their total times
@ -164,6 +166,8 @@ void print(const char *format, ...) {
va_start(ap, format);
chvprintf((BaseSequentialStream*) getConsoleChannel(), format, ap);
va_end(ap);
#else
UNUSED(format);
#endif /* EFI_UART_ECHO_TEST_MODE */
}

View File

@ -91,6 +91,10 @@ extern int icuWidthPeriodCounter;
#include "fsio_impl.h"
#endif /* EFI_FSIO */
#if (BOARD_TLE8888_COUNT > 0)
#include "tle8888.h"
#endif /* BOARD_TLE8888_COUNT */
#if EFI_ENGINE_SNIFFER
#include "engine_sniffer.h"
extern WaveChart waveChart;
@ -121,9 +125,10 @@ static void setWarningEnabled(int value) {
// this one needs to be in main ram so that SD card SPI DMA works fine
static char FILE_LOGGER[1000] MAIN_RAM;
static Logging fileLogger("file logger", FILE_LOGGER, sizeof(FILE_LOGGER));
static int logFileLineIndex = 0;
#endif /* EFI_FILE_LOGGING */
static int logFileLineIndex = 0;
#define TAB "\t"
static void reportSensorF(Logging *log, const char *caption, const char *units, float value,
@ -147,6 +152,9 @@ static void reportSensorF(Logging *log, const char *caption, const char *units,
appendFloat(log, value, precision);
append(log, TAB);
}
#else
UNUSED(log);UNUSED(caption);UNUSED(units);UNUSED(value);
UNUSED(precision);
#endif /* EFI_FILE_LOGGING */
}
}
@ -162,6 +170,8 @@ static void reportSensorI(Logging *log, const char *caption, const char *units,
} else {
appendPrintf(log, "%d%s", value, TAB);
}
#else
UNUSED(log);UNUSED(caption);UNUSED(units);UNUSED(value);
#endif /* EFI_FILE_LOGGING */
}
@ -184,6 +194,7 @@ static float getAirFlowGauge(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return hasMafSensor() ? getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE) : engine->engineState.airFlow;
}
#if EFI_FILE_LOGGING
static void printSensors(Logging *log) {
bool fileFormat = true; // todo:remove this unused variable
// current time, in milliseconds
@ -324,8 +335,8 @@ static void printSensors(Logging *log) {
// 268
reportSensorF(log, GAUGE_NAME_FUEL_PID_CORR, "ms", ENGINE(engineState.running.pidCorrection), 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_AMOUNT, "v", ENGINE(wallFuel).getWallFuel(0), 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_CORRECTION, "v", ENGINE(wallFuel).wallFuelCorrection, 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_AMOUNT, "v", ENGINE(wallFuel[0]).getWallFuel(), 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_CORRECTION, "v", ENGINE(wallFuel[0]).wallFuelCorrection, 2);
reportSensorI(log, GAUGE_NAME_VERSION, "#", getRusEfiVersion());
@ -377,6 +388,8 @@ static void printSensors(Logging *log) {
reportSensorI(log, INDICATOR_NAME_AC_SWITCH, "bool", engine->acSwitchState);
}
#endif /* EFI_FILE_LOGGING */
void writeLogLine(void) {
#if EFI_FILE_LOGGING
@ -567,7 +580,7 @@ static void showFuelInfo(void) {
}
#endif
static OutputPin *leds[] = { &enginePins.warningLedPin, &enginePins.runningLedPin, &enginePins.checkEnginePin,
static OutputPin *leds[] = { &enginePins.warningLedPin, &enginePins.runningLedPin,
&enginePins.errorLedPin, &enginePins.communicationLedPin, &enginePins.checkEnginePin };
static void initStatusLeds(void) {
@ -577,6 +590,10 @@ static void initStatusLeds(void) {
enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warningLedPin);
enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin);
enginePins.debugTriggerSync.initPin("debug: sync", CONFIGB(debugTriggerSync));
enginePins.debugTimerCallback.initPin("debug: timer callback", CONFIGB(debugTimerCallback));
enginePins.debugSetTimer.initPin("debug: set timer", CONFIGB(debugSetTimer));
}
#define BLINKING_PERIOD_MS 33
@ -754,11 +771,11 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
// 148
tsOutputChannels->fuelTankLevel = engine->sensors.fuelTankLevel;
// 160
tsOutputChannels->wallFuelAmount = ENGINE(wallFuel).getWallFuel(0);
tsOutputChannels->wallFuelAmount = ENGINE(wallFuel[0]).getWallFuel();
// 164
tsOutputChannels->iatCorrection = ENGINE(engineState.running.intakeTemperatureCoefficient);
// 168
tsOutputChannels->wallFuelCorrection = ENGINE(wallFuel).wallFuelCorrection;
tsOutputChannels->wallFuelCorrection = ENGINE(wallFuel[0]).wallFuelCorrection;
// 184
tsOutputChannels->cltCorrection = ENGINE(engineState.running.coolantTemperatureCoefficient);
// 188
@ -855,10 +872,11 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->speedToRpmRatio = vehicleSpeed / rpm;
#endif /* EFI_VEHICLE_SPEED */
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature());
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature());
#endif /* EFI_PROD_CODE */
tsOutputChannels->isCltError = !hasCltSensor();
tsOutputChannels->isIatError = !hasIatSensor();
tsOutputChannels->fuelConsumptionPerHour = engine->engineState.fuelConsumption.perSecondConsumption;
tsOutputChannels->warningCounter = engine->engineState.warnings.warningCounter;
@ -919,7 +937,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->debugIntField1 = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_FALLING);
tsOutputChannels->debugIntField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_FALLING);
tsOutputChannels->debugIntField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_FALLING);
#if EFI_PROD_CODE
#if EFI_PROD_CODE && HAL_USE_ICU == TRUE
tsOutputChannels->debugIntField4 = engine->triggerCentral.vvtEventRiseCounter;
tsOutputChannels->debugIntField5 = engine->triggerCentral.vvtEventFallCounter;
tsOutputChannels->debugFloatField5 = icuWidthCallbackCounter + icuWidthPeriodCounter;
@ -999,6 +1017,11 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
ionPostState(tsOutputChannels);
#endif /* EFI_CDM_INTEGRATION */
break;
case DBG_TLE8888:
#if (BOARD_TLE8888_COUNT > 0)
tle8888PostState(tsOutputChannels);
#endif /* BOARD_TLE8888_COUNT */
break;
default:
;
}

View File

@ -32,7 +32,7 @@ static Logging *logger;
static SimplePwm alternatorControl("alt");
static pid_s *altPidS = &persistentState.persistentConfiguration.engineConfiguration.alternatorControl;
Pid alternatorPid(altPidS);
static PidIndustrial alternatorPid(altPidS);
static percent_t currentAltDuty;
@ -56,6 +56,10 @@ class AlternatorController : public PeriodicTimerController {
}
#endif
// todo: move this to pid_s one day
alternatorPid.antiwindupFreq = engineConfiguration->alternator_antiwindupFreq;
alternatorPid.derivativeFilterLoss = engineConfiguration->alternator_derivativeFilterLoss;
if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) {
// this block could be executed even in on/off alternator control mode
// but at least we would reflect latest state
@ -148,7 +152,7 @@ void onConfigurationChangeAlternatorCallback(engine_configuration_s *previousCon
shouldResetPid = !alternatorPid.isSame(&previousConfiguration->alternatorControl);
}
void initAlternatorCtrl(Logging *sharedLogger) {
void initAlternatorCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
addConsoleAction("altinfo", showAltInfo);
if (CONFIGB(alternatorControlPin) == GPIO_UNASSIGNED)

View File

@ -15,15 +15,13 @@
* it is believed that more than just PID would be needed, as is this is probably
* not usable on a real vehicle. Needs to be tested :)
*
*
* https://raw.githubusercontent.com/wiki/rusefi/rusefi_documentation/oem_docs/VAG/Bosch_0280750009_pinout.jpg
*
* ETB is controlled according to pedal position input (pedal position sensor is a potentiometer)
* pedal 0% means pedal not pressed / idle
* pedal 100% means pedal all the way down
* (not TPS - not the one you can calibrate in TunerStudio)
*
* At the moment we only control opening motor - while relying on ETB spring to move throttle butterfly
* back. Throttle position sensor inside ETB is used for closed-loop PID control of ETB.
*
* See also pid.cpp
*
@ -481,7 +479,7 @@ void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etb.maxValue = 200;
}
static bool isSamePins(etb_io *current, etb_io *active) {
static bool isEtbPinsChanged(etb_io *current, etb_io *active) {
return current->controlPin1 != active->controlPin1 ||
current->controlPinMode != active->controlPinMode ||
current->directionPin1 != active->directionPin1 ||
@ -493,7 +491,7 @@ bool isETBRestartNeeded(void) {
/**
* We do not want any interruption in HW pin while adjusting other properties
*/
return isSamePins(&engineConfiguration->bc.etb1, &activeConfiguration.bc.etb1);
return isEtbPinsChanged(&engineConfiguration->bc.etb1, &activeConfiguration.bc.etb1);
}
void stopETBPins(void) {
@ -519,6 +517,7 @@ void startETBPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
);
}
#if EFI_PROD_CODE && 0
static void setTempOutput(float value) {
autoTune.output = value;
}
@ -540,6 +539,7 @@ static void setAutoOffset(int offset) {
tuneWorkingPidSettings.offset = offset;
autoTune.reset();
}
#endif
void setDefaultEtbBiasCurve(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etbBiasBins[0] = 0;

View File

@ -2,11 +2,10 @@
* @file electronic_throttle.h
*
* @date Dec 7, 2013
* @author Andrey Belomutskiy, (c) 2012-2017
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef ELECTRONIC_THROTTLE_H_
#define ELECTRONIC_THROTTLE_H_
#pragma once
// https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
#define DEFAULT_ETB_LOOP_FREQUENCY 200
@ -37,5 +36,3 @@ void stopETBPins(void);
void startETBPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration);
void unregisterEtbPins();
#endif /* ELECTRONIC_THROTTLE_H_ */

View File

@ -293,7 +293,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
int idlePidLowerRpm = targetRpm + CONFIG(idlePidRpmDeadZone);
if (CONFIG(idlePidRpmUpperLimit) > 0) {
engine->engineState.idle.idleState = PID_UPPER;
if (CONFIGB(useIacTableForCoasting) && !cisnan(engine->sensors.clt)) {
if (CONFIGB(useIacTableForCoasting) && hasCltSensor()) {
percent_t iacPosForCoasting = interpolate2d("iacCoasting", getCoolantTemperature(), CONFIG(iacCoastingBins), CONFIG(iacCoasting));
newValue = interpolateClamped(idlePidLowerRpm, newValue, idlePidLowerRpm + CONFIG(idlePidRpmUpperLimit), iacPosForCoasting, rpm);
} else {
@ -371,7 +371,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* EFI_SHAFT_POSITION_INPUT */
// cltCorrection is used only for cranking or running in manual mode
float cltCorrection;
if (cisnan(clt))
if (!hasCltSensor())
cltCorrection = 1.0f;
// Use separate CLT correction table for cranking
else if (engineConfiguration->overrideCrankingIacSetting && !isRunning) {
@ -526,7 +526,30 @@ static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_g
}
}
static void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
bool isIdleHardwareRestartNeeded() {
return isConfigurationChanged(stepperEnablePin) ||
isConfigurationChanged(stepperEnablePinMode) ||
isConfigurationChanged(bc.idle.stepperStepPin) ||
isConfigurationChanged(bc.idle.solenoidFrequency) ||
isConfigurationChanged(bc.useStepperIdle) ||
// isConfigurationChanged() ||
isConfigurationChanged(bc.useETBforIdleControl) ||
isConfigurationChanged(bc.idle.solenoidPin);
}
void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
brain_pin_markUnused(activeConfiguration.stepperEnablePin);
brain_pin_markUnused(activeConfiguration.bc.idle.stepperStepPin);
brain_pin_markUnused(activeConfiguration.bc.idle.solenoidPin);
// brain_pin_markUnused(activeConfiguration.bc.idle.);
// brain_pin_markUnused(activeConfiguration.bc.idle.);
// brain_pin_markUnused(activeConfiguration.bc.idle.);
// brain_pin_markUnused(activeConfiguration.bc.idle.);
}
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (CONFIGB(useStepperIdle)) {
iacMotor.initialize(CONFIGB(idle).stepperStepPin,
CONFIGB(idle).stepperDirectionPin,
@ -537,7 +560,7 @@ static void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
logger);
// This greatly improves PID accuracy for steppers with a small number of steps
idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps;
} else {
} else if (!engineConfiguration->bc.useETBforIdleControl) {
/**
* Start PWM for idleValvePin
*/
@ -559,7 +582,8 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
idlePid.initPidClass(&engineConfiguration->idleRpmPid);
#if ! EFI_UNIT_TEST
// todo: re-initialize idle pins on the fly
// todo: we still have to explicitly init all hardware on start in addition to handling configuration change via
// 'applyNewHardwareSettings' todo: maybe unify these two use-cases?
initIdleHardware(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif /* EFI_UNIT_TEST */

View File

@ -3,11 +3,10 @@
* @brief Idle Valve Control thread
*
* @date May 23, 2013
* @author Andrey Belomutskiy, (c) 2012-2017
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef IDLE_THREAD_H_
#define IDLE_THREAD_H_
#pragma once
#include "engine.h"
#include "periodic_task.h"
@ -33,6 +32,8 @@ void setIdleDFactor(float value);
void setIdleMode(idle_mode_e value);
void setTargetIdleRpm(int value);
void setIdleDT(int value);
void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool isIdleHardwareRestartNeeded();
void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration);
#endif /* IDLE_THREAD_H_ */

View File

@ -161,6 +161,7 @@ static const char* idleModeStr[] = { "I:A", "I:M" };
// }
//}
#if 0
static char * prepareInfoLine(engine_configuration_s *engineConfiguration, char *buffer) {
char *ptr = buffer;
@ -176,6 +177,7 @@ static char * prepareInfoLine(engine_configuration_s *engineConfiguration, char
ptr = appendStr(ptr, " ");
return ptr;
}
#endif
//static char * prepareStatusLine(char *buffer) {
// char *ptr = buffer;

View File

@ -25,7 +25,8 @@ static void turnTachPinLow(void) {
static void tachSignalCallback(trigger_event_e ckpSignalType,
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (index != engineConfiguration->tachPulseTriggerIndex) {
UNUSED(ckpSignalType);
if (index != (uint32_t)engineConfiguration->tachPulseTriggerIndex) {
return;
}
enginePins.tachOut.setHigh();

View File

@ -39,16 +39,13 @@ tps_tps_Map3D_t tpsTpsMap("tpsTps");
static Logging *logger = nullptr;
WallFuel::WallFuel() {
resetWF();
}
void WallFuel::resetWF() {
wallFuel = 0;
}
//
floatms_t WallFuel::adjust(int injectorIndex, floatms_t desiredFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
floatms_t WallFuel::adjust(floatms_t desiredFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
invocationCounter++;
if (cisnan(desiredFuel)) {
return desiredFuel;
}
@ -118,7 +115,7 @@ floatms_t WallFuel::adjust(int injectorIndex, floatms_t desiredFuel DECLARE_ENGI
beta = alpha;
}
float fuelFilmMass = wallFuel/*[injectorIndex]*/;
float fuelFilmMass = wallFuel;
float M_cmd = (desiredFuel - (1 - alpha) * fuelFilmMass) / (1 - beta);
// We can't inject a negative amount of fuel
@ -132,15 +129,15 @@ floatms_t WallFuel::adjust(int injectorIndex, floatms_t desiredFuel DECLARE_ENGI
float fuelFilmMassNext = alpha * fuelFilmMass + beta * M_cmd;
DISPLAY_TEXT(Current_Wall_Fuel_Film);
DISPLAY_FIELD(wallFuel)/*[injectorIndex]*/ = fuelFilmMassNext;
DISPLAY_FIELD(wallFuel) = fuelFilmMassNext;
DISPLAY_TEXT(Fuel correction);
DISPLAY_FIELD(wallFuelCorrection) = M_cmd - desiredFuel;
DISPLAY_TEXT(ms);
return M_cmd;
}
floatms_t WallFuel::getWallFuel(int injectorIndex) const {
return wallFuel/*[injectorIndex]*/;
floatms_t WallFuel::getWallFuel() const {
return wallFuel;
}
int AccelEnrichment::getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
@ -242,7 +239,7 @@ float LoadAccelEnrichment::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGN
float taper = 0;
if (d > engineConfiguration->engineLoadAccelEnrichmentThreshold) {
int distance = cb.currentIndex - index;
distance = cb.currentIndex - index;
if (distance <= 0) // checking if indexes are out of order due to circular buffer nature
distance += minI(cb.getCount(), cb.getSize());
@ -292,6 +289,8 @@ void TpsAccelEnrichment::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// we update values in handleFuel() directly
//onNewValue(getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
onUpdateInvocationCounter++;
// we used some extra fuel during the current cycle, so we "charge" our "acceleration pump" with it
accumulatedValue -= maxExtraPerPeriod;
maxExtraPerPeriod = maxF(maxExtraPerCycle, maxExtraPerPeriod);

View File

@ -7,8 +7,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef ACC_ENRICHMENT_H_
#define ACC_ENRICHMENT_H_
#pragma once
#include "global.h"
#include "cyclic_buffer.h"
@ -30,6 +29,7 @@ public:
void setLength(int length);
cyclic_buffer<float> cb;
void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_SUFFIX);
int onUpdateInvocationCounter = 0;
};
class LoadAccelEnrichment : public AccelEnrichment {
@ -67,15 +67,14 @@ private:
*/
class WallFuel : public wall_fuel_state {
public:
WallFuel();
/**
* @param target desired squirt duration
* @return total adjusted fuel squirt duration once wall wetting is taken into effect
*/
floatms_t adjust(int injectorIndex, floatms_t target DECLARE_ENGINE_PARAMETER_SUFFIX);
floatms_t getWallFuel(int injectorIndex) const;
floatms_t adjust(floatms_t target DECLARE_ENGINE_PARAMETER_SUFFIX);
floatms_t getWallFuel() const;
void resetWF();
private:
int invocationCounter = 0;
};
void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
@ -93,6 +92,3 @@ void setDecelThr(float value);
void setDecelMult(float value);
void updateAccelParameters();
#endif /* ACC_ENRICHMENT_H_ */

View File

@ -113,7 +113,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
float iatCorrection;
if (cisnan(engine->sensors.iat)) {
if (!hasIatSensor()) {
iatCorrection = 0;
} else {
iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, getIntakeAirTemperature());

View File

@ -5,8 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef ADVANCE_H_
#define ADVANCE_H_
#pragma once
#include "engine.h"
@ -17,5 +16,3 @@ float getTopAdvanceForBore(chamber_style_e style, int octane, double compression
float getInitialAdvance(int rpm, float map, float advanceMax);
void buildTimingMap(float advanceMax DECLARE_CONFIG_PARAMETER_SUFFIX);
angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif /* ADVANCE_H_ */

View File

@ -5,12 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef ALGO_H_
#define ALGO_H_
#pragma once
#include "global.h"
#include "engine_configuration.h"
void initDataStructures(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void initAlgo(Logging *sharedLogger);
#endif /* ALGO_H_ */

View File

@ -707,8 +707,10 @@ case FRANKENSO_QA_ENGINE:
return "FRANKENSO_QA_ENGINE";
case Force_4_bytes_size_engine_type:
return "Force_4_bytes_size_engine_type";
case GEO_STORM:
return "GEO_STORM";
case BMW_M73_F:
return "BMW_M73_F";
case BMW_M73_M:
return "BMW_M73_M";
case MRE_BOARD_TEST:
return "MRE_BOARD_TEST";
case GY6_139QMB:
@ -743,8 +745,6 @@ case MIATA_1990:
return "MIATA_1990";
case MIATA_1994_DEVIATOR:
return "MIATA_1994_DEVIATOR";
case MIATA_1994_SPAGS:
return "MIATA_1994_SPAGS";
case MIATA_1996:
return "MIATA_1996";
case MIATA_NA6_MAP:

View File

@ -372,13 +372,9 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engine->m.beforeFuelCalc = getTimeNowLowerNt();
int rpm = GET_RPM();
/**
* we have same assignment of 'getInjectionDuration' to 'injectionDuration' in handleFuel()
* Open question why do we refresh that in two places?
*/
ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
engine->m.fuelCalcTime = getTimeNowLowerNt() - engine->m.beforeFuelCalc;
}
void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {

View File

@ -29,7 +29,7 @@
#include "global_execution_queue.h"
#endif /* EFI_UNIT_TEST */
#define FAST_CALLBACK_PERIOD_MS 20
#define FAST_CALLBACK_PERIOD_MS 5
class RpmCalculator;
@ -62,6 +62,11 @@ public:
*/
int globalSparkIdCounter = 0;
// this is useful at least for real hardware integration testing - maybe a proper solution would be to simply
// GND input pins instead of leaving them floating
bool hwTriggerInputEnabled = true;
#if !EFI_PROD_CODE
float mockMapValue = 0;
// for historical reasons we have options to mock TPS on different layers :(
@ -94,7 +99,7 @@ public:
IgnitionEventList ignitionEvents;
#endif /* EFI_ENGINE_CONTROL */
WallFuel wallFuel;
WallFuel wallFuel[INJECTION_PIN_COUNT];
bool needToStopEngine(efitick_t nowNt) const;
bool etbAutoTune = false;
/**

View File

@ -38,6 +38,7 @@
#include "custom_engine.h"
#include "engine_template.h"
#include "bmw_e34.h"
#include "bmw_m73.h"
#include "dodge_neon.h"
#include "dodge_ram.h"
@ -62,7 +63,6 @@
#include "citroenBerlingoTU3JP.h"
#include "rover_v8.h"
#include "mitsubishi.h"
#include "prometheus.h"
#include "subaru.h"
#include "test_engine.h"
#include "sachs.h"
@ -74,7 +74,6 @@
#include "toyota_jzs147.h"
#include "ford_festiva.h"
#include "lada_kalina.h"
#include "geo_storm.h"
#include "zil130.h"
#include "honda_600.h"
@ -114,6 +113,7 @@ EXTERN_ENGINE;
#define xxxxx 0
#if 0
static fuel_table_t alphaNfuel = {
{/*0 engineLoad=0.00*/ /*0 800.0*/xxxxx, /*1 1213.0*/xxxxx, /*2 1626.0*/xxxxx, /*3 2040.0*/xxxxx, /*4 2453.0*/xxxxx, /*5 2866.0*/xxxxx, /*6 3280.0*/xxxxx, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx},
{/*1 engineLoad=6.66*/ /*0 800.0*/xxxxx, /*1 1213.0*/xxxxx, /*2 1626.0*/xxxxx, /*3 2040.0*/xxxxx, /*4 2453.0*/xxxxx, /*5 2866.0*/xxxxx, /*6 3280.0*/xxxxx, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx},
@ -132,6 +132,7 @@ static fuel_table_t alphaNfuel = {
{/*14 engineLoad=93.33*/ /*0 800.0*/xxxxx, /*1 1213.0*/xxxxx, /*2 1626.0*/xxxxx, /*3 2040.0*/xxxxx, /*4 2453.0*/xxxxx, /*5 2866.0*/xxxxx, /*6 3280.0*/xxxxx, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx},
{/*15 engineLoad=100.00*/ /*0 800.0*/xxxxx, /*1 1213.0*/xxxxx, /*2 1626.0*/xxxxx, /*3 2040.0*/xxxxx, /*4 2453.0*/xxxxx, /*5 2866.0*/xxxxx, /*6 3280.0*/xxxxx, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx}
};
#endif
/**
* Current engine configuration. On firmware start we assign empty configuration, then
@ -141,9 +142,10 @@ static fuel_table_t alphaNfuel = {
* todo: place this field next to 'engineConfiguration'?
*/
#ifdef EFI_ACTIVE_CONFIGURATION_IN_FLASH
engine_configuration_s EFI_ACTIVE_CONFIGURATION_IN_FLASH activeConfiguration;
engine_configuration_s & activeConfiguration = *(engine_configuration_s *)EFI_ACTIVE_CONFIGURATION_IN_FLASH;
#else
engine_configuration_s activeConfiguration;
static engine_configuration_s activeConfigurationLocalStorage;
engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage;
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
extern engine_configuration_s *engineConfiguration;
@ -159,6 +161,8 @@ extern LoggingWithStorage sharedLogger;
/**
* this is the top-level method which should be called in case of any changes to engine configuration
* online tuning of most values in the maps does not count as configuration change, but 'Burn' command does
*
* this method is NOT currently invoked on ECU start - actual user input has to happen!
*/
void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
ENGINE(globalConfigurationVersion++);
@ -184,7 +188,7 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* EFI_IDLE_CONTROL */
#if EFI_SHAFT_POSITION_INPUT
onConfigurationChangeTriggerCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX);
onConfigurationChangeTriggerCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif /* EFI_SHAFT_POSITION_INPUT */
#if EFI_EMULATE_POSITION_SENSORS
onConfigurationChangeRpmEmulatorCallback(&activeConfiguration);
@ -198,6 +202,7 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
/**
* @brief Sets the same dwell time across the whole getRpm() range
* set dwell X
*/
void setConstantDwell(floatms_t dwellMs DECLARE_CONFIG_PARAMETER_SUFFIX) {
for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
@ -223,9 +228,11 @@ void setMap(fuel_table_t table, float value) {
}
}
#if 0
static void setWholeVEMap(float value DECLARE_CONFIG_PARAMETER_SUFFIX) {
setMap(config->veTable, value);
}
#endif
void setWholeFuelMap(float value DECLARE_CONFIG_PARAMETER_SUFFIX) {
setMap(config->fuelTable, value);
@ -235,6 +242,8 @@ void setWholeIgnitionIatCorr(float value DECLARE_CONFIG_PARAMETER_SUFFIX) {
#if (IGN_LOAD_COUNT == FUEL_LOAD_COUNT) && (IGN_RPM_COUNT == FUEL_RPM_COUNT)
// todo: make setMap a template
setMap(config->ignitionIatCorrTable, value);
#else
UNUSED(value);
#endif
}
@ -529,7 +538,7 @@ static void setDefaultStepperIdleParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE)
engineConfiguration->idleStepperTotalSteps = 150;
}
static void setCanFrankensoDefaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
static void setCanFrankensoDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->canDeviceMode = CD_USE_CAN2;
boardConfiguration->canTxPin = GPIOB_6;
boardConfiguration->canRxPin = GPIOB_12;
@ -546,7 +555,7 @@ void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX) {
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float clt = getCoolantTemperature();
int targetRpm;
if (cisnan(clt)) {
if (!hasCltSensor()) {
// error is already reported, let's take first value from the table should be good enough error handing solution
targetRpm = CONFIG(cltIdleRpm)[0];
} else {
@ -954,9 +963,9 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
/**
* @brief Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc.)
*/
static void setDefaultFrankensoConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void setDefaultFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setCanFrankensoDefaults(PASS_ENGINE_PARAMETER_SIGNATURE);
setCanFrankensoDefaults(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;
engineConfiguration->clt.adcChannel = EFI_ADC_6;
@ -1001,7 +1010,7 @@ static void setDefaultFrankensoConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE)
// set optional subsystem configs
#if EFI_MEMS
// this would override some values from above
configureAccelerometerPins(PASS_ENGINE_PARAMETER_SIGNATURE);
configureAccelerometerPins(PASS_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_MEMS */
#if EFI_HIP_9011
@ -1009,7 +1018,7 @@ static void setDefaultFrankensoConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE)
#endif /* EFI_HIP_9011 */
#if EFI_FILE_LOGGING
setDefaultSdCardParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
setDefaultSdCardParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_FILE_LOGGING */
boardConfiguration->is_enabled_spi_1 = false;
@ -1044,9 +1053,15 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
*/
switch (engineType) {
case DEFAULT_FRANKENSO:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
case FRANKENSO_QA_ENGINE:
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_F:
setEngineBMW_M73_Frankenso(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_M:
setEngineBMW_M73_Manhattan(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NA6:
setMiataNA6_VAF_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1056,6 +1071,7 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case MRE_MIATA_NB2:
setMiataNB2_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case PROMETHEUS_DEFAULTS:
case MINIMAL_PINS:
// all basic settings are already set in prepareVoidConfiguration(), no need to set anything here
break;
@ -1064,16 +1080,11 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
break;
#if EFI_SUPPORT_DODGE_NEON
case DODGE_NEON_1995:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setDodgeNeon1995EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case DODGE_NEON_2003_CAM:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setDodgeNeonNGCEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case DODGE_NEON_2003_CRANK:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setDodgeNeonNGCEngineConfigurationCrankBased(PASS_CONFIG_PARAMETER_SIGNATURE);
setDodgeNeonNGCEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case LADA_KALINA:
setLadaKalina(PASS_CONFIG_PARAMETER_SIGNATURE);
@ -1082,7 +1093,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
#endif /* EFI_SUPPORT_DODGE_NEON */
#if EFI_SUPPORT_FORD_ASPIRE
case FORD_ASPIRE_1996:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setFordAspireEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif /* EFI_SUPPORT_FORD_ASPIRE */
@ -1103,15 +1113,12 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
setZil130(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_NA6_MAP:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMiataNA6_MAP_Frankenso(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_NA6_VAF:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMiataNA6_VAF_Frankenso(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case ETB_BENCH_ENGINE:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setEtbTestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MICRO_RUS_EFI:
@ -1121,7 +1128,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
setTle8888TestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_MIATA_NA8:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMazdaMiataNA8Configuration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case TEST_CIVIC_4_0_BOTH:
@ -1136,20 +1142,14 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case HONDA_ACCORD_1_24_SHIFTED:
setHondaAccordConfiguration1_24_shifted(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case FRANKENSO_QA_ENGINE:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setFrankensoBoardTestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case HONDA_ACCORD_CD_DIP:
setHondaAccordConfigurationDip(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MITSU_4G93:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMitsubishiConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_SUPPORT_1995_FORD_INLINE_6
case FORD_INLINE_6_1995:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setFordInline6(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif /* EFI_SUPPORT_1995_FORD_INLINE_6 */
@ -1157,11 +1157,9 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
setGy6139qmbDefaultEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case HONDA_600:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setHonda600(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_MIATA_NB1:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMazdaMiataNb1EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_323:
@ -1174,38 +1172,27 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
setSuzukiVitara(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case FORD_ESCORT_GT:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setFordEscortGt(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_1990:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMiata1990(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_1994_DEVIATOR:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMiata1994_d(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_1994_SPAGS:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMiata1994_s(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_1996:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMiata1996(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case CITROEN_TU3JP:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setCitroenBerlingoTU3JPConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case ROVER_V8:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setRoverv8(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case SUBARU_2003_WRX:
setSubaru2003Wrx(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_E34:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setBmwE34(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case DODGE_RAM:
@ -1215,7 +1202,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
setDodgeStratus(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case VW_ABA:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setVwAba(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_UNIT_TEST
@ -1231,40 +1217,30 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
#endif
case TEST_ENGINE:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setTestEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_MIATA_2003:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMazdaMiata2003EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_MIATA_2003_NA_RAIL:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMazdaMiata2003EngineConfigurationNaFuelRail(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_MIATA_2003_BOARD_TEST:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setMazdaMiata2003EngineConfigurationBoardTest(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case PROMETHEUS_DEFAULTS:
setPrometheusDefaults(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case SUBARUEJ20G_DEFAULTS:
setSubaruEJ20GDefaults(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case TEST_ENGINE_VVT:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setTestVVTEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case SACHS:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setSachs(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case DAIHATSU:
setDaihatsu(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case CAMARO_4:
setDefaultFrankensoConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
setCamaro4(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case CHEVY_C20_1973:
@ -1276,9 +1252,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case TOYOTA_JZS147:
setToyota_jzs147EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case GEO_STORM:
setGeoStormConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
default:
warning(CUSTOM_UNEXPECTED_ENGINE_TYPE, "Unexpected engine type: %d", engineType);
@ -1291,6 +1264,7 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
}
void emptyCallbackWithConfiguration(engine_configuration_s * engineConfiguration) {
UNUSED(engineConfiguration);
}
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) {

View File

@ -81,6 +81,7 @@ void copyFuelTable(fuel_table_t const source, fuel_table_t destination);
void copyTimingTable(ignition_table_t const source, ignition_table_t destination);
void emptyCallbackWithConfiguration(engine_configuration_s * engine);
void setDefaultFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
typedef void (*configuration_callback_t)(engine_configuration_s*);

View File

@ -34,7 +34,7 @@ public:
float s_h_c = 0;
bool isLinear;
private:
thermistor_conf_s currentConfig = {};
thermistor_conf_s currentConfig = {0,0,0,0,0,0,0};
};
class Accelerometer {

View File

@ -56,21 +56,6 @@ public:
angle_t mapAveragingDuration = 0;
angle_t timingAdvance = 0;
// spark-related
/**
* ignition dwell duration in ms
* See also dwellAngle
*/
floatms_t sparkDwell = 0;
/**
* ignition dwell duration as crankshaft angle
* NAN if engine is stopped
* See also sparkDwell
*/
angle_t dwellAngle = NAN;
angle_t cltTimingCorrection = 0;
// fuel-related;
float fuelCutoffCorrection = 0;
efitick_t coastingFuelCutStartTime = 0;

View File

@ -45,7 +45,7 @@ typedef enum {
FO_1_10_9_4_3_6_5_8_7_2 = 14, // dodge and viper ram v10
// 12 cylinder
FO_1_7_5_11_3_9_6_12_2_8_4_10 = 15, // bmw M70 etc
FO_1_7_5_11_3_9_6_12_2_8_4_10 = 15, // bmw M70 & M73 etc
FO_1_7_4_10_2_8_6_12_3_9_5_11 = 16, // lamborghini, typical rusEfi use-case
FO_1_12_5_8_3_10_6_7_2_11_4_9 = 18, // VAG W12

View File

@ -44,6 +44,11 @@ extern baroCorr_Map3D_t baroCorrMap;
DISPLAY_STATE(Engine)
DISPLAY(DISPLAY_FIELD(sparkDwell))
DISPLAY(DISPLAY_FIELD(dwellAngle))
DISPLAY(DISPLAY_FIELD(cltTimingCorrection))
DISPLAY_TEXT(eol);
DISPLAY(DISPLAY_IF(isCrankingState)) floatms_t getCrankingFuel3(float coolantTemperature,
uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX) {
// these magic constants are in Celsius
@ -225,7 +230,7 @@ int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX)
* @see getCoilDutyCycle
*/
percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
floatms_t totalInjectiorAmountPerCycle = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX) * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX);
floatms_t totalInjectiorAmountPerCycle = ENGINE(injectionDuration) * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX);
floatms_t engineCycleDuration = getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
}
@ -312,13 +317,13 @@ void initFuelMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
* @brief Engine warm-up fuel correction.
*/
float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (cisnan(engine->sensors.clt))
if (!hasCltSensor())
return 1; // this error should be already reported somewhere else, let's just handle it
return interpolate2d("cltf", getCoolantTemperature(), config->cltFuelCorrBins, config->cltFuelCorr);
}
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (cisnan(engine->sensors.clt))
if (!hasCltSensor())
return 0; // this error should be already reported somewhere else, let's just handle it
return interpolate2d("timc", getCoolantTemperature(), engineConfiguration->cltTimingBins, engineConfiguration->cltTimingExtra);
}
@ -346,7 +351,8 @@ float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_
// gather events
bool mapDeactivate = (map >= CONFIG(coastingFuelCutMap));
bool tpsDeactivate = (tpsPos >= CONFIG(coastingFuelCutTps));
bool cltDeactivate = cisnan(engine->sensors.clt) ? false : (engine->sensors.clt < (float)CONFIG(coastingFuelCutClt));
// If no CLT sensor (or broken), don't allow DFCO
bool cltDeactivate = hasCltSensor() ? (getCoolantTemperature() < (float)CONFIG(coastingFuelCutClt)) : true;
bool rpmDeactivate = (rpm < CONFIG(coastingFuelCutRpmLow));
bool rpmActivate = (rpm > CONFIG(coastingFuelCutRpmHigh));

View File

@ -4,8 +4,8 @@
* @date Jan 6, 2015
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef CONTROLLERS_ALGO_LCD_MENU_TREE_H_
#define CONTROLLERS_ALGO_LCD_MENU_TREE_H_
#pragma once
typedef enum {
LL_STRING,
@ -73,7 +73,3 @@ public:
MenuItem *current = nullptr;
MenuItem *topVisible = nullptr;
};
#endif /* CONTROLLERS_ALGO_LCD_MENU_TREE_H_ */

View File

@ -108,7 +108,9 @@ void nmea_parse_gpgga(char *nmea, loc_t *loc) {
p = strchr(p, ',') + 1; // in p string started with searching address
str_till_comma(p, dStr); // str to float till comma saved modified string
if(strlen(p) == 0) return; // if no data in field - empty data - we return
if (strlen(p) == 0) {
return; // if no data in field - empty data - we return
}
loc->latitude = atoff(dStr); // fulfil data
@ -182,7 +184,7 @@ void nmea_parse_gprmc(char *nmea, loc_t *loc) {
p = strchr(p, ',') + 1; //read time
str_till_comma(p, dStr);
if(strlen(dStr) > 5){
if (strlen(dStr) > 5) {
timp.tm_hour = str2int(dStr,2);
timp.tm_min = str2int(dStr+2,2);
timp.tm_sec = str2int(dStr+4,2);
@ -191,7 +193,7 @@ void nmea_parse_gprmc(char *nmea, loc_t *loc) {
p = strchr(p, ',') + 1; //read field Valid status
str_till_comma(p, dStr);
if(dStr[0] == 'V') { // if field is invalid
if (dStr[0] == 'V') { // if field is invalid
loc->quality = 0;
return;
}
@ -242,13 +244,13 @@ void nmea_parse_gprmc(char *nmea, loc_t *loc) {
p = strchr(p, ',') + 1; //read date
str_till_comma(p, dStr);
if(strlen(dStr) > 5){
if (strlen(dStr) > 5) {
timp.tm_mday = str2int(dStr,2);
timp.tm_mon = str2int(dStr+2,2);
timp.tm_year = str2int(dStr+4,2)+100; // we receive -200, but standard wait -1900 = add correction
}
if( timp.tm_year > 0 ) { // check if date field is valid
if (timp.tm_year > 0 ) { // check if date field is valid
memcpy(&loc->GPStm, &timp, sizeof(timp));
}
}

View File

@ -1908,7 +1908,7 @@ typedef enum {
CUSTOM_ERR_6558 = 6558,
CUSTOM_ERR_6559 = 6559,
CUSTOM_ERR_6560 = 6560,
CUSTOM_ERR_TRIGGER_ANGLE_RANGE = 6560,
CUSTOM_ERR_6561 = 6561,
CUSTOM_ERR_6562 = 6562,
CUSTOM_ERR_6563 = 6563,
@ -2051,10 +2051,10 @@ typedef enum {
CUSTOM_ERR_6688 = 6688,
CUSTOM_ERR_6689 = 6689,
CUSTOM_ERR_6690 = 6690,
CUSTOM_ERR_MAP_START_ASSERT = 6690,
CUSTOM_ERR_MAP_AVG_OFFSET = 6691,
CUSTOM_ERR_6692 = 6692,
CUSTOM_ERR_6693 = 6693,
CUSTOM_ERR_MAP_CYL_OFFSET = 6692,
CUSTOM_ERR_PWM_DUTY_ASSERT = 6693,
CUSTOM_ERR_ZERO_CRANKING_FUEL = 6694,
CUSTOM_ERR_6695 = 6695,
CUSTOM_ERR_6696 = 6696,
@ -2070,11 +2070,14 @@ typedef enum {
CUSTOM_ERR_BOTH_FRONTS_REQUIRED = 6704,
CUSTOM_TLE8888 = 6705,
CUSTOM_ERR_6706 = 6706,
CUSTOM_ERR_6707 = 6707,
CUSTOM_ERR_6708 = 6708,
CUSTOM_ERR_PIN_COUNT_TOO_LARGE = 6709,
CUSTOM_ERR_TIMER_TEST_CALLBACK_NOT_HAPPENED = 6707,
CUSTOM_ERR_TIMER_TEST_CALLBACK_WRONG_TIME = 6708,
CUSTOM_ERR_6709 = 6709,
CUSTOM_DUTY_INVALID = 6710,
CUSTOM_DUTY_TOO_HIGH = 6711,
CUSTOM_ERR_PWM_STATE_ASSERT = 6712,
CUSTOM_ERR_PWM_CALLBACK_ASSERT = 6713,
CUSTOM_ERR_PWM_SWITCH_ASSERT = 6714,
CUSTOM_ERR_TRIGGER_SYNC = 9000,

View File

@ -8,8 +8,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef RUSEFI_ENUMS_H_
#define RUSEFI_ENUMS_H_
#pragma once
#include "efifeatures.h"
#include "obd_error_codes.h"
@ -96,7 +95,7 @@ typedef enum {
SUBARU_2003_WRX = 22,
DODGE_NEON_2003_CAM = 23,
MIATA_1994_SPAGS = 24,
BMW_M73_M = 24,
BMW_E34 = 25,
@ -131,7 +130,7 @@ typedef enum {
LADA_KALINA = 39,
GEO_STORM = 40,
BMW_M73_F = 40,
// Frankenso board
MIATA_NA6_MAP = 41,
@ -839,5 +838,3 @@ typedef enum {
*/
Force_4bytes_size_idle_state_e = ENUM_32_BITS,
} idle_state_e;
#endif /* RUSEFI_ENUMS_H_ */

View File

@ -85,6 +85,7 @@ typedef float fuel_table_t[FUEL_LOAD_COUNT][FUEL_RPM_COUNT];
typedef float ignition_table_t[IGN_LOAD_COUNT][IGN_RPM_COUNT];
typedef int16_t ignition_tps_table_t[IGN_LOAD_COUNT][IGN_RPM_COUNT];
typedef uint8_t pedal_to_tps_t[PEDAL_TO_TPS_SIZE][PEDAL_TO_TPS_SIZE];
typedef uint8_t iac_pid_mult_t[IAC_PID_MULT_SIZE][IAC_PID_MULT_SIZE];
typedef float baro_corr_table_t[BARO_CORR_SIZE][BARO_CORR_SIZE];

View File

@ -78,4 +78,6 @@
x.config = config; \
x.boardConfiguration = boardConfiguration;
#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
#endif /* CONTROLLERS_CORE_COMMON_HEADERS_H_ */

View File

@ -36,7 +36,7 @@ MultiWave::MultiWave() {
reset();
}
MultiWave::MultiWave(float *switchTimes, SingleWave *waves) : MultiWave(){
MultiWave::MultiWave(float *switchTimes, SingleWave *waves) : MultiWave() {
init(switchTimes, waves);
}
@ -93,6 +93,6 @@ int MultiWave::findAngleMatch(const float angle, const int size) const {
}
void MultiWave::setSwitchTime(const int index, const float value) {
efiAssertVoid(CUSTOM_ERR_6690, switchTimes != NULL, "switchTimes");
efiAssertVoid(CUSTOM_ERR_PWM_SWITCH_ASSERT, switchTimes != NULL, "switchTimes");
switchTimes[index] = value;
}

View File

@ -18,7 +18,7 @@ static MemoryStream firmwareErrorMessageStream;
#define WARNING_BUFFER_SIZE 80
static char warningBuffer[WARNING_BUFFER_SIZE];
static bool isWarningStreamInitialized = false;
static volatile bool isWarningStreamInitialized = false;
#if EFI_HD44780_LCD
#include "lcd_HD44780.h"

View File

@ -8,15 +8,14 @@
#ifndef ERROR_HANDLING_H_
#define ERROR_HANDLING_H_
#include "global.h"
#include "obd_error_codes.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include "global.h"
#include "obd_error_codes.h"
/**
* Something is wrong, but we can live with it: some minor sensor is disconnected
* or something like that
@ -31,7 +30,7 @@ typedef uint8_t fatal_msg_t[200];
*
* see also warning()
*/
EXTERNC void firmwareError(obd_code_e code, const char *fmt, ...);
void firmwareError(obd_code_e code, const char *fmt, ...);
#define hasFirmwareError() hasFirmwareErrorFlag

View File

@ -287,7 +287,7 @@ bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SU
push(element->action, getVoltage("fsio", engineConfiguration->fsioAdc[0] PASS_ENGINE_PARAMETER_SUFFIX));
break;
case LE_METHOD_KNOCK:
push(element->action, engine->knockCount);
push(element->action, ENGINE(knockCount));
break;
case LE_UNDEFINED:
warning(CUSTOM_UNKNOWN_FSIO, "FSIO undefined action");

View File

@ -269,6 +269,7 @@ void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX) {
(void)previousConfiguration;
#if EFI_FSIO
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif

View File

@ -266,12 +266,15 @@ efitick_t getTimeNowNt(void) {
}
#endif /* EFI_PROD_CODE */
#if ! EFI_UNIT_TEST
/**
* number of SysClock ticks in one ms
*/
#define TICKS_IN_MS (CH_CFG_ST_FREQUENCY / 1000)
// todo: this overflows pretty fast!
efitimems_t currentTimeMillis(void) {
// todo: migrate to getTimeNowUs? or not?
@ -282,13 +285,16 @@ efitimems_t currentTimeMillis(void) {
efitimesec_t getTimeNowSeconds(void) {
return currentTimeMillis() / 1000;
}
#endif /* EFI_PROD_CODE */
#endif /* EFI_UNIT_TEST */
static void resetAccel(void) {
engine->engineLoadAccelEnrichment.resetAE();
engine->tpsAccelEnrichment.resetAE();
engine->wallFuel.resetWF();
for (unsigned int i = 0; i < sizeof(engine->wallFuel) / sizeof(engine->wallFuel[0]); i++)
{
engine->wallFuel[i].resetWF();
}
}
static int previousSecond;
@ -748,7 +754,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
initMalfunctionCentral();
#if EFI_ALTERNATOR_CONTROL
initAlternatorCtrl(sharedLogger);
initAlternatorCtrl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
#endif
#if EFI_AUX_PID
@ -812,6 +818,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20191013;
return 20191117;
}
#endif /* EFI_UNIT_TEST */

View File

@ -6,8 +6,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef FLASH_MAIN_H_
#define FLASH_MAIN_H_
#pragma once
#include "engine.h"
@ -38,5 +37,3 @@ void setNeedToWriteConfiguration(void);
*/
bool getNeedToWriteConfiguration(void);
void writeToFlashIfPending(void);
#endif /* FLASH_MAIN_H_ */

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Tue Sep 24 18:13:29 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Tue Nov 05 23:21:45 EST 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
@ -226,11 +226,28 @@ struct engine_state2_s {
* offset 148
*/
percent_t targetFromTable = (percent_t)0;
/** total size 152*/
/**
* ignition dwell duration in ms
* See also dwellAngle
* offset 152
*/
floatms_t sparkDwell = (floatms_t)0;
/**
* ignition dwell duration as crankshaft angle
* NAN if engine is stopped
* See also sparkDwell
* offset 156
*/
angle_t dwellAngle = (angle_t)0;
/**
* offset 160
*/
angle_t cltTimingCorrection = (angle_t)0;
/** total size 164*/
};
typedef struct engine_state2_s engine_state2_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Tue Sep 24 18:13:29 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Tue Nov 05 23:21:45 EST 2019

View File

@ -28,11 +28,10 @@
#define EXTERN_CONFIG \
extern engine_configuration_s *engineConfiguration; \
extern board_configuration_s *boardConfiguration; \
extern engine_configuration_s activeConfiguration; \
extern engine_configuration_s & activeConfiguration; \
extern persistent_config_container_s persistentState; \
extern persistent_config_s *config; \
#define EXTERN_ENGINE \
extern Engine ___engine; \
extern Engine *engine; \
@ -58,6 +57,10 @@
/**
* this macro allows the compiled to figure out the complete static address, that's a performance
* optimization which is hopefully useful at least for anything trigger-related
*
* this is related to the fact that for unit tests we prefer to explicitly pass references in method signature thus code covered by
* unit tests would need to use by-reference access. These macro allow us to have faster by-address access in real firmware and by-reference
* access in unit tests
*/
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
#define CONFIGB(x) persistentState.persistentConfiguration.engineConfiguration.bc.x

View File

@ -26,6 +26,7 @@
#if EFI_ENGINE_CONTROL
#if !EFI_UNIT_TEST
#include "flash_main.h"
#include "injector_central.h"
#include "io_pins.h"
#include "main_trigger_callback.h"
@ -287,6 +288,12 @@ static void handleCommandX14(uint16_t index) {
case 9:
acRelayBench();
return;
case 10:
// cmd_write_config
#if EFI_PROD_CODE
writeToFlashNow();
#endif /* EFI_PROD_CODE */
return;
}

View File

@ -8,8 +8,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef INJECTOR_CENTRAL_H_
#define INJECTOR_CENTRAL_H_
#pragma once
#include "engine.h"
@ -21,5 +20,3 @@ void initInjectorCentral(Logging *sharedLogger);
bool isRunningBenchTest(void);
void executeTSCommand(uint16_t subsystem, uint16_t index);
#endif /* INJECTOR_CENTRAL_H_ */

View File

@ -234,14 +234,14 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (isValidRpm(rpm)) {
MAP_sensor_config_s * c = &engineConfiguration->map;
angle_t start = interpolate2d("mapa", rpm, c->samplingAngleBins, c->samplingAngle);
efiAssertVoid(CUSTOM_ERR_6690, !cisnan(start), "start");
efiAssertVoid(CUSTOM_ERR_MAP_START_ASSERT, !cisnan(start), "start");
angle_t offsetAngle = TRIGGER_SHAPE(eventAngles[CONFIG(mapAveragingSchedulingAtIndex)]);
efiAssertVoid(CUSTOM_ERR_MAP_AVG_OFFSET, !cisnan(offsetAngle), "offsetAngle");
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
angle_t cylinderOffset = getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) * i / engineConfiguration->specs.cylindersCount;
efiAssertVoid(CUSTOM_ERR_6692, !cisnan(cylinderOffset), "cylinderOffset");
efiAssertVoid(CUSTOM_ERR_MAP_CYL_OFFSET, !cisnan(cylinderOffset), "cylinderOffset");
// part of this formula related to specific cylinder offset is never changing - we can
// move the loop into start-up calculation and not have this loop as part of periodic calculation
// todo: change the logic as described above in order to reduce periodic CPU usage?
@ -270,7 +270,7 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
#if EFI_ENGINE_CONTROL
// this callback is invoked on interrupt thread
UNUSED(ckpEventType);
if (index != CONFIG(mapAveragingSchedulingAtIndex))
if (index != (uint32_t)CONFIG(mapAveragingSchedulingAtIndex))
return;
engine->m.beforeMapAveragingCb = getTimeNowLowerNt();
@ -314,9 +314,9 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
// we are loosing precision in case of changing RPM - the further away is the event the worse is precision
// todo: schedule this based on closest trigger event, same as ignition works
scheduleByAngle(rpm, &startTimer[i][structIndex], samplingStart,
startAveraging, NULL, &engine->rpmCalculator PASS_ENGINE_PARAMETER_SUFFIX);
startAveraging, NULL PASS_ENGINE_PARAMETER_SUFFIX);
scheduleByAngle(rpm, &endTimer[i][structIndex], samplingEnd,
endAveraging, NULL, &engine->rpmCalculator PASS_ENGINE_PARAMETER_SUFFIX);
endAveraging, NULL PASS_ENGINE_PARAMETER_SUFFIX);
engine->m.mapAveragingCbTime = getTimeNowLowerNt()
- engine->m.beforeMapAveragingCb;
}

View File

@ -5,8 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef ADC_AVERAGING_H_
#define ADC_AVERAGING_H_
#pragma once
#include "engine.h"
@ -24,5 +23,3 @@ void postMapState(TunerStudioOutputChannels *tsOutputChannels);
#endif
#endif /* EFI_MAP_AVERAGING */
#endif /* ADC_AVERAGING_H_ */

View File

@ -0,0 +1,4 @@
This directory contains the core calculations for engine operation.

View File

@ -80,7 +80,10 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
}
void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
/**
* see also setConstantDwell
*/
void setSingleCoilDwell(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
engineConfiguration->sparkDwellRpmBins[i] = i + 1;
engineConfiguration->sparkDwellValues[i] = 4;
@ -436,22 +439,24 @@ int getCylinderId(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
return 1;
}
static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) {
/**
* @param cylinderIndex from 0 to cylinderCount, not cylinder number
*/
static int getIgnitionPinForIndex(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
switch (getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE)) {
case IM_ONE_COIL:
return 0;
break;
case IM_WASTED_SPARK: {
if (CONFIG(specs.cylindersCount) == 1) {
// we do not want to divide by zero
return 0;
}
return i % (CONFIG(specs.cylindersCount) / 2);
return cylinderIndex % (CONFIG(specs.cylindersCount) / 2);
}
break;
case IM_INDIVIDUAL_COILS:
return i;
break;
return cylinderIndex;
case IM_TWO_COILS:
return cylinderIndex % 2;
default:
warning(CUSTOM_OBD_IGNITION_MODE, "unsupported ignitionMode %d in getIgnitionPinForIndex()", engineConfiguration->ignitionMode);
@ -462,8 +467,8 @@ static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) {
void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (ignitionMode != engine->ignitionModeForPinIndices) {
#if EFI_ENGINE_CONTROL
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER_SUFFIX);
for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
ENGINE(ignitionPin[cylinderIndex]) = getIgnitionPinForIndex(cylinderIndex PASS_ENGINE_PARAMETER_SUFFIX);
}
#endif /* EFI_ENGINE_CONTROL */
engine->ignitionModeForPinIndices = ignitionMode;
@ -509,7 +514,7 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* EFI_UNIT_TEST */
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
ENGINE(ignitionPositionWithinEngineCycle[i])= ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
ENGINE(ignitionPositionWithinEngineCycle[i]) = ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
}
prepareIgnitionPinIndices(CONFIG(ignitionMode) PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -61,7 +61,7 @@ void setFuelLoadBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX);
void setTimingRpmBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX);
void setTimingLoadBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX);
void setSingleCoilDwell(engine_configuration_s *engineConfiguration);
void setSingleCoilDwell(DECLARE_CONFIG_PARAMETER_SIGNATURE);
// we combine trigger-defined triggerShape.tdcPosition with user-defined CONFIG(globalTriggerAngleOffset)
// expectation is that for well-known triggers CONFIG(globalTriggerAngleOffset) would usually be zero

View File

@ -426,7 +426,9 @@ bool PID_AutoTune::Runtime(Logging *logger)
}
avgInput /= (double)(inputCount + 1);
#if defined(AUTOTUNE_DEBUG) || EFI_UNIT_TEST
bool stable = (iMax - iMin) <= 2.0 * workingNoiseBand;
#endif
#if defined (AUTOTUNE_DEBUG)
Serial.print(F("iMax "));
Serial.println(iMax);

View File

@ -31,14 +31,14 @@
persistent_config_container_s persistentState CCM_OPTIONAL;
const persistent_config_s *config = &persistentState.persistentConfiguration;
persistent_config_s *config = &persistentState.persistentConfiguration;
/**
* todo: it really looks like these fields should become 'static', i.e. private
* the whole 'extern ...' pattern is less then perfect, I guess the 'God object' Engine
* would be a smaller evil. Whatever is needed should be passed into methods/modules/files as an explicit parameter.
*/
const engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
const board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
#endif /* EFI_UNIT_TEST */

View File

@ -63,6 +63,10 @@ void PwmConfig::init(float *st, SingleWave *waves) {
* See also setFrequency
*/
void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
if (isStopRequested) {
// we are here in order to not change pin once PWM stop was requested
return;
}
if (cisnan(dutyCycle)) {
warning(CUSTOM_DUTY_INVALID, "spwd:dutyCycle %.2f", dutyCycle);
return;
@ -129,6 +133,10 @@ void PwmConfig::setFrequency(float frequency) {
periodNt = US2NT(frequency2periodUs(frequency));
}
void PwmConfig::stop() {
isStopRequested = true;
}
void PwmConfig::handleCycleStart() {
efiAssertVoid(CUSTOM_ERR_6697, safe.phaseIndex == 0, "handleCycleStart");
if (pwmCycleCallback != NULL) {
@ -154,6 +162,10 @@ void PwmConfig::handleCycleStart() {
efitimeus_t PwmConfig::togglePwmState() {
ScopePerf perf(PE::PwmConfigTogglePwmState);
if (isStopRequested) {
return 0;
}
#if DEBUG_PWM
scheduleMsg(&logger, "togglePwmState phaseIndex=%d iteration=%d", safe.phaseIndex, safe.iteration);
scheduleMsg(&logger, "period=%.2f safe.period=%.2f", period, safe.periodNt);
@ -237,6 +249,10 @@ static void timerCallback(PwmConfig *state) {
efiAssertVoid(CUSTOM_ERR_6581, state->dbgNestingLevel < 25, "PWM nesting issue");
efitimeus_t switchTimeUs = state->togglePwmState();
if (switchTimeUs == 0) {
// we are here when PWM gets stopped
return;
}
if (state->executor == NULL) {
firmwareError(CUSTOM_ERR_6695, "exec on %s", state->name);
return;
@ -279,6 +295,7 @@ void PwmConfig::weComplexInit(const char *msg, ExecutorInterface *executor,
pin_state_t *const*pinStates, pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *stateChangeCallback) {
UNUSED(msg);
this->executor = executor;
isStopRequested = false;
efiAssertVoid(CUSTOM_ERR_6582, periodNt != 0, "period is not initialized");
if (phaseCount == 0) {
@ -308,9 +325,9 @@ void PwmConfig::weComplexInit(const char *msg, ExecutorInterface *executor,
void startSimplePwm(SimplePwm *state, const char *msg, ExecutorInterface *executor,
OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback) {
efiAssertVoid(CUSTOM_ERR_6692, state != NULL, "state");
efiAssertVoid(CUSTOM_ERR_6665, dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
efiAssertVoid(CUSTOM_ERR_6693, stateChangeCallback != NULL, "listener");
efiAssertVoid(CUSTOM_ERR_PWM_STATE_ASSERT, state != NULL, "state");
efiAssertVoid(CUSTOM_ERR_PWM_DUTY_ASSERT, dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
efiAssertVoid(CUSTOM_ERR_PWM_CALLBACK_ASSERT, stateChangeCallback != NULL, "listener");
if (frequency < 1) {
warning(CUSTOM_OBD_LOW_FREQUENCY, "low frequency %.2f", frequency);
return;

View File

@ -70,6 +70,7 @@ public:
* We need to handle zero duty cycle and 100% duty cycle in a special way
*/
pwm_mode_e mode;
bool isStopRequested = false;
/**
* @param use NAN frequency to pause PWM
@ -83,6 +84,7 @@ public:
OutputPin *outputPins[PWM_PHASE_MAX_WAVE_PER_PWM];
MultiWave multiWave;
efitimeus_t togglePwmState();
void stop();
int dbgNestingLevel;

View File

@ -52,7 +52,7 @@ static void executorCallback(void *arg) {
efiAssertVoid(CUSTOM_ERR_6624, getCurrentRemainingStack() > 256, "lowstck#2y");
// callbackTime = getTimeNowNt();
// if((callbackTime > nextEventTimeNt) && (callbackTime - nextEventTimeNt > US2NT(5000))) {
// if ((callbackTime > nextEventTimeNt) && (callbackTime - nextEventTimeNt > US2NT(5000))) {
// timerIsLate++;
// }

View File

@ -14,7 +14,8 @@
#include "engine_controller.h"
#if EFI_PROD_CODE
#include "digital_input_hw.h"
#include "digital_input_icu.h"
#include "digital_input_exti.h"
#include "pin_repository.h"
#endif
@ -246,7 +247,7 @@ static void printMAPInfo(void) {
}
if (hasBaroSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
scheduleMsg(logger, "baro type=%d value=%.2f", engineConfiguration->baroSensor.type, getBaroPressure());
scheduleMsg(logger, "baro type=%d value=%.2f", engineConfiguration->baroSensor.type, getBaroPressure(PASS_ENGINE_PARAMETER_SIGNATURE));
if (engineConfiguration->baroSensor.type == MT_CUSTOM) {
scheduleMsg(logger, "min=%.2f@%.2f max=%.2f@%.2f",
engineConfiguration->baroSensor.lowValue,
@ -265,12 +266,22 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
//engine->configurationListeners.registerCallback(applyConfiguration);
#if HAL_USE_ICU
if (engineConfiguration->hasFrequencyReportingMapSensor) {
digital_input_s* digitalMapInput = addWaveAnalyzerDriver("map freq", CONFIGB(frequencyReportingMapInputPin));
startInputDriver("MAP", digitalMapInput, true);
#if HAL_USE_ICU
digital_input_s* digitalMapInput = startDigitalCapture("MAP freq", CONFIGB(frequencyReportingMapInputPin), true);
digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL);
digitalMapInput->setWidthCallback((VoidInt) digitalMapWidthCallback, NULL);
#else
#if EFI_PROD_CODE
efiExtiEnablePin(
"Frequency MAP",
CONFIGB(frequencyReportingMapInputPin),
PAL_EVENT_MODE_RISING_EDGE,
(palcallback_t)digitalMapWidthCallback,
nullptr
);
#endif /* EFI_PROD_CODE */
#endif /* HAL_USE_ICU */
}
if (CONFIG(useFixedBaroCorrFromMap)) {
@ -278,7 +289,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
storedInitialBaroPressure = getRawMap(PASS_ENGINE_PARAMETER_SIGNATURE);
scheduleMsg(logger, "Get initial baro MAP pressure = %.2fkPa", storedInitialBaroPressure);
// validate if it's within a reasonable range (the engine should not be spinning etc.)
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure);
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure PASS_ENGINE_PARAMETER_SUFFIX);
if (!cisnan(storedInitialBaroPressure)) {
scheduleMsg(logger, "Using this fixed MAP pressure to override the baro correction!");
} else {
@ -286,6 +297,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
}
#if EFI_PROD_CODE
addConsoleAction("mapinfo", printMAPInfo);
#endif
}

View File

@ -125,14 +125,18 @@ bool isValidIntakeAirTemperature(temperature_t temperature) {
}
bool hasCltSensorM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return engineConfiguration->clt.adcChannel != EFI_ADC_NONE;
bool haveSensorChannel = engineConfiguration->clt.adcChannel != EFI_ADC_NONE;
if (!haveSensorChannel) {
return false;
}
return !cisnan(engine->sensors.clt);
}
/**
* @return coolant temperature, in Celsius
*/
temperature_t getCoolantTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (!hasCltSensor()) {
if (engineConfiguration->clt.adcChannel == EFI_ADC_NONE) {
engine->isCltBroken = false;
return NO_CLT_SENSOR_TEMPERATURE;
}
@ -207,14 +211,18 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) {
}
bool hasIatSensorM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return engineConfiguration->iat.adcChannel != EFI_ADC_NONE;
bool haveSensorChannel = engineConfiguration->iat.adcChannel != EFI_ADC_NONE;
if (!haveSensorChannel) {
return false;
}
return !cisnan(engine->sensors.iat);
}
/**
* @return Celsius value
*/
temperature_t getIntakeAirTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (!hasIatSensor()) {
if (engineConfiguration->iat.adcChannel == EFI_ADC_NONE) {
return NO_IAT_SENSOR_TEMPERATURE;
}
float temperature = getTemperatureC(&engineConfiguration->iat, &engine->engineState.iatCurve,

View File

@ -173,8 +173,6 @@ const char* getConfigurationName(engine_type_e engineType) {
return "MX590";
case MIATA_1994_DEVIATOR:
return "MX594d";
case MIATA_1994_SPAGS:
return "MX594s";
case MIATA_1996:
return "MX596";
case BMW_E34:
@ -887,13 +885,11 @@ static void setSpiMode(int index, bool mode) {
printSpiState(&logger, boardConfiguration);
}
extern bool hwTriggerInputEnabled;
static void enableOrDisable(const char *param, bool isEnabled) {
if (strEqualCaseInsensitive(param, "fastadc")) {
boardConfiguration->isFastAdcEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, CMD_TRIGGER_HW_INPUT)) {
hwTriggerInputEnabled = isEnabled;
engine->hwTriggerInputEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "etb_auto")) {
engine->etbAutoTune = isEnabled;
} else if (strEqualCaseInsensitive(param, "cranking_constant_dwell")) {

Some files were not shown because too many files have changed in this diff Show More