Mre sw knock detection (#1815)

* Add SW knock control to MRE on AT4

* Update software_knock.cpp

cleanup

* use knock only for final build

* adjust RAM

* Update engine_controller.cpp

Adjust RAM for HW QC special to build
This commit is contained in:
shadowm60 2020-09-22 10:48:17 +03:00 committed by GitHub
parent 900842da16
commit a70e24bf6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 4 deletions

View File

@ -10,6 +10,7 @@ ifeq ($(PROJECT_CPU),ARCH_STM32F4)
BOARDINC = $(BOARDS_DIR)/microrusefi
BOARDINC += $(PROJECT_DIR)/config/stm32f4ems # For board.h
BOARDINC += $(BOARDS_DIR)/st_stm32f4
BOARDINC += $(BOARDS_DIR)/microrusefi # For knock_config.h
LDSCRIPT= $(BOARDS_DIR)/prometheus/STM32F405xG.ld
else
MCU_DEFS = -DSTM32F767xx
@ -17,6 +18,7 @@ else
CONFDIR=config/stm32f7ems
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
BOARDINC += $(BOARDS_DIR)/microrusefi # For knock_config.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld
endif
@ -36,5 +38,5 @@ EFI_CONSOLE_TTL_PINS = -DEFI_CONSOLE_TX_BRAIN_PIN=GPIOB_10 -DEFI_CONSOLE_RX_BRAI
# Add them all together
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEFI\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(EFI_CONSOLE_TTL_PINS)
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEFI\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(EFI_CONSOLE_TTL_PINS) -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE

View File

@ -4,7 +4,7 @@ cd ../../..
export PROJECT_BOARD=microrusefi
export PROJECT_CPU=ARCH_STM32F7
export EXTRA_PARAMS=-DSHORT_BOARD_NAME=mre_f7
export EXTRA_PARAMS="-DSHORT_BOARD_NAME=mre_f7"
export LDSCRIPT="config/boards/NUCLEO_F767/STM32F76xxI.ld"

View File

@ -0,0 +1,20 @@
#pragma once
// Knock is on ADC3
#define KNOCK_ADC ADCD3
// knock 1 - pin PA3
#define KNOCK_ADC_CH1 ADC_CHANNEL_IN3
#define KNOCK_PIN_CH1 GPIOA_3
// knock 2 - pin PF5 NOT used! - not used for MRE
#define KNOCK_ADC_CH2 ADC_CHANNEL_IN15
#define KNOCK_PIN_CH2 GPIOF_5
// Sample rate & time - depends on the exact MCU
#define KNOCK_SAMPLE_TIME ADC_SAMPLE_84
#define KNOCK_SAMPLE_RATE (STM32_PCLK2 / (4 * (84 + 12)))
#ifndef MRE_SW_KNOCK_ADC
#define MRE_SW_KNOCK_ADC
#endif

View File

@ -17,6 +17,7 @@
#define ts_show_main_relay false
#define ts_show_main_relay_microRusEFI_message true
#define ts_show_can2 false
#define ts_show_software_knock true
#define show_test_presets false
#define show_Frankenso_presets false

View File

@ -710,7 +710,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
* UNUSED_SIZE constants.
*/
#ifndef RAM_UNUSED_SIZE
#define RAM_UNUSED_SIZE 7500
#define RAM_UNUSED_SIZE 3300
#endif
#ifndef CCM_UNUSED_SIZE
#define CCM_UNUSED_SIZE 2900

View File

@ -41,7 +41,11 @@ static void errorCallback(ADCDriver*, adcerror_t err) {
static const ADCConversionGroup adcConvGroupCh1 = { FALSE, 1, &completionCallback, &errorCallback,
0,
ADC_CR2_SWSTART,
#ifdef MRE_SW_KNOCK_ADC
ADC_SMPR2_SMP_AN3(KNOCK_SAMPLE_TIME), // sample times for channels 10...18
#else
ADC_SMPR1_SMP_AN14(KNOCK_SAMPLE_TIME), // sample times for channels 10...18
#endif
0,
0, // htr
@ -149,8 +153,9 @@ void initSoftwareKnock() {
adcStart(&KNOCK_ADC, nullptr);
efiSetPadMode("knock ch1", KNOCK_PIN_CH1, PAL_MODE_INPUT_ANALOG);
#if KNOCK_HAS_CH2
efiSetPadMode("knock ch2", KNOCK_PIN_CH2, PAL_MODE_INPUT_ANALOG);
#endif
kt.Start();
}
}

View File

@ -2771,6 +2771,7 @@ menuDialog = main
subMenu = mc33Dialog, "GDI Dreams"
subMenu = std_separator
subMenu = softwareKnock, "Software Knock"
subMenu = std_separator
subMenu = etbDialog, "Electronic throttle body (beta version)"