Merge branch 'master' of https://github.com/rusefi/rusefi
This commit is contained in:
commit
53d5723e18
|
@ -0,0 +1,101 @@
|
|||
name: Firmware CI
|
||||
|
||||
on: [push,pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
# Let all builds finish even if one fails early
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# What boards should we build for? In the 'include' section below,
|
||||
# set up what each of these boards needs to build.
|
||||
build-target: [frankenso, frankenso-pal, mre-f4, mre-f7, prometheus-405, prometheus-469, proteus, kinetis]
|
||||
build-type: [debug, release]
|
||||
|
||||
include:
|
||||
# Board configurations
|
||||
- build-target: frankenso
|
||||
efi-cpu: ARCH_STM32F4
|
||||
efi-board: st_stm32f4
|
||||
|
||||
- build-target: frankenso-pal
|
||||
efi-cpu: ARCH_STM32F4
|
||||
efi-board: st_stm32f4
|
||||
target-extra-params: -DHAL_TRIGGER_USE_PAL=TRUE -DHAL_USE_ICU=FALSE -DEFI_VEHICLE_SPEED=FALSE -DEFI_LOGIC_ANALYZER=FALSE
|
||||
|
||||
- build-target: mre-f4
|
||||
efi-cpu: ARCH_STM32F4
|
||||
efi-board: microrusefi
|
||||
|
||||
- build-target: mre-f7
|
||||
efi-cpu: ARCH_STM32F7
|
||||
efi-board: microrusefi
|
||||
|
||||
- build-target: prometheus-405
|
||||
efi-cpu: ARCH_STM32F4
|
||||
efi-board: prometheus/f405
|
||||
|
||||
- build-target: prometheus-469
|
||||
efi-cpu: ARCH_STM32F4
|
||||
efi-board: prometheus/f469
|
||||
|
||||
- build-target: proteus
|
||||
efi-cpu: ARCH_STM32F7
|
||||
efi-board: proteus
|
||||
|
||||
- build-target: kinetis
|
||||
efi-cpu: kinetis
|
||||
efi-board: kinetis
|
||||
target-extra-params: -DCPU_MKE16F512VLH16 -DCPU_MKE16F512VLH16_cm4 -D__USE_CMSI -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS
|
||||
extra-options: USE_FATFS=no USE_BOOTLOADER=no
|
||||
|
||||
# Debug vs. release configuration
|
||||
- build-type: debug
|
||||
type-extra-params: -DDUMMY
|
||||
build-debug-level-opt: -O0 -ggdb -g3
|
||||
|
||||
- build-type: release
|
||||
type-extra-params: -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
build-debug-level-opt: -O2 -ggdb -g3
|
||||
|
||||
exclude:
|
||||
- build-target: kinetis
|
||||
build-type: debug
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: recursive
|
||||
|
||||
# Build machines don't have arm-none-eabi gcc, so let's download it and put it on the path
|
||||
- name: Download & Install GCC
|
||||
run: |
|
||||
wget 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2?revision=6e63531f-8cb1-40b9-bbfc-8a57cdfc01b4&la=en&hash=F761343D43A0587E8AC0925B723C04DBFB848339' -O compiler.tar.bz2
|
||||
tar -xvf compiler.tar.bz2
|
||||
echo "::add-path::`pwd`/gcc-arm-none-eabi-9-2019-q4-major/bin"
|
||||
|
||||
# Make sure the compiler we just downloaded works - just print out the version
|
||||
- name: Test Compiler
|
||||
run: arm-none-eabi-gcc -v
|
||||
|
||||
# Build the firmware!
|
||||
- name: Build Firmware
|
||||
working-directory: ./firmware/
|
||||
run: make -j4 PROJECT_BOARD=${{matrix.efi-board}} PROJECT_CPU=${{matrix.efi-cpu}} EXTRA_PARAMS="${{matrix.type-extra-params}} ${{matrix.target-extra-params}}" DEBUG_LEVEL_OPT='${{matrix.build-debug-level-opt}}' ${{matrix.extra-options}}
|
||||
|
||||
# The next two steps upload the bin and elf as build artifacts
|
||||
- name: Upload elf
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: firmware-${{matrix.build-target}}-${{matrix.build-type}}-elf
|
||||
path: ./firmware/build/rusefi.elf
|
||||
|
||||
- name: Upload bin
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: firmware-${{matrix.build-target}}-${{matrix.build-type}}-bin
|
||||
path: ./firmware/build/rusefi.bin
|
|
@ -0,0 +1,21 @@
|
|||
name: Simulator CI
|
||||
|
||||
on: [push,pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install Simulator Deps
|
||||
run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib
|
||||
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: recursive
|
||||
|
||||
- name: Build Simulator
|
||||
working-directory: ./simulator/
|
||||
run: make -j4
|
|
@ -1,6 +1,6 @@
|
|||
name: unit test ci
|
||||
name: Unit Test CI
|
||||
|
||||
on: [push]
|
||||
on: [push,pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
@ -7,6 +7,8 @@ CHIBIOS = ChibiOS
|
|||
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
|
||||
RULESFILE = $(RULESPATH)/rules.mk
|
||||
|
||||
include rusefi_rules.mk
|
||||
|
||||
# Define project name here
|
||||
PROJECT = rusefi
|
||||
PROJECT_DIR = .
|
||||
|
@ -35,9 +37,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 -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=type-limits -Wno-error=strict-aliasing -Wno-error=attributes
|
||||
endif
|
||||
|
||||
|
||||
USE_OPT += $(RUSEFI_OPT)
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
ifeq ($(USE_COPT),)
|
||||
USE_COPT = -fgnu89-inline -std=gnu99 -Werror-implicit-function-declaration
|
||||
|
@ -150,13 +155,7 @@ endif
|
|||
include $(PROJECT_DIR)/config/boards/$(PROJECT_BOARD)/board.mk
|
||||
include $(PROJECT_DIR)/config/engines/engines.mk
|
||||
include $(PROJECT_DIR)/console/console.mk
|
||||
include $(PROJECT_DIR)/controllers/algo/algo.mk
|
||||
include $(PROJECT_DIR)/controllers/controllers.mk
|
||||
include $(PROJECT_DIR)/controllers/core/core.mk
|
||||
include $(PROJECT_DIR)/controllers/math/math.mk
|
||||
include $(PROJECT_DIR)/controllers/sensors/sensors.mk
|
||||
include $(PROJECT_DIR)/controllers/system/system.mk
|
||||
include $(PROJECT_DIR)/controllers/trigger/trigger.mk
|
||||
include $(PROJECT_DIR)/development/development.mk
|
||||
include $(PROJECT_DIR)/hw_layer/hw_layer.mk
|
||||
include $(PROJECT_DIR)/hw_layer/drivers/drivers.mk
|
||||
|
@ -303,9 +302,7 @@ INCDIR = $(CHIBIOS)/os/license \
|
|||
$(DEVELOPMENT_DIR) \
|
||||
development/hw_layer \
|
||||
development/test \
|
||||
$(CONTROLLERS_INC) \
|
||||
controllers/sensors \
|
||||
controllers/sensors/converters
|
||||
$(CONTROLLERS_INC)
|
||||
|
||||
#
|
||||
# Project, sources and paths
|
||||
|
|
|
@ -4,7 +4,7 @@ echo Starting compilation for Prometheus-405
|
|||
|
||||
set PROJECT_BOARD=Prometheus
|
||||
set PROMETHEUS_BOARD=405
|
||||
set EXTRA_PARAMS=-DDUMMY -DEFI_BOOTLOADER -DSTM32F405xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE ^
|
||||
set EXTRA_PARAMS=-DDUMMY -DEFI_BOOTLOADER -DSTM32F405xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE ^
|
||||
-DBOARD_TLE8888_COUNT=0 ^
|
||||
-DBOARD_TLE6240_COUNT=0 ^
|
||||
-DBOARD_MC33972_COUNT=0 ^
|
||||
|
|
|
@ -4,7 +4,7 @@ echo Starting compilation for Prometheus-469
|
|||
|
||||
set PROJECT_BOARD=Prometheus
|
||||
set PROMETHEUS_BOARD=469
|
||||
set EXTRA_PARAMS=-DDUMMY -DEFI_BOOTLOADER -DSTM32F469xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE ^
|
||||
set EXTRA_PARAMS=-DDUMMY -DEFI_BOOTLOADER -DSTM32F469xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE ^
|
||||
-DBOARD_TLE8888_COUNT=0 ^
|
||||
-DBOARD_TLE6240_COUNT=0 ^
|
||||
-DBOARD_MC33972_COUNT=0 ^
|
||||
|
|
|
@ -4,7 +4,7 @@ echo Starting compilation for Discovery-407
|
|||
|
||||
rem set PROJECT_BOARD=Prometheus
|
||||
rem set PROMETHEUS_BOARD=405
|
||||
rem set EXTRA_PARAMS=-DDUMMY -DSTM32F405xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
rem set EXTRA_PARAMS=-DDUMMY -DSTM32F405xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set EXTRA_PARAMS=-DDUMMY -DEFI_BOOTLOADER ^
|
||||
-DCH_DBG_ENABLE_STACK_CHECK=FALSE ^
|
||||
-DBOARD_TLE8888_COUNT=0 ^
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
ifeq ($(DEBUG_LEVEL_OPT),)
|
||||
# this value would be used by default. For 'debug' configuration override with '-O0 -ggdb -g3' or something along these lines
|
||||
DEBUG_LEVEL_OPT = -O2
|
||||
DDEFS += -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
DDEFS += -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
endif
|
||||
|
||||
# disable some modules to shrink bootloader binary
|
||||
|
@ -156,34 +156,22 @@ CSRC = $(STARTUPSRC) \
|
|||
$(CHIBIOS)/os/various/syscalls.c \
|
||||
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
|
||||
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
|
||||
$(ENGINES_SRC) \
|
||||
$(CONSOLESRC) \
|
||||
$(DEV_SRC) \
|
||||
$(HW_LAYER_EMS) \
|
||||
$(HW_LAYER_DRIVERS_CORE) \
|
||||
$(CONTROLLERS_ALGO_SRC) \
|
||||
$(CONTROLLERS_CORE_SRC) \
|
||||
$(CONTROLLERS_SENSORS_SRC) \
|
||||
$(FATFSSRC) \
|
||||
$(SYSTEMSRC) \
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
CPPSRC = $(CHCPPSRC) \
|
||||
$(TRIGGER_SRC_CPP) \
|
||||
$(TRIGGER_DECODERS_SRC_CPP) \
|
||||
$(DEV_SRC_CPP) \
|
||||
$(CONTROLLERS_ALGO_SRC_CPP) \
|
||||
$(SYSTEMSRC_CPP) \
|
||||
$(BOARDSRC_CPP) \
|
||||
$(ENGINES_SRC_CPP) \
|
||||
$(HW_LAYER_EMS_CPP) \
|
||||
$(HW_SENSORS_SRC) \
|
||||
$(TUNERSTUDIO_SRC_CPP) \
|
||||
$(CONSOLE_SRC_CPP) \
|
||||
$(CONTROLLERS_SENSORS_SRC_CPP) \
|
||||
$(CONTROLLERS_CORE_SRC_CPP) \
|
||||
$(CONTROLLERS_MATH_SRC_CPP) \
|
||||
$(PROJECT_DIR)/console/binary/tunerstudio_io.cpp \
|
||||
$(PROJECT_DIR)/controllers/system/efi_gpio.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/engine_configuration.cpp \
|
||||
|
|
|
@ -31,8 +31,8 @@ LoggingWithStorage::LoggingWithStorage(const char *name) : Logging(name, DEFAULT
|
|||
|
||||
// this is supposed to be taken from chconf_common.h but it does not work? I am not sure why :(
|
||||
// TODO: make this be defined by chconf_common.h?
|
||||
#if ! ENABLE_PERF_TRACE
|
||||
//void irqEnterHook() {}
|
||||
//void irqExitHook() {}
|
||||
//void contextSwitchHook() {}
|
||||
#endif /* ENABLE_PERF_TRACE */
|
||||
//#if ! ENABLE_PERF_TRACE
|
||||
void irqEnterHook() {}
|
||||
void irqExitHook() {}
|
||||
void contextSwitchHook() {}
|
||||
//#endif /* ENABLE_PERF_TRACE */
|
|
@ -7,7 +7,7 @@ mkdir deliver
|
|||
|
||||
call clean.bat
|
||||
echo "TIMESTAMP %date% %time%"
|
||||
set EXTRA_PARAMS=-DDUMMY -DFIRMWARE_ID=\"default_no_assert\" -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set EXTRA_PARAMS=-DDUMMY -DFIRMWARE_ID=\"default_no_assert\" -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
make -j4 DEBUG_LEVEL_OPT='-O2'
|
||||
set EXTRA_PARAMS=
|
||||
|
||||
|
|
|
@ -7,3 +7,7 @@ set PROJECT_CPU=
|
|||
set USE_BOOTLOADER=
|
||||
set DEFAULT_ENGINE_TYPE=
|
||||
set EFI_FATAL_ERROR_PIN=
|
||||
set BUILDDIR=
|
||||
set DEBUG_LEVEL_OPT=
|
||||
set USE_FATFS=
|
||||
|
||||
|
|
|
@ -15,4 +15,6 @@ echo %script_name%: invoking hex2dfu.exe
|
|||
cp build/rusefi.bin deliver/
|
||||
|
||||
echo %script_name%: deliver folder
|
||||
ls -l deliver
|
||||
ls -l deliver
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
cd ../../..
|
||||
|
||||
set EXTRA_PARAMS=-DDUMMY ^
|
||||
-DHAL_TRIGGER_USE_PAL=TRUE ^
|
||||
-DEFI_VEHICLE_SPEED=FALSE ^
|
||||
-DHAL_USE_ICU=FALSE ^
|
||||
-DEFI_LOGIC_ANALYZER=FALSE ^
|
||||
-DDEFAULT_ENGINE_TYPE=MIATA_NA6_VAF ^
|
||||
-DFIRMWARE_ID=\"frankensoNA6\"
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
|
@ -7,4 +7,3 @@ set EXTRA_PARAMS=-DDUMMY ^
|
|||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -2,10 +2,10 @@ echo "Compiling for Kinetis MKE16F512"
|
|||
rem TODO: somehow this -DDUMMY is helping us to not mess up the parameters, why?!
|
||||
rem https://github.com/rusefi/rusefi/issues/684
|
||||
set EXTRA_PARAMS=-DDUMMY -DCPU_MKE16F512VLH16 -DCPU_MKE16F512VLH16_cm4 -D__USE_CMSIS^
|
||||
-DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE^
|
||||
-DFIRMWARE_ID=\"kinetis\" ^
|
||||
-DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE^
|
||||
-DDEFAULT_ENGINE_TYPE=MINIMAL_PINS
|
||||
set BUILDDIR=build_kinetis
|
||||
rem set BUILDDIR=build_kinetis
|
||||
set BUILDDIR=build
|
||||
set PROJECT_BOARD=kinetis
|
||||
set PROJECT_CPU=kinetis
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
|
@ -15,9 +15,8 @@ rem -DCH_DBG_ENABLE_CHECKS=FALSE
|
|||
|
||||
cd ../../..
|
||||
|
||||
rm -f build_kinetis/rusefi_kinetis.*
|
||||
rem rm -f ${BUILDDIR}/rusefi_kinetis.*
|
||||
|
||||
make -r -j4 2> err.log
|
||||
rem rm -f build/rusefi.dfu
|
||||
rem dir build
|
||||
rem ..\misc\hex2dfu\HEX2DFU.exe build/rusefi.hex -out build/rusefi.dfu
|
||||
rem make -r -j4
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
|
|
@ -112,8 +112,12 @@ void comp_lld_init(void) {
|
|||
static void comp_lld_irq_handler(COMPDriver *compp) {
|
||||
if (compp->config->cb != NULL)
|
||||
compp->config->cb(compp);
|
||||
// clear flags to continue
|
||||
ACMP_ClearStatusFlags(compp->reg, kACMP_OutputRisingEventFlag | kACMP_OutputFallingEventFlag);
|
||||
|
||||
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
|
||||
exception return operation might vector to incorrect interrupt */
|
||||
#if defined __CORTEX_M && (__CORTEX_M == 4U)
|
||||
__DSB();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,9 +160,10 @@ OSAL_IRQ_HANDLER(KINETIS_COMP2_IRQ_VECTOR) {
|
|||
void comp_lld_channel_enable(COMPDriver *compp, uint32_t channel) {
|
||||
osalDbgAssert(channel <= 7, "invalid channel number");
|
||||
memset(&compp->acmpChannelCfg, 0, sizeof(compp->acmpChannelCfg));
|
||||
compp->acmpChannelCfg.positivePortInput = kACMP_PortInputFromDAC;
|
||||
compp->acmpChannelCfg.negativePortInput = kACMP_PortInputFromMux;
|
||||
compp->acmpChannelCfg.minusMuxInput = channel;
|
||||
compp->acmpChannelCfg.positivePortInput = kACMP_PortInputFromMux;
|
||||
compp->acmpChannelCfg.plusMuxInput = channel;
|
||||
compp->acmpChannelCfg.negativePortInput = kACMP_PortInputFromDAC;
|
||||
compp->acmpChannelCfg.minusMuxInput = 0U;
|
||||
ACMP_SetChannelConfig(compp->reg, &compp->acmpChannelCfg);
|
||||
}
|
||||
|
||||
|
@ -183,8 +188,6 @@ void comp_lld_channel_disable(COMPDriver *compp, uint32_t channel) {
|
|||
* @notapi
|
||||
*/
|
||||
void comp_lld_set_dac_value(COMPDriver *compp, uint32_t value) {
|
||||
memset(&compp->acmpDacCfg, 0, sizeof(compp->acmpDacCfg));
|
||||
compp->acmpDacCfg.referenceVoltageSource = kACMP_VrefSourceVin1; // connected to VDDA on KE1xF
|
||||
compp->acmpDacCfg.DACValue = value;
|
||||
ACMP_SetDACConfig(compp->reg, &compp->acmpDacCfg);
|
||||
}
|
||||
|
@ -200,8 +203,23 @@ void comp_lld_start(COMPDriver *compp) {
|
|||
ACMP_GetDefaultConfig(&compp->acmpCfg);
|
||||
if (compp->config->output_mode == COMP_OUTPUT_INVERTED)
|
||||
compp->acmpCfg.enableInvertOutput = true;
|
||||
compp->acmpCfg.enableHighSpeed = true;
|
||||
compp->acmpCfg.useUnfilteredOutput = true; //false;
|
||||
compp->acmpCfg.hysteresisMode = kACMP_HysteresisLevel2; // L1=~16mV, L2=~32mV
|
||||
|
||||
ACMP_Init(compp->reg, &compp->acmpCfg);
|
||||
compp->irq_mask = 0;
|
||||
|
||||
#if 0
|
||||
acmp_filter_config_t filterCfg = { 0 };
|
||||
filterCfg.filterCount = 2U;
|
||||
filterCfg.filterPeriod = 2U;
|
||||
filterCfg.enableSample = false;
|
||||
ACMP_SetFilterConfig(compp->reg, &filterCfg);
|
||||
#endif
|
||||
|
||||
memset(&compp->acmpDacCfg, 0, sizeof(compp->acmpDacCfg));
|
||||
compp->acmpDacCfg.referenceVoltageSource = kACMP_VrefSourceVin1; // connected to VDDA on KE1xF
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,7 +267,10 @@ void comp_lld_disable(COMPDriver *compp) {
|
|||
}
|
||||
|
||||
uint32_t comp_lld_get_status(COMPDriver *compp) {
|
||||
return ACMP_GetStatusFlags(compp->reg);
|
||||
uint32_t status = ACMP_GetStatusFlags(compp->reg);
|
||||
// clear flags to continue
|
||||
ACMP_ClearStatusFlags(compp->reg, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_COMP */
|
||||
|
|
|
@ -20,4 +20,4 @@ PLATFORMINC += $(PLATFORMINC_CONTRIB)
|
|||
# Using external ChibiOS-Contrib code for Comparator HAL
|
||||
HALSRC += $(CHIBIOS_CONTRIB)/os/hal/src/hal_comp.c
|
||||
|
||||
HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/trigger_input_comp.cpp
|
||||
|
||||
|
|
|
@ -609,7 +609,7 @@ extern "C"
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#ifndef CH_DBG_ENABLE_TRACE
|
||||
#define CH_DBG_ENABLE_TRACE TRUE
|
||||
#define CH_DBG_ENABLE_TRACE FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -823,6 +823,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
|
|||
} \
|
||||
} while (false)
|
||||
|
||||
#define ENABLE_PERF_TRACE FALSE
|
||||
#define TRACE_BUFFER_LENGTH 1
|
||||
|
||||
#endif /* CHCONF_H */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -12,4 +12,4 @@ CPU_HWLAYER = ports/kinetis
|
|||
|
||||
GENERATED_ENUMS_DIR = $(BOARD_DIR)/config/controllers/algo
|
||||
|
||||
EXTRA_PARAMS += -nodefaultlibs -L$(PROJECT_DIR)/config/boards/$(PROJECT_BOARD)/libc -lgcc -ltinyc
|
||||
EXTRA_PARAMS += -DFIRMWARE_ID=\"kinetis\" -nodefaultlibs -L$(PROJECT_DIR)/config/boards/$(PROJECT_BOARD)/libc -lgcc -ltinyc
|
||||
|
|
|
@ -21,9 +21,12 @@ mkdir build_kinetis
|
|||
|
||||
java ^
|
||||
-DSystemOut.name=gen_config ^
|
||||
-Drusefi.generator.lazyfile.enabled=true ^
|
||||
-jar ../java_tools/ConfigDefinition.jar ^
|
||||
-definition integration/rusefi_config.txt ^
|
||||
-ts_destination tunerstudio ^
|
||||
-with_c_defines false ^
|
||||
-initialize_to_zero false ^
|
||||
-ts_output_name rusefi_kinetis.ini ^
|
||||
-c_defines config/boards/kinetis/config/controllers/algo/rusefi_generated.h ^
|
||||
-c_destination config/boards/kinetis/config/controllers/algo/engine_configuration_generated_structures.h ^
|
||||
|
|
|
@ -627,6 +627,8 @@ case NISSAN_PRIMERA:
|
|||
return "NISSAN_PRIMERA";
|
||||
case PROMETHEUS_DEFAULTS:
|
||||
return "PROMETHEUS_DEFAULTS";
|
||||
case PROTEUS:
|
||||
return "PROTEUS";
|
||||
case ROVER_V8:
|
||||
return "ROVER_V8";
|
||||
case SACHS:
|
||||
|
@ -861,6 +863,8 @@ case SC_DETAILED_RPM:
|
|||
return "SC_DETAILED_RPM";
|
||||
case SC_MAP:
|
||||
return "SC_MAP";
|
||||
case SC_AUX_FAST1:
|
||||
return "SC_AUX_FAST1";
|
||||
case SC_OFF:
|
||||
return "SC_OFF";
|
||||
case SC_RPM_ACCEL:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -97,6 +97,8 @@
|
|||
#define autoTuneTpsRocThreshold_offset_hex 978
|
||||
#define AUX_DIGITAL_VALVE_COUNT 2
|
||||
#define AUX_PID_COUNT 4
|
||||
#define auxFastSensor1_adcChannel_offset 680
|
||||
#define auxFastSensor1_adcChannel_offset_hex 2a8
|
||||
#define auxPid1_dFactor_offset 2620
|
||||
#define auxPid1_dFactor_offset_hex a3c
|
||||
#define auxPid1_iFactor_offset 2616
|
||||
|
@ -362,14 +364,10 @@
|
|||
#define cltTimingExtra_offset_hex 950
|
||||
#define clutchDownPin_offset 664
|
||||
#define clutchDownPin_offset_hex 298
|
||||
#define clutchDownPinInverted_offset 976
|
||||
#define clutchDownPinInverted_offset_hex 3d0
|
||||
#define clutchDownPinMode_offset 667
|
||||
#define clutchDownPinMode_offset_hex 29b
|
||||
#define clutchUpPin_offset 969
|
||||
#define clutchUpPin_offset_hex 3c9
|
||||
#define clutchUpPinInverted_offset 976
|
||||
#define clutchUpPinInverted_offset_hex 3d0
|
||||
#define clutchUpPinMode_offset 971
|
||||
#define clutchUpPinMode_offset_hex 3cb
|
||||
#define CMD_CALIBRATE_PEDAL_DOWN "calibrate_pedal_down"
|
||||
|
@ -377,7 +375,9 @@
|
|||
#define CMD_DATE "date"
|
||||
#define CMD_DISABLE "disable"
|
||||
#define CMD_ENABLE "enable"
|
||||
#define CMD_ENGINE_TYPE "engine_type"
|
||||
#define CMD_ETB_DUTY "set_etb_duty"
|
||||
#define CMD_PINS "pins"
|
||||
#define CMD_REBOOT "reboot"
|
||||
#define CMD_REBOOT_DFU "reboot_dfu"
|
||||
#define CMD_TRIGGER_HW_INPUT "trigger_hw_input"
|
||||
|
@ -450,6 +450,8 @@
|
|||
#define cylindersCount_offset 400
|
||||
#define cylindersCount_offset_hex 190
|
||||
#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "INVALID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "Aux Temperature", "ETB Logic"
|
||||
#define debugMapAveraging_offset 807
|
||||
#define debugMapAveraging_offset_hex 327
|
||||
#define debugMode_offset 2092
|
||||
#define debugMode_offset_hex 82c
|
||||
#define debugSetTimer_offset 806
|
||||
|
@ -508,31 +510,8 @@
|
|||
#define engineSnifferRpmThreshold_offset_hex 4
|
||||
#define engineType_offset 0
|
||||
#define engineType_offset_hex 0
|
||||
#define etb1_controlPin1_offset 682
|
||||
#define etb1_controlPin1_offset_hex 2aa
|
||||
#define etb1_controlPinMode_offset 683
|
||||
#define etb1_controlPinMode_offset_hex 2ab
|
||||
#define etb1_directionPin1_offset 680
|
||||
#define etb1_directionPin1_offset_hex 2a8
|
||||
#define etb1_directionPin2_offset 681
|
||||
#define etb1_directionPin2_offset_hex 2a9
|
||||
#define etb1_offset 680
|
||||
#define etb1_offset_hex 2a8
|
||||
#define etb1_use_two_wires_offset 76
|
||||
#define etb1_use_two_wires_offset_hex 4c
|
||||
#define etb2_controlPin1_offset 3966
|
||||
#define etb2_controlPin1_offset_hex f7e
|
||||
#define etb2_controlPinMode_offset 3967
|
||||
#define etb2_controlPinMode_offset_hex f7f
|
||||
#define etb2_directionPin1_offset 3964
|
||||
#define etb2_directionPin1_offset_hex f7c
|
||||
#define etb2_directionPin2_offset 3965
|
||||
#define etb2_directionPin2_offset_hex f7d
|
||||
#define etb2_offset 3964
|
||||
#define etb2_offset_hex f7c
|
||||
#define etb2_use_two_wires_offset 76
|
||||
#define etb2_use_two_wires_offset_hex 4c
|
||||
#define ETB_BIAS_CURVE_LENGTH 8
|
||||
#define ETB_COUNT 2
|
||||
#define etb_dFactor_offset 1744
|
||||
#define etb_dFactor_offset_hex 6d0
|
||||
#define etb_iFactor_offset 1740
|
||||
|
@ -553,6 +532,8 @@
|
|||
#define etb_periodMs_offset_hex 6d6
|
||||
#define etb_pFactor_offset 1736
|
||||
#define etb_pFactor_offset_hex 6c8
|
||||
#define etb_use_two_wires_offset 76
|
||||
#define etb_use_two_wires_offset_hex 4c
|
||||
#define etbBiasBins_offset 3888
|
||||
#define etbBiasBins_offset_hex f30
|
||||
#define etbBiasValues_offset 3920
|
||||
|
@ -563,10 +544,28 @@
|
|||
#define etbDeadband_offset_hex f78
|
||||
#define etbFreq_offset 2514
|
||||
#define etbFreq_offset_hex 9d2
|
||||
#define etbIdleRange_offset 972
|
||||
#define etbIdleRange_offset_hex 3cc
|
||||
#define etbIdleThrottleRange_offset 4012
|
||||
#define etbIdleThrottleRange_offset_hex fac
|
||||
#define etbIo1_controlPin1_offset 982
|
||||
#define etbIo1_controlPin1_offset_hex 3d6
|
||||
#define etbIo1_controlPinMode_offset 983
|
||||
#define etbIo1_controlPinMode_offset_hex 3d7
|
||||
#define etbIo1_directionPin1_offset 980
|
||||
#define etbIo1_directionPin1_offset_hex 3d4
|
||||
#define etbIo1_directionPin2_offset 981
|
||||
#define etbIo1_directionPin2_offset_hex 3d5
|
||||
#define etbIo1_offset 980
|
||||
#define etbIo1_offset_hex 3d4
|
||||
#define etbIo2_controlPin1_offset 986
|
||||
#define etbIo2_controlPin1_offset_hex 3da
|
||||
#define etbIo2_controlPinMode_offset 987
|
||||
#define etbIo2_controlPinMode_offset_hex 3db
|
||||
#define etbIo2_directionPin1_offset 984
|
||||
#define etbIo2_directionPin1_offset_hex 3d8
|
||||
#define etbIo2_directionPin2_offset 985
|
||||
#define etbIo2_directionPin2_offset_hex 3d9
|
||||
#define etbIo2_offset 984
|
||||
#define etbIo2_offset_hex 3d8
|
||||
#define etbNeutralPosition_offset 1471
|
||||
#define etbNeutralPosition_offset_hex 5bf
|
||||
#define externalKnockSenseAdc_offset 3103
|
||||
|
@ -1609,7 +1608,7 @@
|
|||
#define sdCardSpiDevice_offset_hex a20
|
||||
#define secondTriggerChannelEnabled_offset 1476
|
||||
#define secondTriggerChannelEnabled_offset_hex 5c4
|
||||
#define sensor_chart_e_enum "none", "trigger", "MAP", "RPM ACCEL", "DETAILED RPM", "INVALID"
|
||||
#define sensor_chart_e_enum "none", "trigger", "MAP", "RPM ACCEL", "DETAILED RPM", "Fast Aux1", "INVALID", "INVALID"
|
||||
#define sensorChartFrequency_offset 520
|
||||
#define sensorChartFrequency_offset_hex 208
|
||||
#define sensorChartMode_offset 944
|
||||
|
@ -1681,6 +1680,10 @@
|
|||
#define spi3SckMode_offset_hex a2a
|
||||
#define spi3sckPin_offset 936
|
||||
#define spi3sckPin_offset_hex 3a8
|
||||
#define starterRelayPin_offset 808
|
||||
#define starterRelayPin_offset_hex 328
|
||||
#define starterRelayPinMode_offset 809
|
||||
#define starterRelayPinMode_offset_hex 329
|
||||
#define startOfCrankingPrimingPulse_offset 2032
|
||||
#define startOfCrankingPrimingPulse_offset_hex 7f0
|
||||
#define startUpFuelPumpDuration_offset 1892
|
||||
|
@ -1795,6 +1798,10 @@
|
|||
#define tle8888_csPinMode_offset_hex c22
|
||||
#define tle8888spiDevice_offset 4000
|
||||
#define tle8888spiDevice_offset_hex fa0
|
||||
#define todoClutchDownPinInverted_offset 976
|
||||
#define todoClutchDownPinInverted_offset_hex 3d0
|
||||
#define todoClutchUpPinInverted_offset 976
|
||||
#define todoClutchUpPinInverted_offset_hex 3d0
|
||||
#define TOP_DEAD_CENTER_MESSAGE "r"
|
||||
#define TOTAL_CONFIG_SIZE 20000
|
||||
#define TOTAL_CONFIG_SIZE_hex 4e20
|
||||
|
@ -1802,6 +1809,10 @@
|
|||
#define tps1_1AdcChannel_offset_hex 200
|
||||
#define tps2_1AdcChannel_offset 515
|
||||
#define tps2_1AdcChannel_offset_hex 203
|
||||
#define tps2Max_offset 1770
|
||||
#define tps2Max_offset_hex 6ea
|
||||
#define tps2Min_offset 1768
|
||||
#define tps2Min_offset_hex 6e8
|
||||
#define TPS_TPS_ACCEL_TABLE 8
|
||||
#define tpsAccelEnrichmentThreshold_offset 2048
|
||||
#define tpsAccelEnrichmentThreshold_offset_hex 800
|
||||
|
@ -1846,6 +1857,14 @@
|
|||
#define trigger_unusedCustomNeedSecondTriggerInput_offset_hex 210
|
||||
#define trigger_useOnlyFirstChannel_offset 528
|
||||
#define trigger_useOnlyFirstChannel_offset_hex 210
|
||||
#define triggerCompCenterVolt_offset 4036
|
||||
#define triggerCompCenterVolt_offset_hex fc4
|
||||
#define triggerCompHystMax_offset 4038
|
||||
#define triggerCompHystMax_offset_hex fc6
|
||||
#define triggerCompHystMin_offset 4037
|
||||
#define triggerCompHystMin_offset_hex fc5
|
||||
#define triggerCompSensorSatRpm_offset 4039
|
||||
#define triggerCompSensorSatRpm_offset_hex fc7
|
||||
#define triggerErrorPin_offset 828
|
||||
#define triggerErrorPin_offset_hex 33c
|
||||
#define triggerErrorPinMode_offset 829
|
||||
|
@ -1892,10 +1911,12 @@
|
|||
#define uartConsoleSerialSpeed_offset_hex 81c
|
||||
#define unrealisticRpmThreashold_offset 760
|
||||
#define unrealisticRpmThreashold_offset_hex 2f8
|
||||
#define unused1059_offset 3964
|
||||
#define unused1059_offset_hex f7c
|
||||
#define unused1234234_offset 2042
|
||||
#define unused1234234_offset_hex 7fa
|
||||
#define unused_1484_bit_21_offset 1476
|
||||
#define unused_1484_bit_21_offset_hex 5c4
|
||||
#define unused556_offset 681
|
||||
#define unused556_offset_hex 2a9
|
||||
#define unused_1484_bit_22_offset 1476
|
||||
#define unused_1484_bit_22_offset_hex 5c4
|
||||
#define unused_1484_bit_23_offset 1476
|
||||
|
@ -1920,22 +1941,22 @@
|
|||
#define unused_board_984_31_offset_hex 2e8
|
||||
#define unused_former_warmup_target_afr_offset 2096
|
||||
#define unused_former_warmup_target_afr_offset_hex 830
|
||||
#define unused_offset 972
|
||||
#define unused_offset_hex 3cc
|
||||
#define unusedAnotherOne_offset 744
|
||||
#define unusedAnotherOne_offset_hex 2e8
|
||||
#define unusedAtBoardConfigurationEnd_offset 980
|
||||
#define unusedAtBoardConfigurationEnd_offset_hex 3d4
|
||||
#define unusedAtOldBoardConfigurationEnd_offset 988
|
||||
#define unusedAtOldBoardConfigurationEnd_offset_hex 3dc
|
||||
#define unusedErrorPin_offset 2040
|
||||
#define unusedErrorPin_offset_hex 7f8
|
||||
#define unusedFlexFuelSensor_offset 3100
|
||||
#define unusedFlexFuelSensor_offset_hex c1c
|
||||
#define unusedFormerWarmupAfrPid_offset 1768
|
||||
#define unusedFormerWarmupAfrPid_offset_hex 6e8
|
||||
#define unusedFormerWarmupAfrPid_offset 1772
|
||||
#define unusedFormerWarmupAfrPid_offset_hex 6ec
|
||||
#define unusedHereo_wires_offset 76
|
||||
#define unusedHereo_wires_offset_hex 4c
|
||||
#define unusedOldWarmupAfr_offset 744
|
||||
#define unusedOldWarmupAfr_offset_hex 2e8
|
||||
#define unusedSpiPadding2_offset 807
|
||||
#define unusedSpiPadding2_offset_hex 327
|
||||
#define unusedSpiPadding3_offset 4036
|
||||
#define unusedSpiPadding3_offset_hex fc4
|
||||
#define unusedSpiPadding4_offset 2593
|
||||
#define unusedSpiPadding4_offset_hex a21
|
||||
#define unusedSpiPadding5_offset 2713
|
||||
|
@ -1944,8 +1965,8 @@
|
|||
#define unusedSpiPadding7_offset_hex fa5
|
||||
#define unusedSpiPadding8_offset 4009
|
||||
#define unusedSpiPadding8_offset_hex fa9
|
||||
#define unuseduartPadding1_offset 808
|
||||
#define unuseduartPadding1_offset_hex 328
|
||||
#define unuseduartPadding1_offset 810
|
||||
#define unuseduartPadding1_offset_hex 32a
|
||||
#define unusuedsw_offset 4020
|
||||
#define unusuedsw_offset_hex fb4
|
||||
#define unusuedvref_offset 4016
|
||||
|
@ -1984,6 +2005,8 @@
|
|||
#define useFSIO8ForServo1_offset_hex 5b8
|
||||
#define useFSIO9ForServo2_offset 1464
|
||||
#define useFSIO9ForServo2_offset_hex 5b8
|
||||
#define useIacPidMultTable_offset 1476
|
||||
#define useIacPidMultTable_offset_hex 5c4
|
||||
#define useIacTableForCoasting_offset 744
|
||||
#define useIacTableForCoasting_offset_hex 2e8
|
||||
#define useIdleTimingPidControl_offset 744
|
||||
|
@ -2037,6 +2060,7 @@
|
|||
#define veRpmBins_offset_hex 4860
|
||||
#define veTable_offset 17440
|
||||
#define veTable_offset_hex 4420
|
||||
#define VOLTAGE_1_BYTE_PACKING_DIV 0.02
|
||||
#define vRefAdcChannel_offset 1470
|
||||
#define vRefAdcChannel_offset_hex 5be
|
||||
#define vvt_mode_e_enum "First half", "Second half", "2GZ", "Miata NB2", "mode4", "mode5", "mode6", "mode7"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
* probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
|
||||
* CH_DBG_ENABLE_CHECKS
|
||||
* CH_DBG_ENABLE_ASSERTS
|
||||
* CH_DBG_ENABLE_TRACE
|
||||
* in chconf.h
|
||||
*
|
||||
*/
|
||||
|
@ -56,8 +55,8 @@
|
|||
/**
|
||||
* Build-in logic analyzer support. Logic analyzer viewer is one of the java console panes.
|
||||
*/
|
||||
#ifndef EFI_WAVE_ANALYZER
|
||||
#define EFI_WAVE_ANALYZER FALSE
|
||||
#ifndef EFI_LOGIC_ANALYZER
|
||||
#define EFI_LOGIC_ANALYZER FALSE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_ICU_INPUTS
|
||||
|
@ -176,12 +175,12 @@
|
|||
#define EFI_IDLE_CONTROL TRUE
|
||||
#endif
|
||||
|
||||
#define EFI_IDLE_INCREMENTAL_PID_CIC FALSE
|
||||
#define EFI_IDLE_PID_CIC FALSE
|
||||
|
||||
/**
|
||||
* Control the main power relay based on measured ignition voltage (Vbatt)
|
||||
*/
|
||||
#define EFI_MAIN_RELAY_CONTROL FALSE
|
||||
#define EFI_MAIN_RELAY_CONTROL TRUE
|
||||
|
||||
#ifndef EFI_PWM
|
||||
#define EFI_PWM FALSE
|
||||
|
@ -337,6 +336,7 @@
|
|||
#define EFI_COMP_PRIMARY_DEVICE (&COMPD3)
|
||||
#define EFI_COMP_TRIGGER_CHANNEL 6 // =E7
|
||||
//#define EFI_TRIGGER_DEBUG_BLINK TRUE
|
||||
//#define EFI_TRIGGER_COMP_ADAPTIVE_HYSTERESIS TRUE
|
||||
|
||||
#define LED_WARNING_BRAIN_PIN GPIOD_13
|
||||
|
||||
|
@ -407,7 +407,7 @@
|
|||
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
||||
#define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
||||
|
||||
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FLASH_ADDR
|
||||
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH (FLASH_ADDR + offsetof(persistent_config_container_s, persistentConfiguration.engineConfiguration))
|
||||
|
||||
//#define PWM_PHASE_MAX_COUNT 122
|
||||
|
||||
|
|
|
@ -8,9 +8,7 @@ set PROJECT_CPU=ARCH_STM32F7
|
|||
set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^
|
||||
-DEFI_ENABLE_ASSERTS=FALSE ^
|
||||
-DEFI_USE_OSC=TRUE ^
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
|
@ -7,4 +7,4 @@ set DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=MRE_BOARD_TEST
|
|||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
||||
|
|
|
@ -6,4 +6,4 @@ set PROJECT_CPU=ARCH_STM32F4
|
|||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
||||
|
|
|
@ -9,4 +9,3 @@ set DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=MRE_BOARD_TEST
|
|||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -8,4 +8,3 @@ set PROJECT_CPU=ARCH_STM32F7
|
|||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -16,4 +16,3 @@ rem -DDEFAULT_ENGINE_TYPE=MRE_BOARD_TEST
|
|||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -93,9 +93,9 @@ static void setupEtb() {
|
|||
// DIS - disables motor (enable low)
|
||||
|
||||
// PWM pin
|
||||
boardConfiguration->etb1.controlPin1 = GPIOC_7;
|
||||
engineConfiguration->etbIo[0].controlPin1 = GPIOC_7;
|
||||
// DIR pin
|
||||
boardConfiguration->etb1.directionPin1 = GPIOA_8;
|
||||
engineConfiguration->etbIo[0].directionPin1 = GPIOA_8;
|
||||
|
||||
// set_fsio_output_pin 7 PC8
|
||||
#if EFI_FSIO
|
||||
|
@ -113,10 +113,10 @@ static void setupEtb() {
|
|||
// engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
|
||||
|
||||
// Unused
|
||||
boardConfiguration->etb1.directionPin2 = GPIO_UNASSIGNED;
|
||||
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
|
||||
|
||||
// we only have pwm/dir, no dira/dirb
|
||||
engineConfiguration->etb1_use_two_wires = false;
|
||||
engineConfiguration->etb_use_two_wires = false;
|
||||
|
||||
engineConfiguration->etbFreq = 800;
|
||||
}
|
||||
|
|
|
@ -19,4 +19,3 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F746xx ^
|
|||
set DEBUG_LEVEL_OPT="-O2"
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
|
@ -14,9 +14,8 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^
|
|||
-DEFI_COMMUNICATION_PIN=GPIOB_7 ^
|
||||
-DEFI_FATAL_ERROR_PIN=GPIOB_14 ^
|
||||
-DEFI_ENABLE_ASSERTS=FALSE ^
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -12,11 +12,10 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^
|
|||
-DEFI_FATAL_ERROR_PIN=GPIOB_14 ^
|
||||
-DEFI_ENABLE_ASSERTS=FALSE ^
|
||||
-DEFI_USE_OSC=TRUE ^
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
|
||||
rem Do not forget to comment out following line if looking to debug!
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -69,7 +69,7 @@ void setBoardConfigurationOverrides(void) {
|
|||
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
|
||||
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
|
||||
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
|
||||
boardConfiguration->max31855spiDevice = SPI_NONE;
|
||||
|
|
|
@ -3,14 +3,7 @@ rem STM32F405 version of the firmware for https://rusefi.com/forum/viewtopic.php
|
|||
rem
|
||||
|
||||
cd ../../..
|
||||
set PROJECT_BOARD=prometheus
|
||||
set PROMETHEUS_BOARD=405
|
||||
set EXTRA_PARAMS=-DDUMMY -DSTM32F405xx -DEFI_ENABLE_ASSERTS=FALSE ^
|
||||
-DFIRMWARE_ID=\"prometheus405\" ^
|
||||
-DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
set USE_BOOTLOADER=yes
|
||||
set PROJECT_BOARD=prometheus/f405
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
|
@ -3,14 +3,8 @@ rem STM32F469 version of the firmware for https://rusefi.com/forum/viewtopic.php
|
|||
rem
|
||||
|
||||
cd ../../..
|
||||
set PROJECT_BOARD=prometheus
|
||||
set PROMETHEUS_BOARD=469
|
||||
set EXTRA_PARAMS=-DDUMMY -DSTM32F469xx -DEFI_ENABLE_ASSERTS=FALSE ^
|
||||
-DFIRMWARE_ID=\"prometeus469\" ^
|
||||
-DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
set PROJECT_BOARD=prometheus/f469
|
||||
set USE_BOOTLOADER=yes
|
||||
|
||||
call config/boards/common_make.bat
|
||||
|
||||
call config/boards/clean_env_variables.bat
|
||||
|
|
|
@ -191,7 +191,7 @@ void setBoardConfigurationOverrides(void) {
|
|||
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
|
||||
|
||||
// starter block
|
||||
setFsio(0, (is469 ? GPIOB_10 : GPIOB_1), STARTER_BLOCK PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setFsio(0, (is469 ? GPIOB_10 : GPIOB_1), STARTER_RELAY_LOGIC PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
|
||||
// debug pad
|
||||
|
@ -215,7 +215,7 @@ void setBoardConfigurationOverrides(void) {
|
|||
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
|
||||
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
|
||||
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
|
||||
boardConfiguration->max31855spiDevice = SPI_NONE;
|
||||
|
|
|
@ -105,8 +105,8 @@
|
|||
#undef EFI_MEMS
|
||||
#define EFI_MEMS FALSE
|
||||
|
||||
#undef EFI_IDLE_INCREMENTAL_PID_CIC
|
||||
#define EFI_IDLE_INCREMENTAL_PID_CIC TRUE
|
||||
#undef EFI_IDLE_PID_CIC
|
||||
#define EFI_IDLE_PID_CIC TRUE
|
||||
|
||||
#define RPM_LOW_THRESHOLD 8 // RPM=8 is an empirical lower sensitivity threshold of MAX9926 for 60-2
|
||||
#define NO_RPM_EVENTS_TIMEOUT_SECS 5 // (RPM < 12)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
PROMETHEUS_BOARD = 405
|
||||
|
||||
include $(PROJECT_DIR)/config/boards/prometheus/prometheus-common.mk
|
|
@ -0,0 +1,3 @@
|
|||
PROMETHEUS_BOARD = 469
|
||||
|
||||
include $(PROJECT_DIR)/config/boards/prometheus/prometheus-common.mk
|
|
@ -7,17 +7,25 @@ BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/Prometheus/board_configuration.cpp
|
|||
# Required include directories
|
||||
BOARDINC = $(PROJECT_DIR)/config/boards/prometheus
|
||||
|
||||
# Override LD script
|
||||
ifeq ($(USE_BOOTLOADER),yes)
|
||||
# include Prometheus bootloader code
|
||||
BOOTLOADERINC= $(PROJECT_DIR)/bootloader/prometheus/$(PROMETHEUS_BOARD)
|
||||
# This board uses bootloader
|
||||
USE_BOOTLOADER=yes
|
||||
|
||||
# include Prometheus bootloader code
|
||||
BOOTLOADERINC= $(PROJECT_DIR)/bootloader/prometheus/$(PROMETHEUS_BOARD)
|
||||
|
||||
# Default to a release build - clear EXTRA_PARAMS from cmdline to build debug
|
||||
ifeq ($(EXTRA_PARAMS),)
|
||||
EXTRA_PARAMS=-DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
endif
|
||||
ifeq ($(DEBUG_LEVEL_OPT),)
|
||||
DEBUG_LEVEL_OPT = -O2
|
||||
endif
|
||||
|
||||
ifeq ($(PROMETHEUS_BOARD),405)
|
||||
LDSCRIPT= $(PROJECT_DIR)/config/boards/prometheus/STM32F405xG.ld
|
||||
DDEFS += -DDEFAULT_ENGINE_TYPE=PROMETHEUS_DEFAULTS -DSTM32F405xx
|
||||
DDEFS += -DDEFAULT_ENGINE_TYPE=PROMETHEUS_DEFAULTS -DSTM32F405xx -DFIRMWARE_ID=\"prometeus405\"
|
||||
else
|
||||
# Override DEFAULT_ENGINE_TYPE
|
||||
LDSCRIPT= $(PROJECT_DIR)/config/boards/prometheus/STM32F469xI.ld
|
||||
DDEFS += -DDEFAULT_ENGINE_TYPE=PROMETHEUS_DEFAULTS -DSTM32F469xx
|
||||
DDEFS += -DDEFAULT_ENGINE_TYPE=PROMETHEUS_DEFAULTS -DSTM32F469xx -DFIRMWARE_ID=\"prometeus469\"
|
||||
endif
|
|
@ -0,0 +1,11 @@
|
|||
# List of all the board related files.
|
||||
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
|
||||
BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/proteus/board_configuration.cpp
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(PROJECT_DIR)/config/boards/nucleo_f767 $(PROJECT_DIR)/config/stm32f7ems
|
||||
|
||||
LDSCRIPT= $(PROJECT_DIR)/config/boards/nucleo_f767/STM32F76xxI.ld
|
||||
|
||||
# Override DEFAULT_ENGINE_TYPE
|
||||
DDEFS += -DSTM32F767xx -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* @file boards/proteus/board_configuration.cpp
|
||||
*
|
||||
* @brief Configuration defaults for the Proteus board
|
||||
*
|
||||
* @author Matthew Kennedy, (c) 2019
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "engine.h"
|
||||
#include "engine_math.h"
|
||||
#include "allsensors.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "engine_configuration.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
static void setInjectorPins() {
|
||||
boardConfiguration->injectionPins[0] = GPIOD_7;
|
||||
boardConfiguration->injectionPins[1] = GPIOG_9;
|
||||
boardConfiguration->injectionPins[2] = GPIOG_10;
|
||||
boardConfiguration->injectionPins[3] = GPIOG_11;
|
||||
boardConfiguration->injectionPins[4] = GPIOG_12;
|
||||
boardConfiguration->injectionPins[5] = GPIOG_13;
|
||||
boardConfiguration->injectionPins[6] = GPIOG_14;
|
||||
boardConfiguration->injectionPins[7] = GPIOB_4;
|
||||
boardConfiguration->injectionPins[8] = GPIOB_5;
|
||||
boardConfiguration->injectionPins[9] = GPIOB_6;
|
||||
boardConfiguration->injectionPins[10] = GPIOB_7;
|
||||
boardConfiguration->injectionPins[11] = GPIOB_8;
|
||||
|
||||
boardConfiguration->injectionPinMode = OM_DEFAULT;
|
||||
}
|
||||
|
||||
static void setIgnitionPins() {
|
||||
boardConfiguration->ignitionPins[0] = GPIOD_4;
|
||||
boardConfiguration->ignitionPins[1] = GPIOD_3;
|
||||
boardConfiguration->ignitionPins[2] = GPIOC_9;
|
||||
boardConfiguration->ignitionPins[3] = GPIOC_8;
|
||||
boardConfiguration->ignitionPins[4] = GPIOC_7;
|
||||
boardConfiguration->ignitionPins[5] = GPIOG_8;
|
||||
boardConfiguration->ignitionPins[6] = GPIOG_7;
|
||||
boardConfiguration->ignitionPins[7] = GPIOG_6;
|
||||
boardConfiguration->ignitionPins[8] = GPIOG_5;
|
||||
boardConfiguration->ignitionPins[9] = GPIOG_4;
|
||||
boardConfiguration->ignitionPins[10] = GPIOG_3;
|
||||
boardConfiguration->ignitionPins[11] = GPIOG_2;
|
||||
|
||||
boardConfiguration->ignitionPinMode = OM_DEFAULT;
|
||||
}
|
||||
|
||||
static void setLedPins() {
|
||||
engineConfiguration->communicationLedPin = GPIOE_4;
|
||||
engineConfiguration->runningLedPin = GPIOE_5;
|
||||
boardConfiguration->triggerErrorPin = GPIOE_6;
|
||||
}
|
||||
|
||||
static void setupVbatt() {
|
||||
// 6.8k high side/10k low side = 1.6667 ratio divider
|
||||
engineConfiguration->analogInputDividerCoefficient = 2.5f / 1.5f;
|
||||
|
||||
// 47k high side/10k low side = 4.7
|
||||
engineConfiguration->vbattDividerCoeff = (57.0f / 10.0f);
|
||||
//engineConfiguration->vbattAdcChannel = TODO;
|
||||
|
||||
engineConfiguration->adcVcc = 3.3f;
|
||||
}
|
||||
|
||||
static void setupEtb() {
|
||||
// TLE9201 driver
|
||||
// This chip has three control pins:
|
||||
// DIR - sets direction of the motor
|
||||
// PWM - pwm control (enable high, coast low)
|
||||
// DIS - disables motor (enable low)
|
||||
|
||||
// Throttle #1
|
||||
// PWM pin
|
||||
engineConfiguration->etbIo[0].controlPin1 = GPIOD_12;
|
||||
// DIR pin
|
||||
engineConfiguration->etbIo[0].directionPin1 = GPIOD_10;
|
||||
// Unused
|
||||
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
|
||||
|
||||
// Throttle #2
|
||||
// PWM pin
|
||||
engineConfiguration->etbIo[0].controlPin1 = GPIOD_13;
|
||||
// DIR pin
|
||||
engineConfiguration->etbIo[0].directionPin1 = GPIOD_9;
|
||||
// Unused
|
||||
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
|
||||
|
||||
#if EFI_FSIO
|
||||
// disable ETB by default
|
||||
setFsio(7, GPIOD_8, "1" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setFsio(8, GPIOD_11, "1" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#endif /* EFI_FSIO */
|
||||
|
||||
// we only have pwm/dir, no dira/dirb
|
||||
engineConfiguration->etb_use_two_wires = false;
|
||||
engineConfiguration->etbFreq = 800;
|
||||
}
|
||||
|
||||
static void setupDefaultSensorInputs() {
|
||||
// trigger inputs
|
||||
// VR channel 1 as default - others not set
|
||||
boardConfiguration->triggerInputPins[0] = GPIOC_6;
|
||||
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
|
||||
engineConfiguration->camInputs[0] = GPIO_UNASSIGNED;
|
||||
|
||||
// clt = Analog Temp 1 = PC4
|
||||
engineConfiguration->clt.adcChannel = EFI_ADC_14;
|
||||
engineConfiguration->clt.config.bias_resistor = 2700;
|
||||
|
||||
// iat = Analog Temp 2 = PC5
|
||||
engineConfiguration->iat.adcChannel = EFI_ADC_15;
|
||||
engineConfiguration->iat.config.bias_resistor = 2700;
|
||||
|
||||
// TODO: more sensors
|
||||
}
|
||||
|
||||
void setPinConfigurationOverrides(void) {
|
||||
}
|
||||
|
||||
void setSerialConfigurationOverrides(void) {
|
||||
boardConfiguration->useSerialPort = false;
|
||||
engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->consoleSerialRxPin = GPIO_UNASSIGNED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Board-specific configuration code overrides.
|
||||
*
|
||||
* See also setDefaultEngineConfiguration
|
||||
*
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void setBoardConfigurationOverrides(void) {
|
||||
setInjectorPins();
|
||||
setIgnitionPins();
|
||||
setLedPins();
|
||||
setupVbatt();
|
||||
setupEtb();
|
||||
|
||||
// "required" hardware is done - set some reasonable defaults
|
||||
setupDefaultSensorInputs();
|
||||
|
||||
// Some sensible defaults for other options
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
engineConfiguration->specs.cylindersCount = 8;
|
||||
engineConfiguration->specs.firingOrder = FO_1_8_7_2_6_5_4_3;
|
||||
|
||||
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
||||
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
||||
engineConfiguration->injectionMode = IM_SIMULTANEOUS;
|
||||
}
|
||||
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
outputs:
|
||||
GPIOD_7: "Lowside 1"
|
||||
GPIOG_9: "Lowside 2"
|
||||
GPIOG_10: "Lowside 3"
|
||||
GPIOG_11: "Lowside 4"
|
||||
GPIOG_12: "Lowside 5"
|
||||
GPIOG_13: "Lowside 6"
|
||||
GPIOG_14: "Lowside 7"
|
||||
GPIOB_4: "Lowside 8"
|
||||
GPIOB_5: "Lowside 9"
|
||||
GPIOB_6: "Lowside 10"
|
||||
GPIOB_7: "Lowside 11"
|
||||
GPIOB_8: "Lowside 12"
|
||||
GPIOB_9: "Lowside 13"
|
||||
GPIOE_0: "Lowside 14"
|
||||
GPIOE_1: "Lowside 15"
|
||||
GPIOE_2: "Lowside 16"
|
||||
|
||||
GPIOD_4: "Ign 1"
|
||||
GPIOD_3: "Ign 2"
|
||||
GPIOC_9: "Ign 3"
|
||||
GPIOC_8: "Ign 4"
|
||||
GPIOC_7: "Ign 5"
|
||||
GPIOG_8: "Ign 6"
|
||||
GPIOG_7: "Ign 7"
|
||||
GPIOG_6: "Ign 8"
|
||||
GPIOG_5: "Ign 9"
|
||||
GPIOG_4: "Ign 10"
|
||||
GPIOG_3: "Ign 11"
|
||||
GPIOG_2: "Ign 12"
|
||||
|
||||
GPIOA_9: "Highside 1"
|
||||
GPIOA_8: "Highside 2"
|
||||
GPIOD_15: "Highside 3"
|
||||
GPIOD_14: "Highside 4"
|
||||
|
||||
event_inputs:
|
||||
GPIOC_6: "Digital 1"
|
||||
GPIOE_11: "Digital 2"
|
||||
GPIOE_12: "Digital 3"
|
||||
GPIOE_13: "Digital 4"
|
||||
GPIOE_14: "Digital 5"
|
||||
GPIOE_15: "Digital 6"
|
||||
GPIOE_7: "Digital 7"
|
||||
GPIOE_8: "Digital 8"
|
||||
|
||||
switch_inputs:
|
||||
GPIOC_6: "Digital 1"
|
||||
GPIOE_11: "Digital 2"
|
||||
GPIOE_12: "Digital 3"
|
||||
GPIOE_13: "Digital 4"
|
||||
GPIOE_14: "Digital 5"
|
||||
GPIOE_15: "Digital 6"
|
||||
GPIOE_7: "Digital 7"
|
||||
GPIOE_8: "Digital 8"
|
||||
|
||||
analog_inputs:
|
||||
EFI_ADC_0: "Analog Volt 5"
|
||||
EFI_ADC_1: "Analog Volt 6"
|
||||
EFI_ADC_2: "Analog Volt 7"
|
||||
EFI_ADC_3: "Analog Volt 8"
|
||||
EFI_ADC_4: "Analog Volt 9"
|
||||
EFI_ADC_5: "Analog Volt 10"
|
||||
EFI_ADC_6: "Analog Volt 11"
|
||||
EFI_ADC_7: "Analog Volt 12"
|
||||
EFI_ADC_8: "Analog Temp 3"
|
||||
EFI_ADC_9: "Analog Temp 4"
|
||||
EFI_ADC_10: "Analog Volt 1"
|
||||
EFI_ADC_11: "Analog Volt 2"
|
||||
EFI_ADC_12: "Analog Volt 3"
|
||||
EFI_ADC_13: "Analog Volt 4"
|
||||
EFI_ADC_14: "Analog Temp 1"
|
||||
EFI_ADC_15: "Analog Temp 2"
|
|
@ -64,11 +64,11 @@ static void setupTle8888() {
|
|||
// diagnostic interface on SPI
|
||||
static void setupTle9201Etb() {
|
||||
// This chip has PWM/DIR, not dira/dirb
|
||||
engineConfiguration->etb1_use_two_wires = false;
|
||||
engineConfiguration->etb_use_two_wires = false;
|
||||
// PWM and DIR pins
|
||||
boardConfiguration->etb1.controlPin1 = GPIOC_7;
|
||||
boardConfiguration->etb1.directionPin1 = GPIOA_8;
|
||||
boardConfiguration->etb1.directionPin2 = GPIO_UNASSIGNED;
|
||||
engineConfiguration->etbIo[0].controlPin1 = GPIOC_7;
|
||||
engineConfiguration->etbIo[0].directionPin1 = GPIOA_8;
|
||||
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
|
||||
// PWM frequency needs to be configured to match the physical part
|
||||
engineConfiguration->etbFreq = 800;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
// Build the logic analyzer support.
|
||||
// A logic analyzer viewer is included in the java console.
|
||||
#define EFI_WAVE_ANALYZER TRUE
|
||||
#define EFI_LOGIC_ANALYZER TRUE
|
||||
|
||||
// A development feature to test output jitter and consistency
|
||||
#define EFI_PWM_TESTER FALSE
|
||||
|
@ -175,7 +175,7 @@
|
|||
#define EFI_IDLE_CONTROL TRUE
|
||||
#endif
|
||||
|
||||
#define EFI_IDLE_INCREMENTAL_PID_CIC FALSE
|
||||
#define EFI_IDLE_PID_CIC FALSE
|
||||
|
||||
/**
|
||||
* Control the main power relay based on measured ignition voltage (Vbatt)
|
||||
|
|
|
@ -160,7 +160,7 @@ void setBoardConfigurationOverrides(void) {
|
|||
|
||||
// starter block
|
||||
/* Starter signal connected through MC33972 - SG11 */
|
||||
//setFsio(0, (GPIOB_1), STARTER_BLOCK PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
//setFsio(0, (GPIOB_1), STARTER_RELAY_LOGIC PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
|
||||
// not used
|
||||
|
@ -177,7 +177,7 @@ void setBoardConfigurationOverrides(void) {
|
|||
boardConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->digitalPotentiometerChipSelect[2] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
|
||||
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
|
||||
boardConfiguration->max31855spiDevice = SPI_NONE;
|
||||
|
|
|
@ -103,8 +103,8 @@
|
|||
#undef EFI_MEMS
|
||||
#define EFI_MEMS FALSE
|
||||
|
||||
#undef EFI_IDLE_INCREMENTAL_PID_CIC
|
||||
#define EFI_IDLE_INCREMENTAL_PID_CIC TRUE
|
||||
#undef EFI_IDLE_PID_CIC
|
||||
#define EFI_IDLE_PID_CIC TRUE
|
||||
|
||||
#define RPM_LOW_THRESHOLD 8 // RPM=8 is an empirical lower sensitivity threshold of MAX9926 for 60-2
|
||||
#define NO_RPM_EVENTS_TIMEOUT_SECS 5 // (RPM < 12)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
export PROJECT_BOARD=subaru-ej20gn
|
||||
export PROJECT_CPU=ARCH_STM32F7
|
||||
export PROJECT_CORE=cortex-m7
|
||||
export EXTRA_PARAMS="-DDUMMY -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE"
|
||||
export EXTRA_PARAMS="-DDUMMY -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE"
|
||||
#echo $EXTRA_PARAMS
|
||||
#export DEBUG_LEVEL_OPT="-O0"
|
||||
#export USE_BOOTLOADER=yes
|
||||
|
|
|
@ -119,8 +119,8 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
boardConfiguration->triggerErrorPin = GPIO_UNASSIGNED;
|
||||
|
||||
// clutch up
|
||||
boardConfiguration->clutchUpPin = GPIOD_3;
|
||||
boardConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
engineConfiguration->clutchUpPin = GPIOD_3;
|
||||
engineConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
|
||||
// fuel pump
|
||||
boardConfiguration->fuelPumpPin = GPIOD_4;
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
* ECU pin 23: OUT BRN/BLK BLK ECU relay control, low-side
|
||||
*
|
||||
* Plug #3 52 pin
|
||||
* ECU pin 2: OUT injector #4
|
||||
* ECU pin 2: OUT WHT injector #4
|
||||
* ECU pin 6: GND ECU
|
||||
* ECU pin 15: OUT injector #2
|
||||
* ECU pin 15: OUT BLK 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 27: OUT ORG injector #6
|
||||
* ECU pin 28: OUT RED 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 40: OUT BRN/BLK GRN injector #3
|
||||
* ECU pin 41: OUT BRN/WHT BLU injector #1
|
||||
* ECU pin 45: GND crankshaft shield
|
||||
* ECU pin 46: IN BLK BLU VR negative crankshaft sensor
|
||||
*
|
||||
|
@ -50,13 +50,15 @@
|
|||
* 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
|
||||
* ECU pic 9: OUT BLK RED coil signal, low-side
|
||||
*
|
||||
* Frankenso
|
||||
* set engine_type 40
|
||||
* Manhattan
|
||||
* set engine_type 24
|
||||
*
|
||||
* https://raw.githubusercontent.com/wiki/rusefi/rusefi_documentation/oem_docs/VAG/Bosch_0280750009_pinout.jpg
|
||||
*
|
||||
* @date Nov 1, 2019
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
|
@ -78,9 +80,16 @@ static void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
|
||||
engineConfiguration->globalTriggerAngleOffset = 90;
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
// todo: that's not right, should be 60/2 without VW
|
||||
engineConfiguration->trigger.type = TT_60_2_VW;
|
||||
|
||||
// this large engine seems to crank at around only 150 RPM? And happily idle at 400RPM?
|
||||
engineConfiguration->cranking.rpm = 280;
|
||||
|
||||
engineConfiguration->ignitionMode = IM_TWO_COILS;
|
||||
|
||||
// set cranking_fuel 15
|
||||
engineConfiguration->cranking.baseFuel = 15;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,31 +108,106 @@ void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
CONFIGB(fuelPumpPin) = GPIO_UNASSIGNED;
|
||||
|
||||
|
||||
boardConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G
|
||||
boardConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G - GREEN wire
|
||||
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->ignitionPins[ID2INDEX(7)] = GPIOC_7; // Frankenso high side - pin 1H - ORANGE wire
|
||||
|
||||
|
||||
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[0] = GPIOB_8; // BLU
|
||||
boardConfiguration->injectionPins[1] = GPIOB_7; // BLK
|
||||
boardConfiguration->injectionPins[2] = GPIOB_9; // GRN
|
||||
boardConfiguration->injectionPins[3] = GPIOD_5; // WHT
|
||||
boardConfiguration->injectionPins[4] = GPIOD_3; // RED
|
||||
boardConfiguration->injectionPins[5] = GPIOE_2; // ORG
|
||||
|
||||
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;
|
||||
boardConfiguration->injectionPins[6] = GPIOE_3; // BLU
|
||||
boardConfiguration->injectionPins[7] = GPIOE_4; // BLK
|
||||
boardConfiguration->injectionPins[8] = GPIOE_5; // GRN
|
||||
boardConfiguration->injectionPins[9] = GPIOE_6; // WHT
|
||||
boardConfiguration->injectionPins[10] = GPIOC_13;//RED
|
||||
boardConfiguration->injectionPins[11] = GPIOD_7;// ORG
|
||||
}
|
||||
|
||||
// BMW_M73_M
|
||||
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
/**
|
||||
Nucleo boards - first step is to confirm that I can blink via each pin
|
||||
going clockwise from top-right corner
|
||||
|
||||
GPIOA_10 USD ID
|
||||
GPIOA_11 USD DM
|
||||
GPIOA_12 USD DP
|
||||
|
||||
E_4: running
|
||||
|
||||
Good GPIO:
|
||||
GPIOC_9 ETB#1
|
||||
GPIOC_8 ETB#1
|
||||
GPIOB_8 ETB#2
|
||||
GPIOB_9 ETB#2
|
||||
GPIOC_5
|
||||
GPIOA_7
|
||||
GPIOA_6
|
||||
*/
|
||||
|
||||
|
||||
CONFIGB(fsioOutputPins)[7] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->fanPin = GPIO_UNASSIGNED;
|
||||
|
||||
/**
|
||||
* Yellow op-amp board
|
||||
*
|
||||
* AN5 tested pull-down 1M PA3 TPS1 orange wire
|
||||
* AN6 tested pull-down 1M PA4 TPS2
|
||||
* AN7 tested pull-down 1M PA6 PPS
|
||||
* AN8 tested no pull-down / no pull-up
|
||||
*/
|
||||
|
||||
|
||||
// For example TLE7209 - two control wires:
|
||||
// PWM on both wires - one to open, another to close
|
||||
// ETB motor NEG pin # - white wire - OUT 1
|
||||
|
||||
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_6;
|
||||
// set_analog_input_pin tps PA3
|
||||
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3; // PA3
|
||||
// set_analog_input_pin tps2 PA4
|
||||
engineConfiguration->tps2_1AdcChannel = EFI_ADC_4; // PA4
|
||||
|
||||
// PWM pin
|
||||
engineConfiguration->etbIo[0].controlPin1 = GPIO_UNASSIGNED;
|
||||
// DIR pin
|
||||
engineConfiguration->etbIo[0].directionPin1 = GPIOC_9;
|
||||
engineConfiguration->etbIo[0].directionPin2 = GPIOC_8;
|
||||
CONFIG(etb_use_two_wires) = true;
|
||||
|
||||
// PWM pin
|
||||
engineConfiguration->etbIo[1].controlPin1 = GPIO_UNASSIGNED;
|
||||
// DIR pin
|
||||
engineConfiguration->etbIo[1].directionPin1 = GPIOB_8;
|
||||
engineConfiguration->etbIo[1].directionPin2 = GPIOB_9;
|
||||
|
||||
|
||||
boardConfiguration->injectionPins[0] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
|
||||
|
||||
boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[7] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
/**
|
||||
* Speed Sensor
|
||||
*/
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||
engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||
/**
|
||||
* Other
|
||||
*/
|
||||
|
|
|
@ -253,6 +253,13 @@ void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
// set tps_max 540
|
||||
engineConfiguration->tpsMax = 540;
|
||||
|
||||
// yes, 30K - that's a test configuration
|
||||
engineConfiguration->rpmHardLimit = 30000;
|
||||
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
|
||||
|
||||
boardConfiguration->ignitionPins[0] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
|
||||
|
@ -260,9 +267,9 @@ void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
/**
|
||||
* remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32
|
||||
*/
|
||||
CONFIGB(etb1.directionPin1) = GPIOC_7; // Frankenso high-side in order to get 5v control
|
||||
CONFIGB(etb1.directionPin2) = GPIOC_9;
|
||||
CONFIGB(etb1.controlPin1) = GPIOE_14;
|
||||
CONFIG(etbIo[0].directionPin1) = GPIOC_7; // Frankenso high-side in order to get 5v control
|
||||
CONFIG(etbIo[0].directionPin2) = GPIOC_9;
|
||||
CONFIG(etbIo[0].controlPin1) = GPIOE_14;
|
||||
|
||||
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||
setBoschVNH2SP30Curve(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
@ -342,10 +349,10 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
setFsio(12, GPIOF_12, "0" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setFsio(14, GPIOF_13, "1" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#endif /* EFI_FSIO */
|
||||
CONFIGB(etb1.directionPin1) = GPIOF_15;
|
||||
CONFIGB(etb1.directionPin2) = GPIOF_14;
|
||||
CONFIG(etbIo[0].directionPin1) = GPIOF_15;
|
||||
CONFIG(etbIo[0].directionPin2) = GPIOF_14;
|
||||
#endif /* STM32_HAS_GPIOF */
|
||||
CONFIG(etb1_use_two_wires) = true;
|
||||
CONFIG(etb_use_two_wires) = true;
|
||||
boardConfiguration->isHip9011Enabled = false;
|
||||
|
||||
// ETB #2
|
||||
|
@ -358,9 +365,8 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
setFsio(13, GPIOE_5, "0" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setFsio(15, GPIOE_6, "1" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
CONFIG(etb2_use_two_wires) = true;
|
||||
CONFIG(etb2.directionPin1) = GPIOE_2;
|
||||
CONFIG(etb2.directionPin2) = GPIOE_4;
|
||||
CONFIG(etbIo[0].directionPin1) = GPIOE_2;
|
||||
CONFIG(etbIo[0].directionPin2) = GPIOE_4;
|
||||
|
||||
|
||||
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3; // PA3
|
||||
|
|
|
@ -310,7 +310,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
//engineConfiguration->fuelAlgorithm = LM_ALPHA_N; // I want to start with a simple Alpha-N
|
||||
|
||||
setFuelLoadBin(0, 100 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setLinearCurve(config->ignitionLoadBins, IGN_LOAD_COUNT, 20, 120, 1);
|
||||
setLinearCurve(config->ignitionLoadBins, 20, 120, 1);
|
||||
|
||||
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
|
@ -434,8 +434,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
|
||||
boardConfiguration->clutchDownPin = GPIOC_12;
|
||||
boardConfiguration->clutchDownPinMode = PI_PULLUP;
|
||||
// boardConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
|
||||
boardConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
// engineConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
|
||||
engineConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
|
||||
engineConfiguration->activateAuxPid1 = 1;
|
||||
engineConfiguration->auxPidPins[0] = GPIOD_5; // playing with AUX PID for alternator
|
||||
|
@ -456,7 +456,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
// setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||
engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||
|
||||
engineConfiguration->fanOnTemperature = 92;
|
||||
engineConfiguration->fanOffTemperature = 89;
|
||||
|
|
|
@ -149,7 +149,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
engineConfiguration->crankingTimingAngle = 3;
|
||||
engineConfiguration->crankingChargeAngle = 70;
|
||||
|
||||
setLinearCurve(config->ignitionLoadBins, IGN_LOAD_COUNT, 20, 105, 5);
|
||||
setLinearCurve(config->ignitionLoadBins, 20, 105, 5);
|
||||
setWholeTimingTable_d(10 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
// set_whole_fuel_map 5
|
||||
setWholeFuelMap(5 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
#include "mazda_323.h"
|
||||
|
||||
void setMazda323EngineConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
EXTERN_CONFIG;
|
||||
|
||||
void setMazda323EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 1.6;
|
||||
|
||||
|
|
|
@ -10,11 +10,8 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||
*/
|
||||
|
||||
#ifndef MAZDA_323_H_
|
||||
#define MAZDA_323_H_
|
||||
#pragma once
|
||||
|
||||
#include "engine_configuration.h"
|
||||
|
||||
void setMazda323EngineConfiguration(engine_configuration_s *engineConfiguration);
|
||||
|
||||
#endif /* MAZDA_323_H_ */
|
||||
void setMazda323EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -304,7 +304,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
boardConfiguration->alternatorControlPin = GPIOE_10;
|
||||
boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
|
||||
|
||||
// boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||
// engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||
|
||||
|
||||
boardConfiguration->vvtCamSensorUseRise = true;
|
||||
|
@ -411,12 +411,12 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
|
||||
// VNH2SP30 three-wire ETB control
|
||||
// PWM
|
||||
boardConfiguration->etb1.controlPin1 = GPIOE_6;
|
||||
boardConfiguration->etb1.controlPinMode = OM_INVERTED;
|
||||
engineConfiguration->etbIo[0].controlPin1 = GPIOE_6;
|
||||
engineConfiguration->etbIo[0].controlPinMode = OM_INVERTED;
|
||||
//
|
||||
boardConfiguration->etb1.directionPin1 = GPIOE_12;
|
||||
engineConfiguration->etbIo[0].directionPin1 = GPIOE_12;
|
||||
//
|
||||
boardConfiguration->etb1.directionPin2 = GPIOC_7;
|
||||
engineConfiguration->etbIo[0].directionPin2 = GPIOC_7;
|
||||
|
||||
// set_analog_input_pin tps PC3
|
||||
engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; // PC3
|
||||
|
|
|
@ -117,7 +117,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
boardConfiguration->triggerInputPins[0] = GPIOG_7;
|
||||
#endif /* STM32_HAS_GPIOF */
|
||||
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
|
||||
engineConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
|
||||
#endif /* STM32_HAS_GPIOF */
|
||||
|
||||
|
||||
|
@ -140,10 +140,10 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
setFsioExt (3, GPIOE_0, "0.15 90 coolant 120 min max 90 - 30 / 0.8 * +", 25 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
engineConfiguration->auxPidFrequency[3] = 25;
|
||||
CONFIG(etb1_use_two_wires) = true;
|
||||
CONFIG(etb_use_two_wires) = true;
|
||||
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
|
||||
CONFIGB(etb1.directionPin1) = GPIOF_15;
|
||||
CONFIGB(etb1.directionPin2) = GPIOF_14;
|
||||
CONFIG(etbIo[0].directionPin1) = GPIOF_15;
|
||||
CONFIG(etbIo[0].directionPin2) = GPIOF_14;
|
||||
#endif /* STM32_HAS_GPIOF */
|
||||
boardConfiguration->isHip9011Enabled = false;
|
||||
|
||||
|
@ -151,9 +151,8 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
setFsio (13, GPIOE_5, "0" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setFsio (15, GPIOE_6, "1" PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
CONFIG(etb2_use_two_wires) = true;
|
||||
CONFIG(etb2.directionPin1) = GPIOE_2;
|
||||
CONFIG(etb2.directionPin2) = GPIOE_4;
|
||||
CONFIG(etbIo[1].directionPin1) = GPIOE_2;
|
||||
CONFIG(etbIo[1].directionPin2) = GPIOE_4;
|
||||
|
||||
engineConfiguration->etb.pFactor = 1.07;
|
||||
engineConfiguration->etb.iFactor = 0.18;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/**
|
||||
* @file nissan_primera.cpp
|
||||
*
|
||||
* engine_type 5
|
||||
* NISSAN_PRIMERA
|
||||
* set engine_type 5
|
||||
*
|
||||
* @date Oct 14, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
@ -12,11 +13,23 @@
|
|||
#if EFI_SUPPORT_NISSAN_PRIMERA
|
||||
#include "nissan_primera.h"
|
||||
|
||||
void setNissanPrimeraEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
EXTERN_CONFIG;
|
||||
|
||||
void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
engineConfiguration->trigger.type = TT_NISSAN_SR20VE;
|
||||
|
||||
boardConfiguration->ignitionPins[0] = GPIOD_7;
|
||||
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->ignitionPins[2] = GPIOD_6;
|
||||
|
||||
|
||||
engineConfiguration->auxValves[0] = GPIOE_14;
|
||||
engineConfiguration->auxValves[1] = GPIOE_12;
|
||||
}
|
||||
|
||||
void setNissanPrimeraEngineConfiguration_360(engine_configuration_s *engineConfiguration) {
|
||||
void setNissanPrimeraEngineConfiguration_360(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
engineConfiguration->trigger.type = TT_NISSAN_SR20VE_360;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,19 +2,16 @@
|
|||
* @file nissan_primera.h
|
||||
*
|
||||
* @date Oct 14, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
|
||||
#ifndef NISSAN_PRIMERA_H_
|
||||
#define NISSAN_PRIMERA_H_
|
||||
#pragma once
|
||||
|
||||
#if EFI_SUPPORT_NISSAN_PRIMERA
|
||||
|
||||
#include "engine_configuration.h"
|
||||
|
||||
void setNissanPrimeraEngineConfiguration(engine_configuration_s *engineConfiguration);
|
||||
void setNissanPrimeraEngineConfiguration_360(engine_configuration_s *engineConfiguration);
|
||||
void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
void setNissanPrimeraEngineConfiguration_360(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
#endif /* EFI_SUPPORT_NISSAN_PRIMERA */
|
||||
|
||||
#endif /* NISSAN_PRIMERA_H_ */
|
||||
|
|
|
@ -88,7 +88,7 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
boardConfiguration->injectionPins[6] = GPIOE_2; // Frankenstein: low side - out #7
|
||||
boardConfiguration->injectionPins[7] = GPIOE_3; // Frankenstein: low side - out #8
|
||||
|
||||
// not valid ICU pin boardConfiguration->vehicleSpeedSensorInputPin = GPIOC_2;
|
||||
// not valid ICU pin engineConfiguration->vehicleSpeedSensorInputPin = GPIOC_2;
|
||||
|
||||
//GPIOE_0 AND GPIOE_1 are bad pins since they conflict with accelerometer
|
||||
//no malfunction indicator pin needed, since we use CAN_BUS_MAZDA_RX8
|
||||
|
|
|
@ -85,11 +85,11 @@ void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
// todo: extract a method? figure out something smarter
|
||||
setFuelRpmBin(800, 15000 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setTimingRpmBin(800, 15000 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setLinearCurve(config->veRpmBins, FUEL_RPM_COUNT, 15000, 7000, 1);
|
||||
setLinearCurve(config->afrRpmBins, FUEL_RPM_COUNT, 15000, 7000, 1);
|
||||
setLinearCurve(config->veRpmBins, 15000, 7000, 1);
|
||||
setLinearCurve(config->afrRpmBins, 15000, 7000, 1);
|
||||
|
||||
engineConfiguration->hasFrequencyReportingMapSensor = true;
|
||||
boardConfiguration->frequencyReportingMapInputPin = GPIOC_6;
|
||||
engineConfiguration->frequencyReportingMapInputPin = GPIOC_6;
|
||||
boardConfiguration->mapFrequency100Kpa = 159;
|
||||
boardConfiguration->mapFrequency0Kpa = 80;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
#if !defined(ENABLE_PERF_TRACE) || defined(__DOXYGEN__)
|
||||
// looks like this value could not be defined in efifeatures.h - please define either externally or just change the value here
|
||||
#define ENABLE_PERF_TRACE FALSE
|
||||
#define ENABLE_PERF_TRACE TRUE
|
||||
#endif /* ENABLE_PERF_TRACE */
|
||||
|
||||
#include "chconf_common.h"
|
||||
|
@ -132,7 +132,7 @@
|
|||
* must be set to zero in that case.
|
||||
*/
|
||||
#if !defined(CH_CFG_TIME_QUANTUM)
|
||||
#define CH_CFG_TIME_QUANTUM 20
|
||||
#define CH_CFG_TIME_QUANTUM 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@
|
|||
* @note Requires @p CH_CFG_USE_MEMCORE.
|
||||
*/
|
||||
#if !defined(CH_CFG_MEMCORE_SIZE)
|
||||
#define CH_CFG_MEMCORE_SIZE 2048
|
||||
#define CH_CFG_MEMCORE_SIZE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -346,7 +346,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||
*/
|
||||
#define CH_CFG_USE_MAILBOXES TRUE
|
||||
#define CH_CFG_USE_MAILBOXES FALSE
|
||||
|
||||
/**
|
||||
* @brief I/O Queues APIs.
|
||||
|
@ -354,7 +354,7 @@
|
|||
*
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#define CH_CFG_USE_QUEUES TRUE
|
||||
#define CH_CFG_USE_QUEUES FALSE
|
||||
|
||||
/**
|
||||
* @brief Core Memory Manager APIs.
|
||||
|
@ -364,7 +364,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MEMCORE)
|
||||
#define CH_CFG_USE_MEMCORE TRUE
|
||||
#define CH_CFG_USE_MEMCORE FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -378,7 +378,7 @@
|
|||
* @note Mutexes are recommended.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_HEAP)
|
||||
#define CH_CFG_USE_HEAP TRUE
|
||||
#define CH_CFG_USE_HEAP FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -389,7 +389,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MEMPOOLS)
|
||||
#define CH_CFG_USE_MEMPOOLS TRUE
|
||||
#define CH_CFG_USE_MEMPOOLS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
/**
|
||||
* Build-in logic analyzer support. Logic analyzer viewer is one of the java console panes.
|
||||
*/
|
||||
#ifndef EFI_WAVE_ANALYZER
|
||||
#define EFI_WAVE_ANALYZER TRUE
|
||||
#ifndef EFI_LOGIC_ANALYZER
|
||||
#define EFI_LOGIC_ANALYZER TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_ICU_INPUTS
|
||||
|
@ -194,7 +194,7 @@
|
|||
#define EFI_IDLE_CONTROL TRUE
|
||||
#endif
|
||||
|
||||
#define EFI_IDLE_INCREMENTAL_PID_CIC FALSE
|
||||
#define EFI_IDLE_PID_CIC FALSE
|
||||
|
||||
/**
|
||||
* Control the main power relay based on measured ignition voltage (Vbatt)
|
||||
|
|
|
@ -31,11 +31,24 @@
|
|||
#define _CHIBIOS_RT_CONF_
|
||||
#define _CHIBIOS_RT_CONF_VER_5_1_
|
||||
|
||||
#define CHPRINTF_USE_FLOAT TRUE
|
||||
/*
|
||||
* __process_stack_size__ and __process_stack_size__ defaults are each hard-coded as 0x400 in ChibiOS rules.mk files
|
||||
* rusEfi do not override these defaults.
|
||||
*
|
||||
* http://www.chibios.com/forum/viewtopic.php?t=309
|
||||
* "__main_stack_size__ is the size of INTERRUPTS stack"
|
||||
* "__process_stack_size__ is the stack of the C-runtime, in ChibiOS the "main" thread uses the C-runtime stack."
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(EFI_CLOCK_LOCKS) || defined(__DOXYGEN__)
|
||||
#define EFI_CLOCK_LOCKS FALSE
|
||||
#endif /* EFI_CLOCK_LOCKS */
|
||||
#define PORT_IDLE_THREAD_STACK_SIZE 1024
|
||||
|
||||
// rusEfi main processing happens on IRQ so PORT_INT_REQUIRED_STACK has to be pretty large.
|
||||
// see also a strange comment about PORT_INT_REQUIRED_STACK in global_shared.h
|
||||
// see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
|
||||
#define PORT_INT_REQUIRED_STACK 768
|
||||
|
||||
#define CHPRINTF_USE_FLOAT TRUE
|
||||
|
||||
#if !defined(ENABLE_PERF_TRACE) || defined(__DOXYGEN__)
|
||||
// looks like this value could not be defined in efifeatures.h - please define either externally or just change the value here
|
||||
|
@ -44,7 +57,6 @@
|
|||
|
||||
#include "chconf_common.h"
|
||||
|
||||
|
||||
/*===========================================================================*/
|
||||
/**
|
||||
* @name System timers settings
|
||||
|
@ -56,18 +68,14 @@
|
|||
* @brief System time counter resolution.
|
||||
* @note Allowed values are 16 or 32 bits.
|
||||
*/
|
||||
#if !defined(CH_CFG_ST_RESOLUTION)
|
||||
#define CH_CFG_ST_RESOLUTION 32
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief System tick frequency.
|
||||
* @details Frequency of the system timer that drives the system ticks. This
|
||||
* setting also defines the system tick time unit.
|
||||
*/
|
||||
#if !defined(CH_CFG_ST_FREQUENCY)
|
||||
#define CH_CFG_ST_FREQUENCY 1000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Time intervals data size.
|
||||
|
@ -338,9 +346,15 @@
|
|||
* @note The default is @p TRUE.
|
||||
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MAILBOXES)
|
||||
#define CH_CFG_USE_MAILBOXES TRUE
|
||||
#endif
|
||||
#define CH_CFG_USE_MAILBOXES FALSE
|
||||
|
||||
/**
|
||||
* @brief I/O Queues APIs.
|
||||
* @details If enabled then the I/O queues APIs are included in the kernel.
|
||||
*
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#define CH_CFG_USE_QUEUES FALSE
|
||||
|
||||
/**
|
||||
* @brief Core Memory Manager APIs.
|
||||
|
@ -350,7 +364,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MEMCORE)
|
||||
#define CH_CFG_USE_MEMCORE TRUE
|
||||
#define CH_CFG_USE_MEMCORE FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -378,17 +392,6 @@
|
|||
#define CH_CFG_USE_MEMPOOLS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Objects FIFOs APIs.
|
||||
* @details If enabled then the objects FIFOs APIs are included
|
||||
* in the kernel.
|
||||
*
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_OBJ_FIFOS)
|
||||
#define CH_CFG_USE_OBJ_FIFOS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Dynamic Threads APIs.
|
||||
* @details If enabled then the dynamic threads creation APIs are included
|
||||
|
@ -402,6 +405,17 @@
|
|||
#define CH_CFG_USE_DYNAMIC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Objects FIFOs APIs.
|
||||
* @details If enabled then the objects FIFOs APIs are included
|
||||
* in the kernel.
|
||||
*
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_OBJ_FIFOS)
|
||||
#define CH_CFG_USE_OBJ_FIFOS FALSE
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -456,7 +470,7 @@
|
|||
* @brief Enables factory for mailboxes.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_MAILBOXES)
|
||||
#define CH_CFG_FACTORY_MAILBOXES TRUE
|
||||
#define CH_CFG_FACTORY_MAILBOXES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -495,6 +509,12 @@
|
|||
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* micro-optimization: use same (lower-level) api for lock/unlock regardless on context
|
||||
* this saves us one branching
|
||||
*/
|
||||
#define USE_PORT_LOCK FALSE
|
||||
|
||||
/**
|
||||
* @brief Debug option, parameters checks.
|
||||
* @details If enabled then the checks on the API functions input
|
||||
|
@ -503,7 +523,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_CHECKS)
|
||||
#define CH_DBG_ENABLE_CHECKS FALSE
|
||||
#define CH_DBG_ENABLE_CHECKS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -515,7 +535,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_ASSERTS)
|
||||
#define CH_DBG_ENABLE_ASSERTS FALSE
|
||||
#define CH_DBG_ENABLE_ASSERTS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -537,6 +557,17 @@
|
|||
#define CH_DBG_TRACE_BUFFER_SIZE 128
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Debug option, trace buffer.
|
||||
* @details If enabled then the context switch circular trace buffer is
|
||||
* activated.
|
||||
*
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#ifndef CH_DBG_ENABLE_TRACE
|
||||
#define CH_DBG_ENABLE_TRACE FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Debug option, stack checks.
|
||||
* @details If enabled then a runtime stack check is performed.
|
||||
|
@ -548,7 +579,7 @@
|
|||
* @p panic_msg variable set to @p NULL.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
|
||||
#define CH_DBG_ENABLE_STACK_CHECK FALSE
|
||||
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -559,8 +590,9 @@
|
|||
*
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
// see also CH_DBG_STACK_FILL_VALUE
|
||||
#if !defined(CH_DBG_FILL_THREADS)
|
||||
#define CH_DBG_FILL_THREADS FALSE
|
||||
#define CH_DBG_FILL_THREADS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -606,13 +638,15 @@
|
|||
* @details User fields added to the end of the @p thread_t structure.
|
||||
*/
|
||||
#define CH_CFG_THREAD_EXTRA_FIELDS \
|
||||
void *activeStack; \
|
||||
int remainingStack; \
|
||||
/* Add threads custom fields here.*/
|
||||
|
||||
/**
|
||||
* @brief Threads initialization hook.
|
||||
* @details User initialization code added to the @p _thread_init() function.
|
||||
* @details User initialization code added to the @p chThdInit() API.
|
||||
*
|
||||
* @note It is invoked from within @p _thread_init() and implicitly from all
|
||||
* @note It is invoked from within @p chThdInit() and implicitly from all
|
||||
* the threads creation APIs.
|
||||
*/
|
||||
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
||||
|
@ -622,6 +656,10 @@
|
|||
/**
|
||||
* @brief Threads finalization hook.
|
||||
* @details User finalization code added to the @p chThdExit() API.
|
||||
*
|
||||
* @note It is inserted into lock zone.
|
||||
* @note It is also invoked when the threads simply return in order to
|
||||
* terminate.
|
||||
*/
|
||||
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
|
||||
/* Add threads finalization code here.*/ \
|
||||
|
@ -632,7 +670,7 @@
|
|||
* @details This hook is invoked just before switching between threads.
|
||||
*/
|
||||
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
||||
/* Context switch code here.*/ \
|
||||
contextSwitchHook(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -640,6 +678,7 @@
|
|||
*/
|
||||
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
||||
/* IRQ prologue code here.*/ \
|
||||
irqEnterHook(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -647,6 +686,7 @@
|
|||
*/
|
||||
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
||||
/* IRQ epilogue code here.*/ \
|
||||
irqExitHook(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -656,7 +696,6 @@
|
|||
* @note This macro can be used to activate a power saving mode.
|
||||
*/
|
||||
#define CH_CFG_IDLE_ENTER_HOOK() { \
|
||||
/* Idle-enter code here.*/ \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -666,7 +705,6 @@
|
|||
* @note This macro can be used to deactivate a power saving mode.
|
||||
*/
|
||||
#define CH_CFG_IDLE_LEAVE_HOOK() { \
|
||||
/* Idle-leave code here.*/ \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -693,7 +731,7 @@
|
|||
*/
|
||||
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||
/* System halt code here.*/ \
|
||||
chDbgPanic3(reason, __FILE__, __LINE__); \
|
||||
chDbgPanic3(reason, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -705,6 +743,7 @@
|
|||
/* Trace code here.*/ \
|
||||
}
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
*/
|
||||
#define UART_DMA_IRQ_PRIORITY (PRECISE_SCHEDULING_TIMER_PRIORITY + 2)
|
||||
|
||||
/*
|
||||
* SysTick driver system settings.
|
||||
*/
|
||||
#define STM32_ST_IRQ_PRIORITY 8
|
||||
#define STM32_ST_USE_TIMER 2
|
||||
|
||||
/*
|
||||
* STM32F7xx drivers configuration.
|
||||
|
@ -162,8 +167,8 @@
|
|||
#define STM32_DAC_DUAL_MODE FALSE
|
||||
#define STM32_DAC_USE_DAC1_CH1 FALSE
|
||||
#define STM32_DAC_USE_DAC1_CH2 FALSE
|
||||
#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
|
||||
#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
|
||||
#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 6
|
||||
#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 6
|
||||
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
|
||||
#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
|
||||
#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
|
||||
|
@ -172,18 +177,19 @@
|
|||
/*
|
||||
* EXT driver system settings.
|
||||
*/
|
||||
#define STM32_EXT_EXTI0_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI1_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI2_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI3_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI4_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI16_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXT_IRQ_PRIORITY ICU_PRIORITY
|
||||
#define STM32_EXT_EXTI0_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI1_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI2_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI3_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI4_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI16_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI17_IRQ_PRIORITY 15
|
||||
#define STM32_EXT_EXTI18_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI19_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI20_IRQ_PRIORITY PRECISE_SCHEDULING_TIMER_PRIORITY + 2
|
||||
#define STM32_EXT_EXTI18_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI19_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI20_IRQ_PRIORITY STM32_EXT_EXT_IRQ_PRIORITY
|
||||
#define STM32_EXT_EXTI21_IRQ_PRIORITY 15
|
||||
#define STM32_EXT_EXTI22_IRQ_PRIORITY 15
|
||||
|
||||
|
@ -356,11 +362,6 @@
|
|||
#define STM32_SPI_SPI6_IRQ_PRIORITY 10
|
||||
#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
|
||||
|
||||
/*
|
||||
* ST driver system settings.
|
||||
*/
|
||||
#define STM32_ST_IRQ_PRIORITY 8
|
||||
#define STM32_ST_USE_TIMER 2
|
||||
|
||||
/*
|
||||
* UART driver system settings.
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "bluetooth.h"
|
||||
#include "tunerstudio_io.h"
|
||||
#include "tooth_logger.h"
|
||||
#include "electronic_throttle.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "engine_configuration.h"
|
||||
|
@ -94,11 +95,11 @@
|
|||
|
||||
|
||||
#ifndef EFI_IDLE_CONTROL
|
||||
#if EFI_IDLE_INCREMENTAL_PID_CIC
|
||||
#if EFI_IDLE_PID_CIC
|
||||
extern PidCic idlePid;
|
||||
#else
|
||||
extern Pid idlePid;
|
||||
#endif /* EFI_IDLE_INCREMENTAL_PID_CIC */
|
||||
#endif /* EFI_IDLE_PID_CIC */
|
||||
#endif /* EFI_IDLE_CONTROL */
|
||||
|
||||
|
||||
|
@ -256,7 +257,7 @@ static void onlineApplyWorkingCopyBytes(int currentPageId, uint32_t offset, int
|
|||
}
|
||||
}
|
||||
|
||||
extern Pid etbPid;
|
||||
extern EtbController etbController[ETB_COUNT];
|
||||
|
||||
static const void * getStructAddr(int structId) {
|
||||
switch (structId) {
|
||||
|
@ -274,7 +275,7 @@ static const void * getStructAddr(int structId) {
|
|||
return static_cast<trigger_state_s*>(&engine->triggerCentral.triggerState);
|
||||
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||
case LDS_ETB_PID_STATE_INDEX:
|
||||
return static_cast<pid_state_s*>(&etbPid);
|
||||
return static_cast<pid_state_s*>(&etbController[0].etbPid);
|
||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||
|
||||
#ifndef EFI_IDLE_CONTROL
|
||||
|
@ -487,7 +488,9 @@ static bool isKnownCommand(char command) {
|
|||
|| command == TS_GET_LOGGER_BUFFER
|
||||
|| command == TS_GET_TEXT
|
||||
|| command == TS_CRC_CHECK_COMMAND
|
||||
|| command == TS_GET_FIRMWARE_VERSION;
|
||||
|| command == TS_GET_FIRMWARE_VERSION
|
||||
|| command == TS_PERF_TRACE_BEGIN
|
||||
|| command == TS_PERF_TRACE_GET_BUFFER;
|
||||
}
|
||||
|
||||
// this function runs indefinitely
|
||||
|
@ -852,20 +855,20 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
|
|||
}
|
||||
|
||||
break;
|
||||
case TS_PERF_TRACE_BEGIN:
|
||||
#endif /* EFI_TOOTH_LOGGER */
|
||||
#if ENABLE_PERF_TRACE
|
||||
case TS_PERF_TRACE_BEGIN:
|
||||
perfTraceEnable();
|
||||
#endif /* ENABLE_PERF_TRACE */
|
||||
sendOkResponse(tsChannel, TS_CRC);
|
||||
break;
|
||||
case TS_PERF_TRACE_GET_BUFFER:
|
||||
{
|
||||
#if ENABLE_PERF_TRACE
|
||||
auto trace = perfTraceGetBuffer();
|
||||
sr5SendResponse(tsChannel, TS_CRC, trace.Buffer, trace.Size);
|
||||
#endif /* ENABLE_PERF_TRACE */
|
||||
}
|
||||
#endif /* EFI_TOOTH_LOGGER */
|
||||
|
||||
break;
|
||||
#endif /* ENABLE_PERF_TRACE */
|
||||
default:
|
||||
tunerStudioError("ERROR: ignoring unexpected command");
|
||||
return false;
|
||||
|
|
|
@ -102,6 +102,10 @@ void startTsPort(ts_channel_s *tsChannel) {
|
|||
if (CONFIGB(useSerialPort)) {
|
||||
|
||||
print("TunerStudio over USART");
|
||||
/**
|
||||
* We have hard-coded USB serial console so that it would be clear how to connect to each specific board,
|
||||
* but for UART serial we allow users to change settings.
|
||||
*/
|
||||
efiSetPadMode("tunerstudio rx", engineConfiguration->binarySerialRxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
efiSetPadMode("tunerstudio tx", engineConfiguration->binarySerialTxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ static void sayHello(void) {
|
|||
scheduleMsg(&logger, "CH_DBG_SYSTEM_STATE_CHECK=%d", CH_DBG_SYSTEM_STATE_CHECK);
|
||||
scheduleMsg(&logger, "CH_DBG_ENABLE_STACK_CHECK=%d", CH_DBG_ENABLE_STACK_CHECK);
|
||||
|
||||
#ifdef EFI_WAVE_ANALYZER
|
||||
scheduleMsg(&logger, "EFI_WAVE_ANALYZER=%d", EFI_WAVE_ANALYZER);
|
||||
#ifdef EFI_LOGIC_ANALYZER
|
||||
scheduleMsg(&logger, "EFI_LOGIC_ANALYZER=%d", EFI_LOGIC_ANALYZER);
|
||||
#endif
|
||||
#ifdef EFI_TUNER_STUDIO
|
||||
scheduleMsg(&logger, "EFI_TUNER_STUDIO=%d", EFI_TUNER_STUDIO);
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#include "engine_controller.h"
|
||||
|
||||
#include "adc_inputs.h"
|
||||
#if EFI_WAVE_ANALYZER
|
||||
#include "wave_analyzer.h"
|
||||
#endif /* EFI_WAVE_ANALYZER */
|
||||
#if EFI_LOGIC_ANALYZER
|
||||
#include "logic_analyzer.h"
|
||||
#endif /* EFI_LOGIC_ANALYZER */
|
||||
|
||||
#include "trigger_central.h"
|
||||
#include "allsensors.h"
|
||||
|
@ -458,10 +458,10 @@ void printOverallStatus(systime_t nowSeconds) {
|
|||
printOutPin(PROTOCOL_HIP_NAME, CONFIGB(hip9011IntHoldPin));
|
||||
printOutPin(PROTOCOL_TACH_NAME, CONFIGB(tachOutputPin));
|
||||
printOutPin(PROTOCOL_DIZZY_NAME, engineConfiguration->dizzySparkOutputPin);
|
||||
#if EFI_WAVE_ANALYZER
|
||||
#if EFI_LOGIC_ANALYZER
|
||||
printOutPin(PROTOCOL_WA_CHANNEL_1, CONFIGB(logicAnalyzerPins)[0]);
|
||||
printOutPin(PROTOCOL_WA_CHANNEL_2, CONFIGB(logicAnalyzerPins)[1]);
|
||||
#endif /* EFI_WAVE_ANALYZER */
|
||||
#endif /* EFI_LOGIC_ANALYZER */
|
||||
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
printOutPin(enginePins.coils[i].getShortName(), CONFIGB(ignitionPins)[i]);
|
||||
|
@ -524,9 +524,9 @@ void updateDevConsoleState(void) {
|
|||
chThdSleepMilliseconds(200);
|
||||
#endif
|
||||
|
||||
#if EFI_WAVE_ANALYZER
|
||||
#if EFI_LOGIC_ANALYZER
|
||||
printWave(&logger);
|
||||
#endif /* EFI_WAVE_ANALYZER */
|
||||
#endif /* EFI_LOGIC_ANALYZER */
|
||||
|
||||
scheduleLogging(&logger);
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
// offset 32
|
||||
tsOutputChannels->tpsADC = getTPS12bitAdc(PASS_ENGINE_PARAMETER_SIGNATURE) / TPS_TS_CONVERSION;
|
||||
tsOutputChannels->tpsADC = getTPS12bitAdc(0 PASS_ENGINE_PARAMETER_SUFFIX) / TPS_TS_CONVERSION;
|
||||
// offset 36
|
||||
#if EFI_ANALOG_SENSORS
|
||||
tsOutputChannels->baroPressure = hasBaroSensor() ? getBaroPressure() : 0;
|
||||
|
|
|
@ -133,9 +133,9 @@ void setAltPFactor(float p) {
|
|||
|
||||
static void applyAlternatorPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||
efiAssertVoid(CUSTOM_ERR_6643, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
||||
efiAssertVoid(CUSTOM_IDLE_WAVE_CNT, state->multiWave.waveCount == 1, "invalid idle waveCount");
|
||||
efiAssertVoid(CUSTOM_IDLE_WAVE_CNT, state->multiChannelStateSequence.waveCount == 1, "invalid idle waveCount");
|
||||
OutputPin *output = state->outputPins[0];
|
||||
int value = state->multiWave.getChannelState(/*channelIndex*/0, stateIndex);
|
||||
int value = state->multiChannelStateSequence.getChannelState(/*channelIndex*/0, stateIndex);
|
||||
/**
|
||||
* 'engine->isAlternatorControlEnabled' would be false is RPM is too low
|
||||
*/
|
||||
|
|
|
@ -134,9 +134,11 @@ void startAuxPins(void) {
|
|||
}
|
||||
|
||||
void stopAuxPins(void) {
|
||||
#if EFI_PROD_CODE
|
||||
for (int i = 0;i < AUX_PID_COUNT;i++) {
|
||||
brain_pin_markUnused(activeConfiguration.auxPidPins[i]);
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
void initAuxPid(Logging *sharedLogger) {
|
||||
|
|
|
@ -86,9 +86,9 @@
|
|||
#error "Unexpected OS ACCESS HERE"
|
||||
#endif
|
||||
|
||||
#ifndef ETB_MAX_COUNT
|
||||
#define ETB_MAX_COUNT 2
|
||||
|
||||
static bool shouldResetPid = false;
|
||||
#endif /* ETB_MAX_COUNT */
|
||||
|
||||
static pid_s tuneWorkingPidSettings;
|
||||
static Pid tuneWorkingPid(&tuneWorkingPidSettings);
|
||||
|
@ -103,7 +103,7 @@ static bool startupPositionError = false;
|
|||
|
||||
#define STARTUP_NEUTRAL_POSITION_ERROR_THRESHOLD 5
|
||||
|
||||
class EtbControl {
|
||||
class EtbHardware {
|
||||
private:
|
||||
OutputPin m_pinEnable;
|
||||
OutputPin m_pinDir1;
|
||||
|
@ -116,9 +116,7 @@ private:
|
|||
SimplePwm etbPwmUp;
|
||||
|
||||
public:
|
||||
DECLARE_ENGINE_PTR;
|
||||
|
||||
EtbControl() : etbPwmUp("etbUp"), dcMotor(&m_pwmEnable, &m_pwmDir1, &m_pwmDir2) {}
|
||||
EtbHardware() : etbPwmUp("etbUp"), dcMotor(&m_pwmEnable, &m_pwmDir1, &m_pwmDir2) {}
|
||||
|
||||
TwoPinDcMotor dcMotor;
|
||||
|
||||
|
@ -133,49 +131,48 @@ public:
|
|||
// since we have pointer magic here we cannot simply have value parameter
|
||||
pin_output_mode_e *pinEnableMode,
|
||||
brain_pin_e pinDir1,
|
||||
brain_pin_e pinDir2) {
|
||||
dcMotor.SetType(useTwoWires ? TwoPinDcMotor::ControlType::PwmDirectionPins : TwoPinDcMotor::ControlType::PwmEnablePin);
|
||||
brain_pin_e pinDir2,
|
||||
ExecutorInterface* executor,
|
||||
int frequency) {
|
||||
dcMotor.setType(useTwoWires ? TwoPinDcMotor::ControlType::PwmDirectionPins : TwoPinDcMotor::ControlType::PwmEnablePin);
|
||||
|
||||
m_pinEnable.initPin("ETB Enable", pinEnable, pinEnableMode);
|
||||
m_pinDir1.initPin("ETB Dir 1", pinDir1);
|
||||
m_pinDir2.initPin("ETB Dir 2", pinDir2);
|
||||
|
||||
// Clamp to >100hz
|
||||
int freq = maxI(100, engineConfiguration->etbFreq);
|
||||
int clampedFrequency = maxI(100, frequency);
|
||||
|
||||
|
||||
// no need to complicate event queue with ETB PWM in unit tests
|
||||
#if ! EFI_UNIT_TEST
|
||||
startSimplePwm(&m_pwmEnable, "ETB Enable",
|
||||
&engine->executor,
|
||||
executor,
|
||||
&m_pinEnable,
|
||||
freq,
|
||||
clampedFrequency,
|
||||
0,
|
||||
(pwm_gen_callback*)applyPinState);
|
||||
|
||||
startSimplePwm(&m_pwmDir1, "ETB Dir 1",
|
||||
&engine->executor,
|
||||
executor,
|
||||
&m_pinDir1,
|
||||
freq,
|
||||
clampedFrequency,
|
||||
0,
|
||||
(pwm_gen_callback*)applyPinState);
|
||||
|
||||
startSimplePwm(&m_pwmDir2, "ETB Dir 2",
|
||||
&engine->executor,
|
||||
executor,
|
||||
&m_pinDir2,
|
||||
freq,
|
||||
clampedFrequency,
|
||||
0,
|
||||
(pwm_gen_callback*)applyPinState);
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
}
|
||||
};
|
||||
|
||||
static EtbControl etb1;
|
||||
|
||||
extern percent_t mockPedalPosition;
|
||||
|
||||
Pid etbPid;
|
||||
|
||||
static percent_t directPwmValue = NAN;
|
||||
static percent_t currentEtbDuty;
|
||||
|
||||
|
@ -183,151 +180,167 @@ static percent_t currentEtbDuty;
|
|||
// this macro clamps both positive and negative percentages from about -100% to 100%
|
||||
#define ETB_PERCENT_TO_DUTY(X) (maxF(minF((X * 0.01), ETB_DUTY_LIMIT - 0.01), 0.01 - ETB_DUTY_LIMIT))
|
||||
|
||||
void EtbController::init(DcMotor *motor, int ownIndex) {
|
||||
this->m_motor = motor;
|
||||
this->ownIndex = ownIndex;
|
||||
}
|
||||
|
||||
int EtbController::getPeriodMs() {
|
||||
return GET_PERIOD_LIMITED(&engineConfiguration->etb);
|
||||
int EtbController::getPeriodMs() {
|
||||
return GET_PERIOD_LIMITED(&engineConfiguration->etb);
|
||||
}
|
||||
|
||||
void EtbController::PeriodicTask() {
|
||||
// set debug_mode 17
|
||||
if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_PID) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
etbPid.postState(&tsOutputChannels);
|
||||
tsOutputChannels.debugIntField5 = engine->engineState.etbFeedForward;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
} else if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_EXTRA) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
// set debug_mode 29
|
||||
tsOutputChannels.debugFloatField1 = directPwmValue;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
}
|
||||
|
||||
void EtbController::PeriodicTask() {
|
||||
// set debug_mode 17
|
||||
if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_PID) {
|
||||
if (!m_motor) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (startupPositionError) {
|
||||
m_motor->set(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldResetPid) {
|
||||
etbPid.reset();
|
||||
shouldResetPid = false;
|
||||
}
|
||||
|
||||
if (!cisnan(directPwmValue)) {
|
||||
m_motor->set(directPwmValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (boardConfiguration->pauseEtbControl) {
|
||||
m_motor->set(0);
|
||||
return;
|
||||
}
|
||||
|
||||
percent_t actualThrottlePosition = getTPSWithIndex(ownIndex PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
if (engine->etbAutoTune) {
|
||||
autoTune.input = actualThrottlePosition;
|
||||
bool result = autoTune.Runtime(&logger);
|
||||
|
||||
tuneWorkingPid.updateFactors(autoTune.output, 0, 0);
|
||||
|
||||
float value = tuneWorkingPid.getOutput(50, actualThrottlePosition);
|
||||
scheduleMsg(&logger, "AT input=%f output=%f PID=%f", autoTune.input,
|
||||
autoTune.output,
|
||||
value);
|
||||
scheduleMsg(&logger, "AT PID=%f", value);
|
||||
m_motor->set(ETB_PERCENT_TO_DUTY(value));
|
||||
|
||||
if (result) {
|
||||
scheduleMsg(&logger, "GREAT NEWS! %f/%f/%f", autoTune.GetKp(), autoTune.GetKi(), autoTune.GetKd());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
percent_t pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
int rpm = GET_RPM();
|
||||
engine->engineState.targetFromTable = pedal2tpsMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, pedalPosition);
|
||||
percent_t etbIdleAddition = CONFIGB(useETBforIdleControl) ? engine->engineState.idle.etbIdleAddition : 0;
|
||||
percent_t targetPosition = engine->engineState.targetFromTable + etbIdleAddition;
|
||||
|
||||
if (engineConfiguration->debugMode == DBG_ETB_LOGIC) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
etbPid.postState(&tsOutputChannels);
|
||||
tsOutputChannels.debugIntField5 = engine->engineState.etbFeedForward;
|
||||
tsOutputChannels.debugFloatField1 = engine->engineState.targetFromTable;
|
||||
tsOutputChannels.debugFloatField2 = engine->engineState.idle.etbIdleAddition;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
} else if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_EXTRA) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
// set debug_mode 29
|
||||
tsOutputChannels.debugFloatField1 = directPwmValue;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
}
|
||||
}
|
||||
|
||||
if (startupPositionError) {
|
||||
etb1.dcMotor.Set(0);
|
||||
return;
|
||||
}
|
||||
if (cisnan(targetPosition)) {
|
||||
// this could happen while changing settings
|
||||
warning(CUSTOM_ERR_ETB_TARGET, "target");
|
||||
return;
|
||||
}
|
||||
engine->engineState.etbFeedForward = interpolate2d("etbb", targetPosition, engineConfiguration->etbBiasBins, engineConfiguration->etbBiasValues);
|
||||
|
||||
if (shouldResetPid) {
|
||||
etbPid.reset();
|
||||
shouldResetPid = false;
|
||||
}
|
||||
etbPid.iTermMin = engineConfiguration->etb_iTermMin;
|
||||
etbPid.iTermMax = engineConfiguration->etb_iTermMax;
|
||||
|
||||
if (!cisnan(directPwmValue)) {
|
||||
etb1.dcMotor.Set(directPwmValue);
|
||||
return;
|
||||
}
|
||||
currentEtbDuty = engine->engineState.etbFeedForward +
|
||||
etbPid.getOutput(targetPosition, actualThrottlePosition);
|
||||
|
||||
if (boardConfiguration->pauseEtbControl) {
|
||||
etb1.dcMotor.Set(0);
|
||||
return;
|
||||
}
|
||||
m_motor->set(ETB_PERCENT_TO_DUTY(currentEtbDuty));
|
||||
|
||||
percent_t actualThrottlePosition = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
if (engineConfiguration->isVerboseETB) {
|
||||
etbPid.showPidStatus(&logger, "ETB");
|
||||
}
|
||||
|
||||
if (engine->etbAutoTune) {
|
||||
autoTune.input = actualThrottlePosition;
|
||||
bool result = autoTune.Runtime(&logger);
|
||||
|
||||
tuneWorkingPid.updateFactors(autoTune.output, 0, 0);
|
||||
|
||||
float value = tuneWorkingPid.getOutput(50, actualThrottlePosition);
|
||||
scheduleMsg(&logger, "AT input=%f output=%f PID=%f", autoTune.input,
|
||||
autoTune.output,
|
||||
value);
|
||||
scheduleMsg(&logger, "AT PID=%f", value);
|
||||
etb1.dcMotor.Set(ETB_PERCENT_TO_DUTY(value));
|
||||
|
||||
if (result) {
|
||||
scheduleMsg(&logger, "GREAT NEWS! %f/%f/%f", autoTune.GetKp(), autoTune.GetKi(), autoTune.GetKd());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
percent_t pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
int rpm = GET_RPM();
|
||||
engine->engineState.targetFromTable = pedal2tpsMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, pedalPosition);
|
||||
percent_t etbIdleAddition = CONFIGB(useETBforIdleControl) ? engine->engineState.idle.etbIdleAddition : 0;
|
||||
percent_t targetPosition = engine->engineState.targetFromTable + etbIdleAddition;
|
||||
|
||||
if (engineConfiguration->debugMode == DBG_ETB_LOGIC) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
tsOutputChannels.debugFloatField1 = engine->engineState.targetFromTable;
|
||||
tsOutputChannels.debugFloatField2 = engine->engineState.idle.etbIdleAddition;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
}
|
||||
|
||||
engine->engineState.etbFeedForward = interpolate2d("etbb", targetPosition, engineConfiguration->etbBiasBins, engineConfiguration->etbBiasValues);
|
||||
|
||||
etbPid.iTermMin = engineConfiguration->etb_iTermMin;
|
||||
etbPid.iTermMax = engineConfiguration->etb_iTermMax;
|
||||
|
||||
currentEtbDuty = engine->engineState.etbFeedForward +
|
||||
etbPid.getOutput(targetPosition, actualThrottlePosition);
|
||||
|
||||
etb1.dcMotor.Set(ETB_PERCENT_TO_DUTY(currentEtbDuty));
|
||||
|
||||
if (engineConfiguration->isVerboseETB) {
|
||||
etbPid.showPidStatus(&logger, "ETB");
|
||||
}
|
||||
|
||||
DISPLAY_STATE(Engine)
|
||||
DISPLAY_STATE(Engine)
|
||||
DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
|
||||
DISPLAY_TEXT(Electronic_Throttle);
|
||||
DISPLAY_SENSOR(TPS)
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY_TEXT(Electronic_Throttle);
|
||||
DISPLAY_SENSOR(TPS)
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Pedal);
|
||||
DISPLAY_SENSOR(PPS);
|
||||
DISPLAY(DISPLAY_CONFIG(throttlePedalPositionAdcChannel));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY_TEXT(Pedal);
|
||||
DISPLAY_SENSOR(PPS);
|
||||
DISPLAY(DISPLAY_CONFIG(throttlePedalPositionAdcChannel));
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Feed_forward);
|
||||
DISPLAY(DISPLAY_FIELD(etbFeedForward));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY_TEXT(Feed_forward);
|
||||
DISPLAY(DISPLAY_FIELD(etbFeedForward));
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_STATE(ETB_pid)
|
||||
DISPLAY_TEXT(input);
|
||||
DISPLAY(DISPLAY_FIELD(input));
|
||||
DISPLAY_TEXT(Output);
|
||||
DISPLAY(DISPLAY_FIELD(output));
|
||||
DISPLAY_TEXT(iTerm);
|
||||
DISPLAY(DISPLAY_FIELD(iTerm));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY(DISPLAY_FIELD(errorAmplificationCoef));
|
||||
DISPLAY(DISPLAY_FIELD(previousError));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY_STATE(ETB_pid)
|
||||
DISPLAY_TEXT(input);
|
||||
DISPLAY(DISPLAY_FIELD(input));
|
||||
DISPLAY_TEXT(Output);
|
||||
DISPLAY(DISPLAY_FIELD(output));
|
||||
DISPLAY_TEXT(iTerm);
|
||||
DISPLAY(DISPLAY_FIELD(iTerm));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY(DISPLAY_FIELD(errorAmplificationCoef));
|
||||
DISPLAY(DISPLAY_FIELD(previousError));
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Settings);
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_PFACTOR));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_IFACTOR));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_DFACTOR));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_OFFSET));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_PERIODMS));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_MINVALUE));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_MAXVALUE));
|
||||
DISPLAY_TEXT(Settings);
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_PFACTOR));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_IFACTOR));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_DFACTOR));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_OFFSET));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_PERIODMS));
|
||||
DISPLAY_TEXT(eol);
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_MINVALUE));
|
||||
DISPLAY(DISPLAY_CONFIG(ETB_MAXVALUE));
|
||||
/* DISPLAY_ELSE */
|
||||
DISPLAY_TEXT(No_Pedal_Sensor);
|
||||
DISPLAY_TEXT(No_Pedal_Sensor);
|
||||
/* DISPLAY_ENDIF */
|
||||
#if EFI_TUNER_STUDIO
|
||||
// 312
|
||||
tsOutputChannels.etbTarget = targetPosition;
|
||||
// 316
|
||||
tsOutputChannels.etb1DutyCycle = currentEtbDuty;
|
||||
// 320
|
||||
// Error is positive if the throttle needs to open further
|
||||
tsOutputChannels.etb1Error = targetPosition - actualThrottlePosition;
|
||||
// 312
|
||||
tsOutputChannels.etbTarget = targetPosition;
|
||||
// 316
|
||||
tsOutputChannels.etb1DutyCycle = currentEtbDuty;
|
||||
// 320
|
||||
// Error is positive if the throttle needs to open further
|
||||
tsOutputChannels.etb1Error = targetPosition - actualThrottlePosition;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
}
|
||||
}
|
||||
|
||||
EtbController etbController;
|
||||
static EtbHardware etbHardware[ETB_COUNT];
|
||||
EtbController etbController[ETB_COUNT];
|
||||
|
||||
/**
|
||||
* At the moment there are TWO ways to use this
|
||||
* set_etb_duty X
|
||||
* set etb X
|
||||
* manual duty cycle control without PID. Percent value from 0 to 100
|
||||
*/
|
||||
void setThrottleDutyCycle(percent_t level) {
|
||||
|
@ -339,14 +352,22 @@ void setThrottleDutyCycle(percent_t level) {
|
|||
|
||||
float dc = ETB_PERCENT_TO_DUTY(level);
|
||||
directPwmValue = dc;
|
||||
etb1.dcMotor.Set(dc);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbHardware[i].dcMotor.set(dc);
|
||||
}
|
||||
scheduleMsg(&logger, "duty ETB duty=%f", dc);
|
||||
}
|
||||
|
||||
static bool etbOperational = false;
|
||||
|
||||
static void showEthInfo(void) {
|
||||
#if EFI_PROD_CODE
|
||||
static char pinNameBuffer[16];
|
||||
|
||||
if (!etbOperational) {
|
||||
scheduleMsg(&logger, "ETB DISABLED since no PPS");
|
||||
}
|
||||
|
||||
scheduleMsg(&logger, "etbAutoTune=%d",
|
||||
engine->etbAutoTune);
|
||||
|
||||
|
@ -357,31 +378,48 @@ static void showEthInfo(void) {
|
|||
getPinNameByAdcChannel("tPedal", engineConfiguration->throttlePedalPositionAdcChannel, pinNameBuffer));
|
||||
|
||||
scheduleMsg(&logger, "TPS=%.2f", getTPS(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
scheduleMsg(&logger, "dir=%d DC=%f", etb1.dcMotor.isOpenDirection(), etb1.dcMotor.Get());
|
||||
|
||||
|
||||
scheduleMsg(&logger, "etbControlPin1=%s duty=%.2f freq=%d",
|
||||
hwPortname(CONFIGB(etb1.controlPin1)),
|
||||
hwPortname(CONFIG(etbIo[0].controlPin1)),
|
||||
currentEtbDuty,
|
||||
engineConfiguration->etbFreq);
|
||||
scheduleMsg(&logger, "dir1=%s", hwPortname(CONFIGB(etb1.directionPin1)));
|
||||
scheduleMsg(&logger, "dir2=%s", hwPortname(CONFIGB(etb1.directionPin2)));
|
||||
etbPid.showPidStatus(&logger, "ETB");
|
||||
scheduleMsg(&logger, "dir1=%s", hwPortname(CONFIG(etbIo[0].directionPin1)));
|
||||
scheduleMsg(&logger, "dir2=%s", hwPortname(CONFIG(etbIo[0].directionPin2)));
|
||||
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
EtbHardware *etb = &etbHardware[i];
|
||||
|
||||
scheduleMsg(&logger, "%d: dir=%d DC=%f", i, etb->dcMotor.isOpenDirection(), etb->dcMotor.get());
|
||||
}
|
||||
|
||||
etbController[0].etbPid.showPidStatus(&logger, "ETB");
|
||||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
static void etbPidReset() {
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbController[i].etbPid.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
static void setEtbFrequency(int frequency) {
|
||||
engineConfiguration->etbFreq = frequency;
|
||||
|
||||
etb1.setFrequency(frequency);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbHardware[i].setFrequency(frequency);
|
||||
}
|
||||
}
|
||||
|
||||
static void etbReset() {
|
||||
scheduleMsg(&logger, "etbReset");
|
||||
|
||||
etb1.dcMotor.Set(0);
|
||||
etbPid.reset();
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbHardware[i].dcMotor.set(0);
|
||||
}
|
||||
etbPidReset();
|
||||
|
||||
mockPedalPosition = MOCK_UNDEFINED;
|
||||
}
|
||||
|
@ -393,7 +431,7 @@ static void etbReset() {
|
|||
*/
|
||||
void setEtbPFactor(float value) {
|
||||
engineConfiguration->etb.pFactor = value;
|
||||
etbPid.reset();
|
||||
etbPidReset();
|
||||
showEthInfo();
|
||||
}
|
||||
|
||||
|
@ -402,7 +440,7 @@ void setEtbPFactor(float value) {
|
|||
*/
|
||||
void setEtbIFactor(float value) {
|
||||
engineConfiguration->etb.iFactor = value;
|
||||
etbPid.reset();
|
||||
etbPidReset();
|
||||
showEthInfo();
|
||||
}
|
||||
|
||||
|
@ -411,7 +449,7 @@ void setEtbIFactor(float value) {
|
|||
*/
|
||||
void setEtbDFactor(float value) {
|
||||
engineConfiguration->etb.dFactor = value;
|
||||
etbPid.reset();
|
||||
etbPidReset();
|
||||
showEthInfo();
|
||||
}
|
||||
|
||||
|
@ -420,7 +458,7 @@ void setEtbDFactor(float value) {
|
|||
*/
|
||||
void setEtbOffset(int value) {
|
||||
engineConfiguration->etb.offset = value;
|
||||
etbPid.reset();
|
||||
etbPidReset();
|
||||
showEthInfo();
|
||||
}
|
||||
|
||||
|
@ -459,8 +497,8 @@ void setBoschVNH2SP30Curve(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
CONFIG(etbIdleThrottleRange) = 5;
|
||||
|
||||
setLinearCurveAny<uint8_t>(config->pedalToTpsPedalBins, PEDAL_TO_TPS_SIZE, /*from*/0, /*to*/100, 1);
|
||||
setLinearCurveAny<uint8_t>(config->pedalToTpsRpmBins, PEDAL_TO_TPS_SIZE, /*from*/0, /*to*/8000 / RPM_1_BYTE_PACKING_MULT, 1);
|
||||
setLinearCurve(config->pedalToTpsPedalBins, /*from*/0, /*to*/100, 1);
|
||||
setLinearCurve(config->pedalToTpsRpmBins, /*from*/0, /*to*/8000 / RPM_1_BYTE_PACKING_MULT, 1);
|
||||
|
||||
for (int pedalIndex = 0;pedalIndex<PEDAL_TO_TPS_SIZE;pedalIndex++) {
|
||||
for (int rpmIndex = 0;rpmIndex<PEDAL_TO_TPS_SIZE;rpmIndex++) {
|
||||
|
@ -494,33 +532,50 @@ static bool isEtbPinsChanged(etb_io *current, etb_io *active) {
|
|||
|
||||
#if EFI_PROD_CODE
|
||||
bool isETBRestartNeeded(void) {
|
||||
/**
|
||||
* We do not want any interruption in HW pin while adjusting other properties
|
||||
*/
|
||||
return isEtbPinsChanged(&engineConfiguration->bc.etb1, &activeConfiguration.bc.etb1);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
/**
|
||||
* We do not want any interruption in HW pin while adjusting other properties
|
||||
*/
|
||||
bool changed = isEtbPinsChanged(&engineConfiguration->etbIo[i], &activeConfiguration.etbIo[i]);
|
||||
if (changed) {
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void stopETBPins(void) {
|
||||
brain_pin_markUnused(activeConfiguration.bc.etb1.controlPin1);
|
||||
brain_pin_markUnused(activeConfiguration.bc.etb1.directionPin1);
|
||||
brain_pin_markUnused(activeConfiguration.bc.etb1.directionPin2);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etb_io *activeIo = &activeConfiguration.etbIo[i];
|
||||
brain_pin_markUnused(activeIo->controlPin1);
|
||||
brain_pin_markUnused(activeIo->directionPin1);
|
||||
brain_pin_markUnused(activeIo->directionPin2);
|
||||
}
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration) {
|
||||
shouldResetPid = !etbPid.isSame(&previousConfiguration->etb);
|
||||
bool shouldResetPid = !etbController[0].etbPid.isSame(&previousConfiguration->etb);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbController[i].shouldResetPid = shouldResetPid;
|
||||
}
|
||||
}
|
||||
|
||||
void startETBPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
||||
// controlPinMode is a strange feature - it's simply because I am short on 5v I/O on Frankenso with Miata NB2 test mule
|
||||
etb1.start(
|
||||
CONFIG(etb1_use_two_wires),
|
||||
CONFIGB(etb1.controlPin1),
|
||||
&CONFIGB(etb1.controlPinMode),
|
||||
CONFIGB(etb1.directionPin1),
|
||||
CONFIGB(etb1.directionPin2)
|
||||
);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etb_io *io = &engineConfiguration->etbIo[i];
|
||||
// controlPinMode is a strange feature - it's simply because I am short on 5v I/O on Frankenso with Miata NB2 test mule
|
||||
etbHardware[i].start(
|
||||
CONFIG(etb_use_two_wires),
|
||||
io->controlPin1,
|
||||
&io->controlPinMode,
|
||||
io->directionPin1,
|
||||
io->directionPin2,
|
||||
&ENGINE(executor),
|
||||
CONFIG(etbFreq)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE && 0
|
||||
|
@ -588,10 +643,12 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
addConsoleActionI("etb_freq", setEtbFrequency);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
etbPid.initPidClass(&engineConfiguration->etb);
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbController[i].init(&etbHardware[i].dcMotor, i);
|
||||
etbController[i].etbPid.initPidClass(&engineConfiguration->etb);
|
||||
INJECT_ENGINE_REFERENCE(&etbController[i]);
|
||||
}
|
||||
|
||||
INJECT_ENGINE_REFERENCE(etb1);
|
||||
INJECT_ENGINE_REFERENCE(etbController);
|
||||
|
||||
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
|
||||
|
||||
|
@ -599,6 +656,7 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
if (!engine->engineState.hasEtbPedalPositionSensor) {
|
||||
return;
|
||||
}
|
||||
etbOperational = true;
|
||||
#if 0
|
||||
// not alive code
|
||||
autoTune.SetOutputStep(0.1);
|
||||
|
@ -621,12 +679,20 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
#if EFI_PROD_CODE
|
||||
if (engineConfiguration->etbCalibrationOnStart) {
|
||||
etb1.dcMotor.Set(70);
|
||||
chThdSleep(600);
|
||||
grabTPSIsWideOpen();
|
||||
etb1.dcMotor.Set(-70);
|
||||
chThdSleep(600);
|
||||
grabTPSIsClosed();
|
||||
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
EtbHardware *etb = &etbHardware[i];
|
||||
|
||||
etb->dcMotor.set(70);
|
||||
chThdSleep(600);
|
||||
// todo: grab with proper index
|
||||
grabTPSIsWideOpen();
|
||||
etb->dcMotor.set(-70);
|
||||
chThdSleep(600);
|
||||
// todo: grab with proper index
|
||||
grabTPSIsClosed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// manual duty cycle control without PID. Percent value from 0 to 100
|
||||
|
@ -651,9 +717,11 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
|
||||
etbPid.reset();
|
||||
etbPidReset();
|
||||
|
||||
etbController.Start();
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbController[i].Start();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||
|
|
|
@ -14,12 +14,21 @@
|
|||
#include "engine.h"
|
||||
#include "periodic_task.h"
|
||||
|
||||
class EtbController : public PeriodicTimerController {
|
||||
class DcMotor;
|
||||
|
||||
class EtbController final : public PeriodicTimerController {
|
||||
public:
|
||||
DECLARE_ENGINE_PTR;
|
||||
void init(DcMotor *motor, int ownIndex);
|
||||
|
||||
int getPeriodMs() override;
|
||||
void PeriodicTask() override;
|
||||
Pid etbPid;
|
||||
bool shouldResetPid = false;
|
||||
|
||||
private:
|
||||
int ownIndex;
|
||||
DcMotor *m_motor;
|
||||
};
|
||||
|
||||
void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "rpm_calculator.h"
|
||||
#include "pwm_generator.h"
|
||||
#include "idle_thread.h"
|
||||
#include "engine_math.h"
|
||||
|
||||
#include "engine.h"
|
||||
#include "periodic_task.h"
|
||||
|
@ -58,7 +59,7 @@ static bool shouldResetPid = false;
|
|||
// See automaticIdleController().
|
||||
static bool mightResetPid = false;
|
||||
|
||||
#if EFI_IDLE_INCREMENTAL_PID_CIC
|
||||
#if EFI_IDLE_PID_CIC
|
||||
// Use new PID with CIC integrator
|
||||
PidCic idlePid;
|
||||
#else
|
||||
|
@ -85,7 +86,7 @@ public:
|
|||
};
|
||||
|
||||
PidWithOverrides idlePid;
|
||||
#endif /* EFI_IDLE_INCREMENTAL_PID_CIC */
|
||||
#endif /* EFI_IDLE_PID_CIC */
|
||||
|
||||
// todo: extract interface for idle valve hardware, with solenoid and stepper implementations?
|
||||
static SimplePwm idleSolenoid("idle");
|
||||
|
@ -93,6 +94,8 @@ static SimplePwm idleSolenoid("idle");
|
|||
static uint32_t lastCrankingCyclesCounter = 0;
|
||||
static float lastCrankingIacPosition;
|
||||
|
||||
static iacPidMultiplier_t iacPidMultMap("iacPidMultiplier");
|
||||
|
||||
/**
|
||||
* When the IAC position value change is insignificant (lower than this threshold), leave the poor valve alone
|
||||
* todo: why do we have this logic? is this ever useful?
|
||||
|
@ -273,17 +276,18 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
// the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold)
|
||||
mightResetPid = true;
|
||||
|
||||
#if EFI_IDLE_INCREMENTAL_PID_CIC
|
||||
// Apply PID Multiplier if used
|
||||
if (CONFIG(useIacPidMultTable)) {
|
||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
float multCoef = iacPidMultMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, engineLoad);
|
||||
// PID can be completely disabled of multCoef==0, or it just works as usual if multCoef==1
|
||||
newValue = interpolateClamped(0.0f, engine->engineState.idle.baseIdlePosition, 1.0f, newValue, multCoef);
|
||||
}
|
||||
|
||||
// Apply PID Deactivation Threshold as a smooth taper for TPS transients.
|
||||
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
// Treat the 'newValue' as if it contains not an actual IAC position, but an incremental delta.
|
||||
// So we add this delta to the base IAC position, with a smooth taper for TPS transients.
|
||||
newValue = engine->engineState.idle.baseIdlePosition + interpolateClamped(0.0f, newValue, CONFIGB(idlePidDeactivationTpsThreshold), 0.0f, tpsPos);
|
||||
|
||||
// apply the PID limits
|
||||
newValue = maxF(newValue, CONFIG(idleRpmPid.minValue));
|
||||
newValue = minF(newValue, CONFIG(idleRpmPid.maxValue));
|
||||
#endif /* EFI_IDLE_INCREMENTAL_PID_CIC */
|
||||
// if tps==0 then PID just works as usual, or we completely disable it if tps>=threshold
|
||||
newValue = interpolateClamped(0.0f, newValue, CONFIGB(idlePidDeactivationTpsThreshold), engine->engineState.idle.baseIdlePosition, tpsPos);
|
||||
|
||||
// Interpolate to the manual position when RPM is close to the upper RPM limit (if idlePidRpmUpperLimit is set).
|
||||
// If RPM increases and the throttle is closed, then we're in coasting mode, and we should smoothly disable auto-pid.
|
||||
|
@ -348,8 +352,8 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
engine->acSwitchState = result;
|
||||
}
|
||||
if (CONFIGB(clutchUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->clutchUpState = efiReadPin(CONFIGB(clutchUpPin));
|
||||
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->clutchUpState = efiReadPin(CONFIG(clutchUpPin));
|
||||
}
|
||||
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->engineState.idle.throttlePedalUpState = efiReadPin(CONFIG(throttlePedalUpPin));
|
||||
|
@ -451,6 +455,7 @@ IdleController idleControllerInstance;
|
|||
|
||||
static void applyPidSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
idlePid.updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
|
||||
iacPidMultMap.init(CONFIG(iacPidMultTable), CONFIG(iacPidMultLoadBins), CONFIG(iacPidMultRpmBins));
|
||||
}
|
||||
|
||||
void setDefaultIdleParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
|
@ -516,9 +521,9 @@ void startIdleBench(void) {
|
|||
|
||||
static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||
efiAssertVoid(CUSTOM_ERR_6645, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
||||
efiAssertVoid(CUSTOM_ERR_6646, state->multiWave.waveCount == 1, "invalid idle waveCount");
|
||||
efiAssertVoid(CUSTOM_ERR_6646, state->multiChannelStateSequence.waveCount == 1, "invalid idle waveCount");
|
||||
OutputPin *output = state->outputPins[0];
|
||||
int value = state->multiWave.getChannelState(/*channelIndex*/0, stateIndex);
|
||||
int value = state->multiChannelStateSequence.getChannelState(/*channelIndex*/0, stateIndex);
|
||||
if (!value /* always allow turning solenoid off */ ||
|
||||
(GET_RPM_VALUE != 0 || timeToStopIdleTest != 0) /* do not run solenoid unless engine is spinning or bench testing in progress */
|
||||
) {
|
||||
|
@ -539,6 +544,7 @@ bool isIdleHardwareRestartNeeded() {
|
|||
}
|
||||
|
||||
void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
#if EFI_PROD_CODE
|
||||
brain_pin_markUnused(activeConfiguration.stepperEnablePin);
|
||||
brain_pin_markUnused(activeConfiguration.bc.idle.stepperStepPin);
|
||||
brain_pin_markUnused(activeConfiguration.bc.idle.solenoidPin);
|
||||
|
@ -546,7 +552,7 @@ void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
// brain_pin_markUnused(activeConfiguration.bc.idle.);
|
||||
// brain_pin_markUnused(activeConfiguration.bc.idle.);
|
||||
// brain_pin_markUnused(activeConfiguration.bc.idle.);
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
@ -577,7 +583,7 @@ void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
logger = sharedLogger;
|
||||
INJECT_ENGINE_REFERENCE(idleControllerInstance);
|
||||
INJECT_ENGINE_REFERENCE(&idleControllerInstance);
|
||||
|
||||
idlePid.initPidClass(&engineConfiguration->idleRpmPid);
|
||||
|
||||
|
@ -641,9 +647,9 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
getInputMode(CONFIGB(clutchDownPinMode)));
|
||||
}
|
||||
|
||||
if (CONFIGB(clutchUpPin) != GPIO_UNASSIGNED) {
|
||||
efiSetPadMode("clutch up switch", CONFIGB(clutchUpPin),
|
||||
getInputMode(CONFIGB(clutchUpPinMode)));
|
||||
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
|
||||
efiSetPadMode("clutch up switch", CONFIG(clutchUpPin),
|
||||
getInputMode(CONFIG(clutchUpPinMode)));
|
||||
}
|
||||
|
||||
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#if EFI_PWM_TESTER
|
||||
|
||||
#include "pwm_tester.h"
|
||||
#include "efi_wave.h"
|
||||
#include "state_requence.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "engine.h"
|
||||
#include "pwm_generator.h"
|
||||
|
|
|
@ -224,12 +224,12 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
}
|
||||
|
||||
void setDefaultIatTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
setLinearCurve(config->ignitionIatCorrLoadBins, IGN_LOAD_COUNT, /*from*/CLT_CURVE_RANGE_FROM, 110, 1);
|
||||
setLinearCurve(config->ignitionIatCorrLoadBins, /*from*/CLT_CURVE_RANGE_FROM, 110, 1);
|
||||
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
|
||||
memcpy(config->ignitionIatCorrRpmBins, iatTimingRpmBins, sizeof(iatTimingRpmBins));
|
||||
copyTimingTable(defaultIatTiming, config->ignitionIatCorrTable);
|
||||
#else
|
||||
setLinearCurve(config->ignitionIatCorrLoadBins, IGN_RPM_COUNT, /*from*/0, 6000, 1);
|
||||
setLinearCurve(config->ignitionIatCorrLoadBins, /*from*/0, 6000, 1);
|
||||
#endif /* IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT */
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@ CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
|||
$(PROJECT_DIR)/controllers/algo/engine_configuration.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/engine.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/engine2.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/lcd_menu_tree.cpp \
|
||||
$(PROJECT_DIR)/controllers/gauges/lcd_menu_tree.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/event_registry.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/algo.cpp \
|
||||
|
|
|
@ -77,6 +77,12 @@ case EFI_ADC_ERROR:
|
|||
return "EFI_ADC_ERROR";
|
||||
case EFI_ADC_NONE:
|
||||
return "EFI_ADC_NONE";
|
||||
#if EFI_UNIT_TEST
|
||||
case TEST_MAF_CHANNEL:
|
||||
case TEST_CLT_CHANNEL:
|
||||
case TEST_IAT_CHANNEL:
|
||||
return "EFI_TEST";
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -769,6 +775,8 @@ case SACHS:
|
|||
return "SACHS";
|
||||
case MRE_MIATA_NA6:
|
||||
return "MRE_MIATA_NA6";
|
||||
case PROTEUS:
|
||||
return "PROTEUS";
|
||||
case SUBARUEJ20G_DEFAULTS:
|
||||
return "SUBARUEJ20G_DEFAULTS";
|
||||
case SUBARU_2003_WRX:
|
||||
|
@ -999,6 +1007,8 @@ case SC_DETAILED_RPM:
|
|||
return "SC_DETAILED_RPM";
|
||||
case SC_MAP:
|
||||
return "SC_MAP";
|
||||
case SC_AUX_FAST1:
|
||||
return "SC_AUX_FAST1";
|
||||
case SC_OFF:
|
||||
return "SC_OFF";
|
||||
case SC_RPM_ACCEL:
|
||||
|
|
|
@ -52,16 +52,16 @@ FsioState::FsioState() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
void Engine::initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||
// we have a confusing threading model so some synchronization would not hurt
|
||||
bool alreadyLocked = lockAnyContext();
|
||||
|
||||
TRIGGER_SHAPE(initializeTriggerShape(logger,
|
||||
TRIGGER_WAVEFORM(initializeTriggerWaveform(logger,
|
||||
engineConfiguration->ambiguousOperationMode,
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger, &engineConfiguration->trigger));
|
||||
|
||||
if (TRIGGER_SHAPE(bothFrontsRequired) && engineConfiguration->useOnlyRisingEdgeForTrigger) {
|
||||
if (TRIGGER_WAVEFORM(bothFrontsRequired) && engineConfiguration->useOnlyRisingEdgeForTrigger) {
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
firmwareError(CUSTOM_ERR_BOTH_FRONTS_REQUIRED, "Inconsistent trigger setup");
|
||||
#else
|
||||
|
@ -70,9 +70,9 @@ void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SU
|
|||
}
|
||||
|
||||
|
||||
if (!TRIGGER_SHAPE(shapeDefinitionError)) {
|
||||
if (!TRIGGER_WAVEFORM(shapeDefinitionError)) {
|
||||
/**
|
||||
* this instance is used only to initialize 'this' TriggerShape instance
|
||||
* this instance is used only to initialize 'this' TriggerWaveform instance
|
||||
* #192 BUG real hardware trigger events could be coming even while we are initializing trigger
|
||||
*/
|
||||
initState.resetTriggerState();
|
||||
|
@ -82,14 +82,14 @@ void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SU
|
|||
if (engine->triggerCentral.triggerShape.getSize() == 0) {
|
||||
firmwareError(CUSTOM_ERR_TRIGGER_ZERO, "triggerShape size is zero");
|
||||
}
|
||||
engine->engineCycleEventCount = TRIGGER_SHAPE(getLength());
|
||||
engine->engineCycleEventCount = TRIGGER_WAVEFORM(getLength());
|
||||
}
|
||||
|
||||
if (!alreadyLocked) {
|
||||
unlockAnyContext();
|
||||
}
|
||||
|
||||
if (!TRIGGER_SHAPE(shapeDefinitionError)) {
|
||||
if (!TRIGGER_WAVEFORM(shapeDefinitionError)) {
|
||||
prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
|
||||
|
@ -121,7 +121,9 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
#if EFI_FSIO
|
||||
runFsio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif /* EFI_PROD_CODE && EFI_FSIO */
|
||||
#else
|
||||
runHardcodedFsio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif /* EFI_FSIO */
|
||||
|
||||
cylinderCleanupControl(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
@ -225,6 +227,19 @@ void Engine::preCalculate(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void Engine::OnTriggerStateDecodingError() {
|
||||
Engine *engine = this;
|
||||
EXPAND_Engine;
|
||||
triggerCentral.triggerState.handleTriggerError(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
void Engine::OnTriggerStateProperState(efitick_t nowNt) {
|
||||
Engine *engine = this;
|
||||
EXPAND_Engine;
|
||||
rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
|
||||
void Engine::setConfig(persistent_config_s *config) {
|
||||
this->config = config;
|
||||
engineConfigurationPtr = &config->engineConfiguration;
|
||||
|
@ -382,3 +397,22 @@ void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
// let's close injectors or else if these happen to be open right now
|
||||
enginePins.stopPins();
|
||||
}
|
||||
|
||||
void action_s::setAction(schfunc_t callback, void *param) {
|
||||
this->callback = callback;
|
||||
this->param = param;
|
||||
}
|
||||
|
||||
void action_s::execute() {
|
||||
efiAssertVoid(CUSTOM_ERR_ASSERT, callback != NULL, "callback==null1");
|
||||
callback(param);
|
||||
}
|
||||
|
||||
schfunc_t action_s::getCallback() const {
|
||||
return callback;
|
||||
}
|
||||
|
||||
void * action_s::getArgument() const {
|
||||
return param;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,16 @@ class RpmCalculator;
|
|||
#define CLEANUP_MODE_TPS 90
|
||||
#define STEPPER_PARKING_TPS CLEANUP_MODE_TPS
|
||||
|
||||
class Engine {
|
||||
#define CYCLE_ALTERNATION 2
|
||||
|
||||
class Engine : public TriggerStateListener {
|
||||
public:
|
||||
explicit Engine(persistent_config_s *config);
|
||||
Engine();
|
||||
|
||||
void OnTriggerStateDecodingError() override;
|
||||
void OnTriggerStateProperState(efitick_t nowNt) override;
|
||||
|
||||
void setConfig(persistent_config_s *config);
|
||||
injection_mode_e getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
@ -56,6 +62,10 @@ public:
|
|||
LocalVersionHolder auxParametersVersion;
|
||||
operation_mode_e getOperationMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
AuxActor auxValves[AUX_DIGITAL_VALVE_COUNT][2];
|
||||
|
||||
bool needTdcCallback = true;
|
||||
|
||||
/**
|
||||
* By the way 32-bit value should hold at least 400 hours of events at 6K RPM x 12 events per revolution
|
||||
*/
|
||||
|
@ -102,9 +112,11 @@ public:
|
|||
bool needToStopEngine(efitick_t nowNt) const;
|
||||
bool etbAutoTune = false;
|
||||
/**
|
||||
* That's the linked list of pending spark firing events
|
||||
* That's the linked list of pending events scheduled in relation to trigger
|
||||
* At the moment we iterate over the whole list while looking for events for specific trigger index
|
||||
* We can make it an array of lists per trigger index, but that would take some RAM and probably not needed yet.
|
||||
*/
|
||||
IgnitionEvent *ignitionEventsHead = nullptr;
|
||||
AngleBasedEvent *angleBasedEventsHead = nullptr;
|
||||
/**
|
||||
* this is based on isEngineChartEnabled and engineSnifferRpmThreshold settings
|
||||
*/
|
||||
|
@ -132,9 +144,6 @@ public:
|
|||
// timestamp of most recent time RPM hard limit was triggered
|
||||
efitime_t rpmHardLimitTimestamp = 0;
|
||||
|
||||
// todo: should be a field on some other class, not Engine?
|
||||
bool isInitializingTrigger = false;
|
||||
|
||||
/**
|
||||
* This flag indicated a big enough problem that engine control would be
|
||||
* prohibited if this flag is set to true.
|
||||
|
@ -185,7 +194,7 @@ public:
|
|||
void periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
bool clutchUpState = false;
|
||||
bool clutchDownState = false;
|
||||
|
|
|
@ -145,7 +145,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
if (!engine->slowCallBackWasInvoked) {
|
||||
warning(CUSTOM_ERR_6696, "Slow not invoked yet");
|
||||
warning(CUSTOM_SLOW_NOT_INVOKED, "Slow not invoked yet");
|
||||
}
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
|
|
|
@ -143,6 +143,8 @@ static fuel_table_t alphaNfuel = {
|
|||
*/
|
||||
#ifdef EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
||||
engine_configuration_s & activeConfiguration = *(engine_configuration_s *)EFI_ACTIVE_CONFIGURATION_IN_FLASH;
|
||||
// we cannot use this activeConfiguration until we call rememberCurrentConfiguration()
|
||||
bool isActiveConfigurationVoid = true;
|
||||
#else
|
||||
static engine_configuration_s activeConfigurationLocalStorage;
|
||||
engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage;
|
||||
|
@ -153,6 +155,8 @@ extern engine_configuration_s *engineConfiguration;
|
|||
void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
#ifndef EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
||||
memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s));
|
||||
#else
|
||||
isActiveConfigurationVoid = false;
|
||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
||||
}
|
||||
|
||||
|
@ -208,7 +212,7 @@ void setConstantDwell(floatms_t dwellMs DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
|||
for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
|
||||
engineConfiguration->sparkDwellRpmBins[i] = 1000 * i;
|
||||
}
|
||||
setLinearCurve(engineConfiguration->sparkDwellValues, DWELL_CURVE_SIZE, dwellMs, dwellMs, 0.01);
|
||||
setLinearCurve(engineConfiguration->sparkDwellValues, dwellMs, dwellMs, 0.01);
|
||||
}
|
||||
|
||||
void setAfrMap(afr_table_t table, float value) {
|
||||
|
@ -248,9 +252,9 @@ void setWholeIgnitionIatCorr(float value DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
|||
}
|
||||
|
||||
void setFuelTablesLoadBin(float minValue, float maxValue DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||
setLinearCurve(config->injPhaseLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
|
||||
setLinearCurve(config->veLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
|
||||
setLinearCurve(config->afrLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
|
||||
setLinearCurve(config->injPhaseLoadBins, minValue, maxValue, 1);
|
||||
setLinearCurve(config->veLoadBins, minValue, maxValue, 1);
|
||||
setLinearCurve(config->afrLoadBins, minValue, maxValue, 1);
|
||||
}
|
||||
|
||||
void setTimingMap(ignition_table_t map, float value) {
|
||||
|
@ -304,6 +308,11 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
|
|||
engineConfiguration->vbattAdcChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_NONE;
|
||||
/* this breaks unit tests lovely TODO: fix this?
|
||||
engineConfiguration->tps1_1AdcChannel = EFI_ADC_NONE;
|
||||
*/
|
||||
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->bc.auxFastSensor1_adcChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->acSwitchAdc = EFI_ADC_NONE;
|
||||
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
|
||||
engineConfiguration->fuelLevelSensor = EFI_ADC_NONE;
|
||||
|
@ -313,7 +322,7 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
|
|||
engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE;
|
||||
|
||||
boardConfiguration->clutchDownPinMode = PI_PULLUP;
|
||||
boardConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
engineConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
engineConfiguration->brakePedalPinMode = PI_PULLUP;
|
||||
}
|
||||
|
||||
|
@ -450,11 +459,11 @@ static void setDefaultFuelCutParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
static void setDefaultCrankingSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
CONFIG(useTLE8888_cranking_hack) = true;
|
||||
|
||||
setLinearCurve(engineConfiguration->crankingTpsCoef, CRANKING_CURVE_SIZE, /*from*/1, /*to*/1, 1);
|
||||
setLinearCurve(engineConfiguration->crankingTpsBins, CRANKING_CURVE_SIZE, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->crankingTpsCoef, /*from*/1, /*to*/1, 1);
|
||||
setLinearCurve(engineConfiguration->crankingTpsBins, 0, 100, 1);
|
||||
|
||||
setLinearCurve(config->cltCrankingCorrBins, CLT_CRANKING_CURVE_SIZE, CLT_CURVE_RANGE_FROM, 100, 1);
|
||||
setLinearCurve(config->cltCrankingCorr, CLT_CRANKING_CURVE_SIZE, 1.0, 1.0, 1);
|
||||
setLinearCurve(config->cltCrankingCorrBins, CLT_CURVE_RANGE_FROM, 100, 1);
|
||||
setLinearCurve(config->cltCrankingCorr, 1.0, 1.0, 1);
|
||||
|
||||
config->crankingFuelCoef[0] = 2.8; // base cranking fuel adjustment coefficient
|
||||
config->crankingFuelBins[0] = -20; // temperature in C
|
||||
|
@ -510,7 +519,7 @@ static void setDefaultCrankingSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* see also setTargetRpmCurve()
|
||||
*/
|
||||
static void setDefaultIdleSpeedTarget(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_SIZE, CLT_CURVE_RANGE_FROM, 140, 10);
|
||||
setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 140, 10);
|
||||
|
||||
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -30, 1350);
|
||||
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -20, 1300);
|
||||
|
@ -548,8 +557,8 @@ static void setCanFrankensoDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
* see also setDefaultIdleSpeedTarget()
|
||||
*/
|
||||
void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||
setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_SIZE, CLT_CURVE_RANGE_FROM, 90, 10);
|
||||
setLinearCurve(engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, rpm, rpm, 10);
|
||||
setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 90, 10);
|
||||
setLinearCurve(engineConfiguration->cltIdleRpm, rpm, rpm, 10);
|
||||
}
|
||||
|
||||
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
@ -600,7 +609,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
setDefaultEtbBiasCurve(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||
|
||||
CONFIGB(mafSensorType) = Bosch0280218037;
|
||||
CONFIG(mafSensorType) = Bosch0280218037;
|
||||
setBosch0280218037(config);
|
||||
|
||||
setBosch02880155868(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -639,17 +648,17 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
engineConfiguration->alternatorControl.minValue = 10;
|
||||
engineConfiguration->alternatorControl.maxValue = 90;
|
||||
|
||||
setLinearCurve(engineConfiguration->cltTimingBins, CLT_TIMING_CURVE_SIZE, CLT_CURVE_RANGE_FROM, 120, 1);
|
||||
setLinearCurve(engineConfiguration->cltTimingExtra, CLT_TIMING_CURVE_SIZE, 0, 0, 1);
|
||||
setLinearCurve(engineConfiguration->cltTimingBins, CLT_CURVE_RANGE_FROM, 120, 1);
|
||||
setLinearCurve(engineConfiguration->cltTimingExtra, 0, 0, 1);
|
||||
|
||||
setLinearCurve(engineConfiguration->fsioCurve1Bins, FSIO_CURVE_16, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve1, FSIO_CURVE_16, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve1Bins, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve1, 0, 100, 1);
|
||||
|
||||
setLinearCurve(engineConfiguration->fsioCurve2Bins, FSIO_CURVE_16, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve2, FSIO_CURVE_16, 30, 170, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve2Bins, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve2, 30, 170, 1);
|
||||
|
||||
setLinearCurve(engineConfiguration->fsioCurve3Bins, FSIO_CURVE_8, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve4Bins, FSIO_CURVE_8, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve3Bins, 0, 100, 1);
|
||||
setLinearCurve(engineConfiguration->fsioCurve4Bins, 0, 100, 1);
|
||||
|
||||
|
||||
setDefaultWarmupIdleCorrection(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
@ -677,10 +686,10 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
setTimingLoadBin(1.2, 4.4 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setTimingRpmBin(800, 7000 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
setLinearCurve(engineConfiguration->map.samplingAngleBins, MAP_ANGLE_SIZE, 800, 7000, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingAngle, MAP_ANGLE_SIZE, 100, 130, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingWindowBins, MAP_ANGLE_SIZE, 800, 7000, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingWindow, MAP_ANGLE_SIZE, 50, 50, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingAngleBins, 800, 7000, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingAngle, 100, 130, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingWindowBins, 800, 7000, 1);
|
||||
setLinearCurve(engineConfiguration->map.samplingWindow, 50, 50, 1);
|
||||
|
||||
// set_whole_timing_map 3
|
||||
setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
@ -696,19 +705,19 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
setFuelTablesLoadBin(10, 160 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
setDefaultIatTimingCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
setLinearCurve(engineConfiguration->mapAccelTaperBins, FSIO_TABLE_8, 0, 32, 4);
|
||||
setLinearCurve(engineConfiguration->mapAccelTaperMult, FSIO_TABLE_8, 1, 1, 1);
|
||||
setLinearCurve(engineConfiguration->mapAccelTaperBins, 0, 32, 4);
|
||||
setLinearCurve(engineConfiguration->mapAccelTaperMult, 1, 1, 1);
|
||||
|
||||
setLinearCurve(config->tpsTpsAccelFromRpmBins, FSIO_TABLE_8, 0, 100, 10);
|
||||
setLinearCurve(config->tpsTpsAccelToRpmBins, FSIO_TABLE_8, 0, 100, 10);
|
||||
setLinearCurve(config->tpsTpsAccelFromRpmBins, 0, 100, 10);
|
||||
setLinearCurve(config->tpsTpsAccelToRpmBins, 0, 100, 10);
|
||||
|
||||
setLinearCurve(config->fsioTable1LoadBins, FSIO_TABLE_8, 20, 120, 10);
|
||||
setLinearCurve(config->fsioTable1LoadBins, 20, 120, 10);
|
||||
setRpmTableBin(config->fsioTable1RpmBins, FSIO_TABLE_8);
|
||||
setLinearCurve(config->fsioTable2LoadBins, FSIO_TABLE_8, 20, 120, 10);
|
||||
setLinearCurve(config->fsioTable2LoadBins, 20, 120, 10);
|
||||
setRpmTableBin(config->fsioTable2RpmBins, FSIO_TABLE_8);
|
||||
setLinearCurve(config->fsioTable3LoadBins, FSIO_TABLE_8, 20, 120, 10);
|
||||
setLinearCurve(config->fsioTable3LoadBins, 20, 120, 10);
|
||||
setRpmTableBin(config->fsioTable3RpmBins, FSIO_TABLE_8);
|
||||
setLinearCurve(config->fsioTable4LoadBins, FSIO_TABLE_8, 20, 120, 10);
|
||||
setLinearCurve(config->fsioTable4LoadBins, 20, 120, 10);
|
||||
setRpmTableBin(config->fsioTable4RpmBins, FSIO_TABLE_8);
|
||||
|
||||
initEngineNoiseTable(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -1103,7 +1112,7 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
|
|||
#endif /* EFI_SUPPORT_FORD_FIESTA */
|
||||
#if EFI_SUPPORT_NISSAN_PRIMERA
|
||||
case NISSAN_PRIMERA:
|
||||
setNissanPrimeraEngineConfiguration(engineConfiguration);
|
||||
setNissanPrimeraEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
#endif
|
||||
case HONDA_ACCORD_CD:
|
||||
|
@ -1122,6 +1131,7 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
|
|||
setEtbTestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case MICRO_RUS_EFI:
|
||||
case PROTEUS:
|
||||
// nothing to do - we do it all in setBoardConfigurationOverrides
|
||||
break;
|
||||
case TLE8888_BENCH_ENGINE:
|
||||
|
@ -1163,7 +1173,7 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
|
|||
setMazdaMiataNb1EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case MAZDA_323:
|
||||
setMazda323EngineConfiguration(engineConfiguration);
|
||||
setMazda323EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case MAZDA_626:
|
||||
setMazda626EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
@ -1286,7 +1296,7 @@ void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S
|
|||
assertEngineReference();
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
ENGINE(eInitializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ENGINE(initializeTriggerWaveform(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
#endif
|
||||
|
||||
#if EFI_FSIO
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
angle_t mapAveragingStart[INJECTION_PIN_COUNT];
|
||||
angle_t mapAveragingDuration = 0;
|
||||
|
||||
/**
|
||||
* timing advance is angle distance before Top Dead Center (TDP), i.e. "10 degree timing advance" means "happens 10 degrees before TDC"
|
||||
*/
|
||||
angle_t timingAdvance = 0;
|
||||
// fuel-related;
|
||||
float fuelCutoffCorrection = 0;
|
||||
|
|
|
@ -38,12 +38,3 @@ IgnitionOutputPin * IgnitionEvent::getOutputForLoggins() {
|
|||
return outputs[0];
|
||||
}
|
||||
|
||||
|
||||
//void registerActuatorEventWhat(InjectionEventList *list, int eventIndex, OutputSignal *actuator, float angleOffset) {
|
||||
// ActuatorEvent *e = list->getNextActuatorEvent();
|
||||
// if (e == NULL)
|
||||
// return; // error already reported
|
||||
// e->position.eventIndex = eventIndex;
|
||||
// e->actuator = actuator;
|
||||
// e->position.angleOffset = angleOffset;
|
||||
//}
|
||||
|
|
|
@ -28,9 +28,7 @@ public:
|
|||
bool isSimultanious;
|
||||
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
||||
int ownIndex;
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *engine;
|
||||
#endif
|
||||
DECLARE_ENGINE_PTR;
|
||||
event_trigger_position_s injectionStart;
|
||||
|
||||
scheduling_s signalTimerUp;
|
||||
|
@ -69,6 +67,17 @@ private:
|
|||
void clear();
|
||||
};
|
||||
|
||||
class AngleBasedEvent {
|
||||
public:
|
||||
scheduling_s scheduling;
|
||||
event_trigger_position_s position;
|
||||
action_s action;
|
||||
/**
|
||||
* Trigger-based scheduler maintains a linked list of all pending tooth-based events.
|
||||
*/
|
||||
AngleBasedEvent *nextToothEvent = nullptr;
|
||||
};
|
||||
|
||||
#define MAX_OUTPUTS_FOR_IGNITION 2
|
||||
|
||||
class IgnitionEvent {
|
||||
|
@ -76,22 +85,17 @@ public:
|
|||
IgnitionEvent();
|
||||
IgnitionOutputPin *outputs[MAX_OUTPUTS_FOR_IGNITION];
|
||||
scheduling_s dwellStartTimer;
|
||||
scheduling_s signalTimerDown;
|
||||
AngleBasedEvent sparkEvent;
|
||||
/**
|
||||
* Desired timing advance
|
||||
*/
|
||||
angle_t advance = NAN;
|
||||
angle_t sparkAngle = NAN;
|
||||
floatms_t sparkDwell;
|
||||
/**
|
||||
* this timestamp allows us to measure actual dwell time
|
||||
*/
|
||||
uint32_t actualStartOfDwellNt;
|
||||
event_trigger_position_s dwellPosition;
|
||||
event_trigger_position_s sparkPosition;
|
||||
/**
|
||||
* Ignition scheduler maintains a linked list of all pending ignition events.
|
||||
*/
|
||||
IgnitionEvent *next = nullptr;
|
||||
/**
|
||||
* Sequential number of currently processed spark event
|
||||
* @see globalSparkIdCounter
|
||||
|
@ -102,9 +106,7 @@ public:
|
|||
*/
|
||||
int cylinderIndex = 0;
|
||||
char *name = nullptr;
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *engine;
|
||||
#endif
|
||||
DECLARE_ENGINE_PTR;
|
||||
IgnitionOutputPin *getOutputForLoggins();
|
||||
};
|
||||
|
||||
|
@ -118,3 +120,14 @@ public:
|
|||
IgnitionEvent elements[MAX_IGNITION_EVENT_COUNT];
|
||||
bool isReady = false;
|
||||
};
|
||||
|
||||
class AuxActor {
|
||||
public:
|
||||
int phaseIndex;
|
||||
int valveIndex;
|
||||
angle_t extra;
|
||||
|
||||
AngleBasedEvent open;
|
||||
AngleBasedEvent close;
|
||||
DECLARE_ENGINE_PTR;
|
||||
};
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/*
|
||||
* @file firing_order.h
|
||||
*
|
||||
* See also FiringOrderTSLogic.java
|
||||
*
|
||||
* @date Jul 20, 2016
|
||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
|
||||
#include "rusefi_enums.h"
|
||||
|
||||
|
||||
#ifndef CONTROLLERS_ALGO_FIRING_ORDER_H_
|
||||
#define CONTROLLERS_ALGO_FIRING_ORDER_H_
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
FO_1 = 0,
|
||||
|
@ -53,6 +53,3 @@ typedef enum {
|
|||
|
||||
Force_4b_firing_order = ENUM_32_BITS,
|
||||
} firing_order_e;
|
||||
|
||||
|
||||
#endif /* CONTROLLERS_ALGO_FIRING_ORDER_H_ */
|
||||
|
|
|
@ -1831,7 +1831,7 @@ typedef enum {
|
|||
CUSTOM_ERR_PIN_ALREADY_USED_2 = 6134,
|
||||
CUSTOM_ERR_ICU_STATE = 6135,
|
||||
CUSTOM_ERR_TCHARGE_NOT_READY = 6136,
|
||||
CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG = 6137,
|
||||
CUSTOM_ERR_TRIGGER_WAVEFORM_TOO_LONG = 6137,
|
||||
CUSTOM_ERR_FUEL_TABLE_NOT_READY = 6138,
|
||||
CUSTOM_ERR_TCHARGE_NOT_READY2 = 6139,
|
||||
|
||||
|
@ -1938,8 +1938,8 @@ typedef enum {
|
|||
CUSTOM_ERR_6585 = 6585,
|
||||
CUSTOM_ERR_6586 = 6586,
|
||||
CUSTOM_ERR_6587 = 6587,
|
||||
CUSTOM_ERR_6588 = 6588,
|
||||
CUSTOM_ERR_6589 = 6589,
|
||||
CUSTOM_NULL_SHAPE = 6588,
|
||||
CUSTOM_SPARK_ANGLE_1 = 6589,
|
||||
|
||||
CUSTOM_ERR_6590 = 6590,
|
||||
CUSTOM_ERR_6591 = 6591,
|
||||
|
@ -2026,14 +2026,14 @@ typedef enum {
|
|||
CUSTOM_ERR_6665 = 6665,
|
||||
CUSTOM_ERR_6666 = 6666,
|
||||
CUSTOM_ERR_ADCANCE_CALC_ANGLE = 6667,
|
||||
CUSTOM_ERR_6668 = 6668,
|
||||
CUSTOM_ERR_ETB_TARGET = 6668,
|
||||
CUSTOM_ERR_6669 = 6669,
|
||||
|
||||
CUSTOM_ERR_6670 = 6670,
|
||||
CUSTOM_ERR_6671 = 6671,
|
||||
CUSTOM_ERR_6672 = 6672,
|
||||
CUSTOM_ERR_6673 = 6673,
|
||||
CUSTOM_ERR_6674 = 6674,
|
||||
CUSTOM_STACK_ADC_6671 = 6671,
|
||||
CUSTOM_ICU_DRIVER = 6672,
|
||||
CUSTOM_ICU_DRIVER_STATE = 6673,
|
||||
CUSTOM_STACK_SPI = 6674,
|
||||
CUSTOM_ERR_6675 = 6675,
|
||||
CUSTOM_ERR_6676 = 6676,
|
||||
CUSTOM_IH_STACK = 6677,
|
||||
|
@ -2049,16 +2049,16 @@ typedef enum {
|
|||
CUSTOM_ERR_6686 = 6686,
|
||||
CUSTOM_ERR_6687 = 6687,
|
||||
CUSTOM_ERR_6688 = 6688,
|
||||
CUSTOM_ERR_6689 = 6689,
|
||||
CUSTOM_SPARK_ANGLE_9 = 6689,
|
||||
|
||||
CUSTOM_ERR_MAP_START_ASSERT = 6690,
|
||||
CUSTOM_ERR_MAP_AVG_OFFSET = 6691,
|
||||
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,
|
||||
CUSTOM_ERR_6697 = 6697,
|
||||
CUSTOM_NULL_EXECUTOR = 6695,
|
||||
CUSTOM_SLOW_NOT_INVOKED = 6696,
|
||||
CUSTOM_PWM_CYCLE_START = 6697,
|
||||
CUSTOM_ERR_ARRAY_IS_FULL = 6698,
|
||||
CUSTOM_ERR_ARRAY_REMOVE_ERROR = 6699,
|
||||
CUSTOM_ERR_INVALID_INPUT_ICU_PIN = 6700,
|
||||
|
@ -2069,7 +2069,7 @@ typedef enum {
|
|||
CUSTOM_ERR_6703 = 6703,
|
||||
CUSTOM_ERR_BOTH_FRONTS_REQUIRED = 6704,
|
||||
CUSTOM_TLE8888 = 6705,
|
||||
CUSTOM_ERR_6706 = 6706,
|
||||
CUSTOM_KNOCK_WINDOW = 6706,
|
||||
CUSTOM_ERR_TIMER_TEST_CALLBACK_NOT_HAPPENED = 6707,
|
||||
CUSTOM_ERR_TIMER_TEST_CALLBACK_WRONG_TIME = 6708,
|
||||
CUSTOM_ERR_6709 = 6709,
|
||||
|
@ -2080,8 +2080,20 @@ typedef enum {
|
|||
CUSTOM_ERR_PWM_SWITCH_ASSERT = 6714,
|
||||
|
||||
|
||||
CUSTOM_INVALID_ADC = 6720,
|
||||
CUSTOM_ERR_6721 = 6721,
|
||||
CUSTOM_ERR_6722 = 6722,
|
||||
CUSTOM_ERR_6723 = 6723,
|
||||
CUSTOM_ERR_6724 = 6724,
|
||||
CUSTOM_ERR_6725 = 6725,
|
||||
CUSTOM_ERR_6726 = 6726,
|
||||
CUSTOM_ERR_6727 = 6727,
|
||||
CUSTOM_ERR_6728 = 6728,
|
||||
CUSTOM_ERR_6729 = 6729,
|
||||
|
||||
|
||||
CUSTOM_ERR_TRIGGER_SYNC = 9000,
|
||||
CUSTOM_OBD_TRIGGER_SHAPE = 9001,
|
||||
CUSTOM_OBD_TRIGGER_WAVEFORM = 9001,
|
||||
/**
|
||||
* This is not engine miss detection - this is only internal scheduler state validation
|
||||
* Should not happen
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef enum {
|
|||
|
||||
// used by unit test
|
||||
// see https://github.com/rusefi/rusefi/issues/898
|
||||
// see TriggerShape::bothFrontsRequired
|
||||
// see TriggerWaveform::bothFrontsRequired
|
||||
ISSUE_898 = 27,
|
||||
|
||||
MAZDA_626 = 28,
|
||||
|
@ -187,6 +187,8 @@ typedef enum {
|
|||
|
||||
MICRO_RUS_EFI = 60,
|
||||
|
||||
PROTEUS = 61,
|
||||
|
||||
/**
|
||||
* this configuration has as few pins configured as possible
|
||||
*/
|
||||
|
@ -719,6 +721,7 @@ typedef enum {
|
|||
SC_MAP = 2,
|
||||
SC_RPM_ACCEL = 3,
|
||||
SC_DETAILED_RPM = 4,
|
||||
SC_AUX_FAST1 = 5,
|
||||
|
||||
Internal_ForceMyEnumIntSize_sensor_chart = ENUM_32_BITS,
|
||||
} sensor_chart_e;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* @date Jan 12, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||
*/
|
||||
#ifndef CONTROLLERS_ALGO_RUSEFI_TYPES_H_
|
||||
#define CONTROLLERS_ALGO_RUSEFI_TYPES_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -90,7 +90,6 @@ 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];
|
||||
|
||||
typedef float fsio_table_8x8_f32t[FSIO_TABLE_8][FSIO_TABLE_8];
|
||||
typedef uint8_t fsio_table_8x8_u8t[FSIO_TABLE_8][FSIO_TABLE_8];
|
||||
typedef float tps_tps_table_t[TPS_TPS_ACCEL_TABLE][TPS_TPS_ACCEL_TABLE];
|
||||
typedef uint8_t fsio_table_8x8_u8t[FSIO_TABLE_8][FSIO_TABLE_8];
|
||||
|
||||
|
@ -131,5 +130,3 @@ typedef void (*VoidCharPtrCharPtrVoidPtr)(const char *, const char *, void*);
|
|||
|
||||
typedef void (*VoidCharPtrCharPtrCharPtr)(const char *, const char *, const char *);
|
||||
typedef void (*VoidCharPtrCharPtrCharPtrCharPtrCharPtr)(const char *, const char *, const char *, const char *, const char *);
|
||||
|
||||
#endif /* CONTROLLERS_ALGO_RUSEFI_TYPES_H_ */
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
include $(PROJECT_DIR)/controllers/algo/algo.mk
|
||||
include $(PROJECT_DIR)/controllers/core/core.mk
|
||||
include $(PROJECT_DIR)/controllers/math/math.mk
|
||||
include $(PROJECT_DIR)/controllers/trigger/trigger.mk
|
||||
include $(PROJECT_DIR)/controllers/sensors/sensors.mk
|
||||
include $(PROJECT_DIR)/controllers/system/system.mk
|
||||
#include $(PROJECT_DIR)/controllers/gauges/gauges.mk
|
||||
|
||||
CONTROLLERS_DIR=$(PROJECT_DIR)/controllers
|
||||
|
||||
CONTROLLERSSRC =
|
||||
|
@ -5,34 +13,42 @@ CONTROLLERSSRC =
|
|||
CONTROLLERS_SRC_CPP = \
|
||||
$(CONTROLLERS_DIR)/actuators/electronic_throttle.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/alternator_controller.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/malfunction_indicator.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/tachometer.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/idle_thread.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/pwm_tester.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/algo/aux_pid.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/lcd_controller.cpp \
|
||||
$(CONTROLLERS_DIR)/scheduling/signal_executor_sleep.cpp \
|
||||
$(CONTROLLERS_DIR)/scheduling/single_timer_executor.cpp \
|
||||
$(CONTROLLERS_DIR)/scheduling/pwm_generator_logic.cpp \
|
||||
$(CONTROLLERS_DIR)/scheduling/event_queue.cpp \
|
||||
$(PROJECT_DIR)/controllers/settings.cpp \
|
||||
$(PROJECT_DIR)/controllers/core/error_handling.cpp \
|
||||
$(PROJECT_DIR)/controllers/map_averaging.cpp \
|
||||
$(PROJECT_DIR)/controllers/flash_main.cpp \
|
||||
$(PROJECT_DIR)/controllers/injector_central.cpp \
|
||||
$(PROJECT_DIR)/controllers/obd2.cpp \
|
||||
$(PROJECT_DIR)/controllers/engine_controller.cpp \
|
||||
$(PROJECT_DIR)/controllers/persistent_store.cpp \
|
||||
$(CONTROLLERS_DIR)/gauges/tachometer.cpp \
|
||||
$(CONTROLLERS_DIR)/gauges/malfunction_indicator.cpp \
|
||||
$(CONTROLLERS_DIR)/gauges/lcd_controller.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/signal_executor_sleep.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/single_timer_executor.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/pwm_generator_logic.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/event_queue.cpp \
|
||||
$(CONTROLLERS_DIR)/settings.cpp \
|
||||
$(CONTROLLERS_DIR)/core/error_handling.cpp \
|
||||
$(CONTROLLERS_DIR)/engine_cycle/map_averaging.cpp \
|
||||
$(CONTROLLERS_DIR)/engine_cycle/rpm_calculator.cpp \
|
||||
$(CONTROLLERS_DIR)/engine_cycle/spark_logic.cpp \
|
||||
$(CONTROLLERS_DIR)/engine_cycle/main_trigger_callback.cpp \
|
||||
$(CONTROLLERS_DIR)/engine_cycle/aux_valves.cpp \
|
||||
$(CONTROLLERS_DIR)/flash_main.cpp \
|
||||
$(CONTROLLERS_DIR)/injector_central.cpp \
|
||||
$(CONTROLLERS_DIR)/obd2.cpp \
|
||||
$(CONTROLLERS_DIR)/engine_controller.cpp \
|
||||
$(CONTROLLERS_DIR)/persistent_store.cpp \
|
||||
|
||||
|
||||
CONTROLLERS_INC=\
|
||||
$(CONTROLLERS_DIR) \
|
||||
$(CONTROLLERS_DIR)/scheduling \
|
||||
$(CONTROLLERS_DIR)/system \
|
||||
$(CONTROLLERS_DIR)/system/timer \
|
||||
$(CONTROLLERS_DIR)/algo \
|
||||
$(CONTROLLERS_DIR)/engine_cycle \
|
||||
$(CONTROLLERS_DIR)/trigger/decoders \
|
||||
$(CONTROLLERS_DIR)/trigger \
|
||||
$(CONTROLLERS_DIR)/sensors \
|
||||
$(CONTROLLERS_DIR)/sensors/converters \
|
||||
$(CONTROLLERS_DIR)/core \
|
||||
$(CONTROLLERS_DIR)/gauges \
|
||||
$(CONTROLLERS_DIR)/math \
|
||||
$(CONTROLLERS_DIR)/generated \
|
||||
$(CONTROLLERS_DIR)/actuators \
|
||||
|
|
|
@ -72,17 +72,28 @@
|
|||
board_configuration_s *boardConfiguration = nullptr;
|
||||
|
||||
|
||||
#define INJECT_ENGINE_REFERENCE(x) \
|
||||
x.engine = engine; \
|
||||
x.engineConfiguration = engineConfiguration; \
|
||||
x.config = config; \
|
||||
x.boardConfiguration = boardConfiguration;
|
||||
#define INJECT_ENGINE_REFERENCE(x) \
|
||||
(x)->engine = engine; \
|
||||
(x)->engineConfiguration = engineConfiguration; \
|
||||
(x)->config = config; \
|
||||
(x)->boardConfiguration = boardConfiguration;
|
||||
|
||||
#define EXPAND_Engine \
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \
|
||||
persistent_config_s *config = engine->config; \
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
#ifndef EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
||||
// We store a special changeable copy of configuration is RAM, so we can just compare them
|
||||
#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
|
||||
#else
|
||||
// We cannot call prepareVoidConfiguration() for activeConfiguration if it's stored in flash,
|
||||
// so we need to tell the firmware that it's "void" (i.e. zeroed, invalid) by setting a special flag variable,
|
||||
// and then we consider 'x' as changed if it's just non-zero.
|
||||
extern bool isActiveConfigurationVoid;
|
||||
#define isConfigurationChanged(x) ((engineConfiguration->x != activeConfiguration.x) || (isActiveConfigurationVoid && engineConfiguration->x != 0))
|
||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
||||
|
||||
#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode))
|
||||
|
||||
#endif /* CONTROLLERS_CORE_COMMON_HEADERS_H_ */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
CONTROLLERS_CORE_SRC_CPP = \
|
||||
$(PROJECT_DIR)/controllers/core/efi_wave.cpp \
|
||||
$(PROJECT_DIR)/controllers/core/state_sequence.cpp \
|
||||
$(PROJECT_DIR)/controllers/core/fsio_core.cpp \
|
||||
$(PROJECT_DIR)/controllers/core/fsio_impl.cpp \
|
||||
|
||||
|
|
|
@ -92,7 +92,10 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
|||
static void printToStream(MemoryStream *stream, const char *fmt, va_list ap) {
|
||||
stream->eos = 0; // reset
|
||||
chvprintf((BaseSequentialStream *) stream, fmt, ap);
|
||||
stream->buffer[stream->eos] = 0;
|
||||
|
||||
// Terminate, but don't write past the end of the buffer
|
||||
int terminatorLocation = minI(stream->eos, stream->size - 1);
|
||||
stream->buffer[terminatorLocation] = '\0';
|
||||
}
|
||||
|
||||
static void printWarning(const char *fmt, va_list ap) {
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "allsensors.h"
|
||||
|
||||
#if EFI_FSIO
|
||||
|
||||
#include "os_access.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "settings.h"
|
||||
#include "allsensors.h"
|
||||
#include "rpm_calculator.h"
|
||||
#include "efi_gpio.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
|
@ -102,6 +102,7 @@ static LEElement * acRelayLogic;
|
|||
static LEElement * fuelPumpLogic;
|
||||
static LEElement * radiatorFanLogic;
|
||||
static LEElement * alternatorLogic;
|
||||
static LEElement * starterRelayLogic;
|
||||
|
||||
#if EFI_MAIN_RELAY_CONTROL
|
||||
static LEElement * mainRelayLogic;
|
||||
|
@ -194,7 +195,7 @@ static void setFsioDigitalInputPin(const char *indexStr, const char *pinName) {
|
|||
scheduleMsg(logger, "invalid pin name [%s]", pinName);
|
||||
return;
|
||||
}
|
||||
CONFIGB(fsioDigitalInputs)[index] = pin;
|
||||
CONFIG(fsioDigitalInputs)[index] = pin;
|
||||
scheduleMsg(logger, "FSIO digital input pin #%d [%s]", (index + 1), hwPortname(pin));
|
||||
}
|
||||
|
||||
|
@ -464,6 +465,9 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
enginePins.mainRelay.setValue(true);
|
||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
||||
|
||||
if (CONFIGB(starterRelayPin) != GPIO_UNASSIGNED)
|
||||
setPinState("starter_relay", &enginePins.starterRelay, starterRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
/**
|
||||
* o2 heater is off during cranking
|
||||
* todo: convert to FSIO?
|
||||
|
@ -582,7 +586,7 @@ static void showFsioInfo(void) {
|
|||
}
|
||||
}
|
||||
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
|
||||
brain_pin_e inputPin = CONFIGB(fsioDigitalInputs)[i];
|
||||
brain_pin_e inputPin = CONFIG(fsioDigitalInputs)[i];
|
||||
if (inputPin != GPIO_UNASSIGNED) {
|
||||
scheduleMsg(logger, "FSIO digital input #%d: %s", i, hwPortname(inputPin));
|
||||
}
|
||||
|
@ -673,6 +677,8 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED)
|
||||
mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC);
|
||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
||||
if (CONFIGB(starterRelayPin) != GPIO_UNASSIGNED)
|
||||
starterRelayLogic = sysPool.parseExpression(STARTER_RELAY_LOGIC);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
|
||||
|
@ -691,7 +697,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
|
||||
brain_pin_e inputPin = CONFIGB(fsioDigitalInputs)[i];
|
||||
brain_pin_e inputPin = CONFIG(fsioDigitalInputs)[i];
|
||||
|
||||
if (inputPin != GPIO_UNASSIGNED) {
|
||||
efiSetPadMode("FSIO input", inputPin, getInputMode(engineConfiguration->fsioInputModes[i]));
|
||||
|
@ -724,5 +730,37 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
|
||||
}
|
||||
|
||||
#else /* !EFI_FSIO */
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
// "Limp-mode" implementation for some RAM-limited configs without FSIO
|
||||
void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
// see MAIN_RELAY_LOGIC
|
||||
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) {
|
||||
enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode());
|
||||
}
|
||||
// see STARTER_RELAY_LOGIC
|
||||
if (CONFIGB(starterRelayPin) != GPIO_UNASSIGNED) {
|
||||
enginePins.starterRelay.setValue(engine->rpmCalculator.getRpm() < engineConfiguration->cranking.rpm);
|
||||
}
|
||||
// see FAN_CONTROL_LOGIC
|
||||
if (CONFIGB(fanPin) != GPIO_UNASSIGNED) {
|
||||
enginePins.fanRelay.setValue((enginePins.fanRelay.getLogicValue() && (getCoolantTemperature() > engineConfiguration->fanOffTemperature)) ||
|
||||
(getCoolantTemperature() > engineConfiguration->fanOnTemperature) || engine->isCltBroken);
|
||||
}
|
||||
// see AC_RELAY_LOGIC
|
||||
if (CONFIGB(acRelayPin) != GPIO_UNASSIGNED) {
|
||||
enginePins.acRelay.setValue(getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE) && engine->rpmCalculator.getRpm() > 850);
|
||||
}
|
||||
// see FUEL_PUMP_LOGIC
|
||||
if (CONFIGB(fuelPumpPin) != GPIO_UNASSIGNED) {
|
||||
enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0));
|
||||
}
|
||||
|
||||
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
}
|
||||
|
||||
#endif /* EFI_FSIO */
|
||||
|
|
|
@ -39,6 +39,7 @@ void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGI
|
|||
float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
ValueProvider3D *getFSIOTable(int index);
|
||||
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
/**
|
||||
* @file EfiWave.cpp
|
||||
* @file state_sequence.cpp
|
||||
*
|
||||
* @date May 18, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "efi_wave.h"
|
||||
#include "state_sequence.h"
|
||||
#include "trigger_structure.h"
|
||||
|
||||
SingleWave::SingleWave() {
|
||||
SingleChannelStateSequence::SingleChannelStateSequence() {
|
||||
init(NULL);
|
||||
}
|
||||
|
||||
SingleWave::SingleWave(pin_state_t *ps) {
|
||||
SingleChannelStateSequence::SingleChannelStateSequence(pin_state_t *ps) {
|
||||
init(ps);
|
||||
}
|
||||
|
||||
void SingleWave::init(pin_state_t *pinStates) {
|
||||
void SingleChannelStateSequence::init(pin_state_t *pinStates) {
|
||||
this->pinStates = pinStates;
|
||||
}
|
||||
|
||||
pin_state_t SingleWave::getState(int switchIndex) const {
|
||||
pin_state_t SingleChannelStateSequence::getState(int switchIndex) const {
|
||||
pin_state_t state = pinStates[switchIndex];
|
||||
efiAssert(OBD_PCM_Processor_Fault, state == 0 || state == 1, "wave state get", TV_FALL);
|
||||
return state;
|
||||
}
|
||||
|
||||
void SingleWave::setState(int switchIndex, pin_state_t state) {
|
||||
void SingleChannelStateSequence::setState(int switchIndex, pin_state_t state) {
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, state == 0 || state == 1, "wave state set");
|
||||
pinStates[switchIndex] = state;
|
||||
}
|
||||
|
||||
MultiWave::MultiWave() {
|
||||
MultiChannelStateSequence::MultiChannelStateSequence() {
|
||||
reset();
|
||||
}
|
||||
|
||||
MultiWave::MultiWave(float *switchTimes, SingleWave *waves) : MultiWave() {
|
||||
MultiChannelStateSequence::MultiChannelStateSequence(float *switchTimes, SingleChannelStateSequence *waves) : MultiChannelStateSequence() {
|
||||
init(switchTimes, waves);
|
||||
}
|
||||
|
||||
void MultiWave::init(float *switchTimes, SingleWave *channels) {
|
||||
void MultiChannelStateSequence::init(float *switchTimes, SingleChannelStateSequence *channels) {
|
||||
this->switchTimes = switchTimes;
|
||||
this->channels = channels;
|
||||
}
|
||||
|
||||
void MultiWave::reset(void) {
|
||||
void MultiChannelStateSequence::reset(void) {
|
||||
waveCount = 0;
|
||||
}
|
||||
|
||||
float MultiWave::getSwitchTime(const int index) const {
|
||||
float MultiChannelStateSequence::getSwitchTime(const int index) const {
|
||||
return switchTimes[index];
|
||||
}
|
||||
|
||||
void MultiWave::checkSwitchTimes(const int size) {
|
||||
void MultiChannelStateSequence::checkSwitchTimes(const int size) {
|
||||
if (switchTimes[size - 1] != 1) {
|
||||
firmwareError(CUSTOM_ERR_WAVE_1, "last switch time has to be 1 not %.2f", switchTimes[size - 1]);
|
||||
return;
|
||||
|
@ -65,7 +65,7 @@ void MultiWave::checkSwitchTimes(const int size) {
|
|||
}
|
||||
}
|
||||
|
||||
pin_state_t MultiWave::getChannelState(const int channelIndex, const int phaseIndex) const {
|
||||
pin_state_t MultiChannelStateSequence::getChannelState(const int channelIndex, const int phaseIndex) const {
|
||||
if (channelIndex >= waveCount) {
|
||||
// todo: would be nice to get this asserting working
|
||||
//firmwareError(OBD_PCM_Processor_Fault, "channel index %d/%d", channelIndex, waveCount);
|
||||
|
@ -76,7 +76,7 @@ pin_state_t MultiWave::getChannelState(const int channelIndex, const int phaseIn
|
|||
/**
|
||||
* returns the index at which given value would need to be inserted into sorted array
|
||||
*/
|
||||
int MultiWave::findInsertionAngle(const float angle, const int size) const {
|
||||
int MultiChannelStateSequence::findInsertionAngle(const float angle, const int size) const {
|
||||
for (int i = size - 1; i >= 0; i--) {
|
||||
if (angle > switchTimes[i])
|
||||
return i + 1;
|
||||
|
@ -84,7 +84,7 @@ int MultiWave::findInsertionAngle(const float angle, const int size) const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int MultiWave::findAngleMatch(const float angle, const int size) const {
|
||||
int MultiChannelStateSequence::findAngleMatch(const float angle, const int size) const {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (isSameF(switchTimes[i], angle))
|
||||
return i;
|
||||
|
@ -92,7 +92,7 @@ int MultiWave::findAngleMatch(const float angle, const int size) const {
|
|||
return EFI_ERROR_CODE;
|
||||
}
|
||||
|
||||
void MultiWave::setSwitchTime(const int index, const float value) {
|
||||
void MultiChannelStateSequence::setSwitchTime(const int index, const float value) {
|
||||
efiAssertVoid(CUSTOM_ERR_PWM_SWITCH_ASSERT, switchTimes != NULL, "switchTimes");
|
||||
switchTimes[index] = value;
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* @file efi_wave.h
|
||||
* @file state_sequence.h
|
||||
*
|
||||
* @date May 18, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
#ifndef EFI_WAVE_H_
|
||||
#define EFI_WAVE_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
|
||||
|
@ -36,13 +36,14 @@ typedef trigger_value_e pin_state_t;
|
|||
* is not implemented using a bit array, it could absolutely be a bit array
|
||||
*
|
||||
* This sequence does not know anything about signal lengths - only signal state at a given index
|
||||
* This sequence can have consecutive zeros and ones since these sequences work as a group within MultiChannelStateSequence
|
||||
*
|
||||
* @brief PWM configuration for the specific output pin
|
||||
*/
|
||||
class SingleWave {
|
||||
class SingleChannelStateSequence {
|
||||
public:
|
||||
SingleWave();
|
||||
explicit SingleWave(pin_state_t *pinStates);
|
||||
SingleChannelStateSequence();
|
||||
explicit SingleChannelStateSequence(pin_state_t *pinStates);
|
||||
void init(pin_state_t *pinStates);
|
||||
/**
|
||||
* todo: confirm that we only deal with two states here, no magic '-1'?
|
||||
|
@ -59,11 +60,11 @@ public:
|
|||
* This class represents multi-channel logical signals with shared time axis
|
||||
*
|
||||
*/
|
||||
class MultiWave {
|
||||
class MultiChannelStateSequence {
|
||||
public:
|
||||
MultiWave();
|
||||
MultiWave(float *switchTimes, SingleWave *waves);
|
||||
void init(float *switchTimes, SingleWave *waves);
|
||||
MultiChannelStateSequence();
|
||||
MultiChannelStateSequence(float *switchTimes, SingleChannelStateSequence *waves);
|
||||
void init(float *switchTimes, SingleChannelStateSequence *waves);
|
||||
void reset(void);
|
||||
float getSwitchTime(const int phaseIndex) const;
|
||||
void setSwitchTime(const int phaseIndex, const float value);
|
||||
|
@ -77,7 +78,7 @@ public:
|
|||
* Number of signal channels
|
||||
*/
|
||||
int waveCount;
|
||||
SingleWave *channels = nullptr;
|
||||
SingleChannelStateSequence *channels = nullptr;
|
||||
//private:
|
||||
/**
|
||||
* values in the (0..1] range which refer to points within the period at at which pin state should be changed
|
||||
|
@ -86,4 +87,4 @@ public:
|
|||
float *switchTimes = nullptr;
|
||||
};
|
||||
|
||||
#endif /* EFI_WAVE_H_ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue