Merge branch 'master' into master_jared

This commit is contained in:
rusefi 2020-04-26 19:56:07 -04:00
commit 32c5cca2e2
507 changed files with 14056 additions and 10273 deletions

4
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,4 @@
Thank you for taking the time to report an issue!
To make our work easier, please provide as many details as you can:
* [ ] What hardware did you use while experiencing the issue?

2
.gitignore vendored
View File

@ -17,3 +17,5 @@ java_console_binary
.vscode
*.cmp
*.net
err.txt
log.txt

28
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/unit_tests/build/rusefi_test",
// uncomment args below to only debug a particular test
//"args": ["--gtest_filter=etb.testTargetTpsIsFloatBug945"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/unit_tests/build/",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

32
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,32 @@
{
"files.associations": {
"xstring": "cpp",
"ios": "cpp",
"xlocale": "cpp",
"xtr1common": "cpp",
"xiosbase": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"system_error": "cpp",
"vector": "cpp",
"xhash": "cpp",
"xtree": "cpp"
},
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"files.exclude": {
"**/.dep": true,
"**/build/lst": true,
"**/build/obj": true,
"hardware/": true,
"misc/": true,
},
"search.exclude": {
"**/.dep": true,
"**/build/lst": true,
"**/build/obj": true,
"hardware/": true,
"misc/": true,
},
}

View File

@ -44,6 +44,10 @@ See https://rusefi.com/forum/viewtopic.php?f=5&t=9
| Release date | Revision | Details |
| ------------ | --------- | ------- |
| 04/18/2020 | r22231 | Renix 44-2-2 trigger support added |
| 04/02/2020 | | Start button feature |
| 03/28/2020 | | Critical error text is now displayed in TunerStudio |
| 03/26/2020 | | Multi-spark feature |
| 09/05/2019 | r19849 | Electronic Throttle Body including idle control seems to work |
| 07/28/2019 | r19612 | improvement #809: software jump to DFU |
| 04/25/2019 | r17317 | bugfix #775: electrical noise reboot during settings change causes with full tune loss |

View File

@ -1,14 +0,0 @@
{
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"files.exclude": {
".dep": true,
"build/lst": true,
"build/obj": true,
},
"search.exclude": {
".dep": true,
"build/lst": true,
"build/obj": true,
},
}

@ -1 +1 @@
Subproject commit 85cf4582a9f6a57cc49759c606af5fda2f52d106
Subproject commit 1a2c5967dc813bdbf1cc7eabfea8377340c8a29e

View File

@ -80,12 +80,6 @@ ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = no
endif
ifeq ($(USE_BOOTLOADER),)
USE_BOOTLOADER = no
endif
@ -133,6 +127,20 @@ MAKEFLAGS += ${NUMJOBS}
# Project, sources and paths
#
BOARDS_DIR = $(PROJECT_DIR)/config/boards
include $(PROJECT_DIR)/config/boards/$(PROJECT_BOARD)/board.mk
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
# without USE_SMART_BUILD all ChibiOS (including all drivers) are builded. And all drivers includes get included.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif
ifeq ($(CONFDIR),)
CONFDIR = $(PROJECT_DIR)/config/stm32f4ems
endif
# Startup files.
include $(CPU_STARTUP_DIR)
# HAL-OSAL files (optional).
@ -153,9 +161,6 @@ ifeq ($(USE_FATFS),yes)
include $(PROJECT_DIR)/ext/fatfs.mk
endif
BOARDS_DIR = $(PROJECT_DIR)/config/boards
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/controllers.mk
@ -172,7 +177,6 @@ ifeq ($(BOOTLOADERINC),)
BOOTLOADERINC= $(PROJECT_DIR)/bootloader/
endif
ifeq ($(USE_BOOTLOADER),yes)
include $(PROJECT_DIR)/bootloader/bootloader.mk
endif
@ -189,7 +193,9 @@ CSRC = $(STARTUPSRC) \
$(PORTSRC) \
$(OSALSRC) \
$(HALSRC) \
$(HALSRC_CONTRIB) \
$(PLATFORMSRC) \
$(PLATFORMSRC_CONTRIB) \
$(BOARDSRC) \
$(BOOTLOADERSRC) \
$(CHIBIOS)/os/ex/ST/lis302dl.c \
@ -275,6 +281,7 @@ INCDIR = $(CHIBIOS)/os/license \
$(HALINC) \
$(HALINC_CONTRIB) \
$(PLATFORMINC) \
$(PLATFORMINC_CONTRIB) \
$(BOARDINC) \
$(BOOTLOADERINC) \
$(CHCPPINC) \

View File

@ -1,5 +1,4 @@
#ifndef BOOTLOADER_H_
#define BOOTLOADER_H_
#pragma once
#ifdef __cplusplus
extern "C" {
@ -13,5 +12,3 @@ int initBootloader(void);
#ifdef __cplusplus
}
#endif
#endif /* BOOTLOADER_H_ */

View File

@ -12,8 +12,14 @@ ifeq ($(DEBUG_LEVEL_OPT),)
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
ifeq ($(CONFDIR),)
CONFDIR = $(PROJECT_DIR)/config/stm32f4ems
endif
# disable some modules to shrink bootloader binary
DDEFS += -DHAL_USE_ADC=FALSE -DHAL_USE_CAN=FALSE -DHAL_USE_EXT=FALSE -DHAL_USE_GPT=FALSE -DHAL_USE_I2C=FALSE -DHAL_USE_ICU=FALSE -DHAL_USE_PWM=FALSE -DHAL_USE_RTC=FALSE -DHAL_USE_I2C=FALSE
#disable ChibiOS flsah driver and prevent header from include
DDEFS += -DHAL_USE_FLASH=FALSE
# disable USB (The bootloader has currently UART support only)
DDEFS += -DEFI_USB_SERIAL=FALSE -DHAL_USE_SERIAL_USB=FALSE -DHAL_USE_USB=FALSE -DHAL_USE_USB_MSD=FALSE
@ -71,7 +77,7 @@ endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = no
USE_SMART_BUILD = yes
endif
#

View File

@ -2,7 +2,7 @@
#include "hardware.h"
#include "efi_gpio.h"
#include "flash.h"
#include "flash_int.h"
#include "dfu.h"
@ -165,7 +165,7 @@ static void dfuHandleRead(void) {
if (isInVirtualPageBuffer(addr))
memcpy(buffer, (uint8_t *)addr, numBytes);
else
flashRead(addr, (char *)buffer, numBytes);
intFlashRead(addr, (char *)buffer, numBytes);
// transmit data
sr5WriteData(&blTsChannel, (uint8_t *)buffer, numBytes);
@ -197,7 +197,7 @@ static void dfuHandleWrite(void) {
if (isInVirtualPageBuffer(addr))
memcpy((uint8_t *)addr, (buffer + 1), numBytes);
else
flashWrite(addr, (const char *)(buffer + 1), numBytes);
intFlashWrite(addr, (const char *)(buffer + 1), numBytes);
// we're done!
sendByte(DFU_ACK_BYTE);
@ -233,7 +233,7 @@ static void dfuHandleErase(void) {
continue;
}
// erase sector
flashSectorErase(sectorIdx);
intFlashSectorErase(sectorIdx);
}
sendByte(DFU_ACK_BYTE);

View File

@ -1,5 +1,4 @@
#ifndef DFU_H_
#define DFU_H_
#pragma once
#include "tunerstudio_io.h"
@ -51,5 +50,3 @@ void dfuJumpToApp(uint32_t addr);
ts_channel_s *getTsChannel();
#endif /* DFU_H_ */

View File

@ -9,8 +9,6 @@
* The whole idea of bootloader is to make it as small as possible. And reasonably independent.
*/
int maxNesting = 0;
void chDbgPanic3(const char */*msg*/, const char * /*file*/, int /*line*/) {
}

View File

@ -10,4 +10,4 @@ set EFI_FATAL_ERROR_PIN=
set BUILDDIR=
set DEBUG_LEVEL_OPT=
set USE_FATFS=
set USE_SMART_BUILD=

View File

@ -7,6 +7,7 @@ set EXTRA_PARAMS=-DDUMMY -DCPU_MKE16F512VLH16 -DCPU_MKE16F512VLH16_cm4 -D__USE_C
rem set BUILDDIR=build_kinetis
set BUILDDIR=build
set PROJECT_BOARD=kinetis
set USE_SMART_BUILD=yes
set PROJECT_CPU=kinetis
set DEBUG_LEVEL_OPT="-O2"
set USE_FATFS=no

View File

@ -55,7 +55,7 @@
* @note The default is @p TRUE.
*/
#if !defined(KINETIS_GPT_USE_PIT1) || defined(__DOXYGEN__)
#define KINETIS_GPT_USE_PIT1 FALSE
#define KINETIS_GPT_USE_PIT1 TRUE
#endif
/**

View File

@ -14,10 +14,4 @@ BOARDSRC_CPP += $(CONTROLLERS_ALGO_AUTO_GENERATED_ENUMS)
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/MKE1xF512.ld
PLATFORMSRC += $(PLATFORMSRC_CONTRIB)
PLATFORMINC += $(PLATFORMINC_CONTRIB)
# Using external ChibiOS-Contrib code for Comparator HAL
HALSRC += $(CHIBIOS_CONTRIB)/os/hal/src/hal_comp.c
CONFDIR = $(BOARD_DIR)

View File

@ -807,9 +807,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
* so that it would not crash the error handler in case of stack issues
*/
#if CH_DBG_SYSTEM_STATE_CHECK
#define hasFatalError() (ch.dbg.panic_msg != NULL)
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
#else
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#endif

View File

@ -25,6 +25,7 @@ java ^
-jar ../java_tools/ConfigDefinition.jar ^
-definition integration/rusefi_config.txt ^
-ts_destination tunerstudio ^
-tool kineris_gen_config.bat ^
-with_c_defines false ^
-initialize_to_zero false ^
-ts_output_name rusefi_kinetis.ini ^

View File

@ -341,21 +341,11 @@ case TLE6240_PIN_9:
}
return NULL;
}
const char *getCan_device_mode_e(can_device_mode_e value){
switch(value) {
case CD_OFF:
return "CD_OFF";
case CD_USE_CAN1:
return "CD_USE_CAN1";
case CD_USE_CAN2:
return "CD_USE_CAN2";
case Internal_ForceMyEnumIntSize_can_device_mode:
return "Internal_ForceMyEnumIntSize_can_device_mode";
}
return NULL;
}
const char *getCan_nbc_e(can_nbc_e value){
switch(value) {
case CAN_BUS_NBC_NONE:
return "CAN_BUS_NBC_NONE";
case CAN_BUS_MAZDA_RX8:
return "CAN_BUS_MAZDA_RX8";
case CAN_BUS_NBC_BMW:
@ -364,6 +354,8 @@ case CAN_BUS_NBC_FIAT:
return "CAN_BUS_NBC_FIAT";
case CAN_BUS_NBC_VAG:
return "CAN_BUS_NBC_VAG";
case CAN_BUS_W202_C180:
return "CAN_BUS_W202_C180";
case Internal_ForceMyEnumIntSize_can_nbc:
return "Internal_ForceMyEnumIntSize_can_nbc";
}
@ -399,8 +391,14 @@ case DBG_2:
return "DBG_2";
case DBG_BOOST:
return "DBG_BOOST";
case DBG_37:
return "DBG_37";
case DBG_START_STOP:
return "DBG_START_STOP";
case DBG_LAUNCH:
return "DBG_LAUNCH";
case DBG_ETB_AUTOTUNE:
return "DBG_ETB_AUTOTUNE";
case DBG_40:
return "DBG_40";
case DBG_ALTERNATOR_PID:
return "DBG_ALTERNATOR_PID";
case DBG_ANALOG_INPUTS:
@ -409,8 +407,8 @@ case DBG_ANALOG_INPUTS2:
return "DBG_ANALOG_INPUTS2";
case DBG_AUX_PID_1:
return "DBG_AUX_PID_1";
case DBG_AUX_TEMPERATURE:
return "DBG_AUX_TEMPERATURE";
case DBG_34:
return "DBG_34";
case DBG_AUX_VALVES:
return "DBG_AUX_VALVES";
case DBG_BENCH_TEST:
@ -465,8 +463,8 @@ case DBG_TPS_ACCEL:
return "DBG_TPS_ACCEL";
case DBG_TRIGGER_COUNTERS:
return "DBG_TRIGGER_COUNTERS";
case DBG_TRIGGER_SYNC:
return "DBG_TRIGGER_SYNC";
case DBG_16:
return "DBG_16";
case DBG_VEHICLE_SPEED_SENSOR:
return "DBG_VEHICLE_SPEED_SENSOR";
case DBG_VVT:
@ -611,6 +609,8 @@ case BMW_M73_PROTEUS:
return "BMW_M73_P";
case BMW_M73_MRE:
return "BMW_M73_MRE";
case BMW_M73_MRE_SLAVE:
return "BMW_M73_MRE_SLAVE";
case MIATA_1996:
return "MIATA_1996";
case MIATA_NA6_MAP:
@ -815,6 +815,8 @@ case FOUR_STROKE_CAM_SENSOR:
return "FOUR_STROKE_CAM_SENSOR";
case FOUR_STROKE_CRANK_SENSOR:
return "FOUR_STROKE_CRANK_SENSOR";
case FOUR_STROKE_THREE_TIMES_CRANK_SENSOR:
return "FOUR_STROKE_THREE_TIMES_CRANK_SENSOR";
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
return "FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR";
case Force_4_bytes_size_operation_mode_e:
@ -1011,6 +1013,14 @@ case TT_MAZDA_MIATA_VVT_TEST:
return "TT_MAZDA_MIATA_VVT_TEST";
case TT_MAZDA_SOHC_4:
return "TT_MAZDA_SOHC_4";
case TT_RENIX_66_2_2_2:
return "TT_RENIX_66_2_2_2";
case TT_BOSCH_QUICK_START:
return "TT_BOSCH_QUICK_START";
case TT_HONDA_K_12_1:
return "TT_HONDA_K_12_1";
case TT_RENIX_44_2_2:
return "TT_RENIX_44_2_2";
case TT_MIATA_NB2_VVT_CAM:
return "TT_MIATA_NB2_VVT_CAM";
case TT_MAZDA_Z5:

View File

@ -16,7 +16,6 @@ const char *getAdc_channel_e(adc_channel_e value);
const char *getAdc_channel_mode_e(adc_channel_mode_e value);
const char *getAir_pressure_sensor_type_e(air_pressure_sensor_type_e value);
const char *getBrain_pin_e(brain_pin_e value);
const char *getCan_device_mode_e(can_device_mode_e value);
const char *getCan_nbc_e(can_nbc_e value);
const char *getChamber_style_e(chamber_style_e value);
const char *getCranking_ignition_mode_e(cranking_ignition_mode_e value);

View File

@ -1,9 +1,79 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Fri Mar 20 19:55:09 EDT 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Sun Apr 26 14:18:05 EDT 2020
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
#define CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
#include "rusefi_types.h"
// start of stft_cell_cfg_s
struct stft_cell_cfg_s {
/**
* offset 0
*/
int8_t maxAdd;
/**
* offset 1
*/
int8_t maxRemove;
/**
* offset 2
*/
uint16_t timeConstant;
/** total size 4*/
};
typedef struct stft_cell_cfg_s stft_cell_cfg_s;
// start of stft_s
struct stft_s {
/**
* Below this RPM, the idle region is active
* offset 0
*/
uint8_t maxIdleRegionRpm;
/**
* Below this engine load, the overrun region is active
* offset 1
*/
uint8_t maxOverrunLoad;
/**
* Above this engine load, the power region is active
* offset 2
*/
uint8_t minPowerLoad;
/**
* When close to correct AFR, pause correction. This can improve stability by not changing the adjustment if the error is extremely small, but is not required.
* offset 3
*/
uint8_t deadband;
/**
* Below this temperature, correction is disabled.
* offset 4
*/
int8_t minClt;
/**
* Below this AFR, correction is paused
* offset 5
*/
uint8_t minAfr;
/**
* Above this AFR, correction is paused
* offset 6
*/
uint8_t maxAfr;
/**
* Delay after starting the engine before beginning closed loop correction.
* offset 7
*/
uint8_t startupDelay;
/**
* offset 8
*/
stft_cell_cfg_s cellCfgs[STFT_CELL_COUNT];
/** total size 24*/
};
typedef struct stft_s stft_s;
// start of pid_s
struct pid_s {
/**
@ -90,6 +160,61 @@ struct spi_pins {
typedef struct spi_pins spi_pins;
// start of gppwm_channel
struct gppwm_channel {
/**
* Select a pin to use for PWM or on-off output.
* offset 0
*/
output_pin_e pin;
/**
* If an error (with a sensor, etc) is detected, this value is used instead of reading from the table.
* This should be a safe value for whatever hardware is connected to prevent damage.
* offset 1
*/
uint8_t dutyIfError;
/**
* Select a frequency to run PWM at.
* Set this to 0hz to enable on-off mode.
* offset 2
*/
uint16_t pwmFrequency;
/**
* In on-off mode, turn the output on when the table value is above this duty.
* offset 4
*/
uint8_t onAboveDuty;
/**
* In on-off mode, turn the output off when the table value is below this duty.
* offset 5
*/
uint8_t offBelowDuty;
/**
* Selects the load axis to use for the table.
* offset 6
*/
gppwm_channel_e loadAxis;
/**
* offset 7
*/
uint8_t pad;
/**
* offset 8
*/
uint8_t loadBins[GPPWM_LOAD_COUNT];
/**
* offset 16
*/
uint8_t rpmBins[GPPWM_RPM_COUNT];
/**
* offset 24
*/
gppwm_table_t table;
/** total size 88*/
};
typedef struct gppwm_channel gppwm_channel;
// start of air_pressure_sensor_config_s
struct air_pressure_sensor_config_s {
/**
@ -278,33 +403,6 @@ struct injector_s {
typedef struct injector_s injector_s;
// start of bi_quard_s
struct bi_quard_s {
/**
* offset 0
*/
float a0;
/**
* offset 4
*/
float a1;
/**
* offset 8
*/
float a2;
/**
* offset 12
*/
float b1;
/**
* offset 16
*/
float b2;
/** total size 20*/
};
typedef struct bi_quard_s bi_quard_s;
// start of specs_s
struct specs_s {
/**
@ -339,10 +437,10 @@ struct trigger_config_s {
trigger_type_e type;
/**
offset 4 bit 0 */
bool unusedTriggerBit0 : 1;
bool todoRemoveMeOneDay0 : 1;
/**
offset 4 bit 1 */
bool unusedTriggerBit1 : 1;
bool todoRemoveMeOneDay1 : 1;
/**
* This option could be used if your second trigger channel is broken
offset 4 bit 2 */
@ -522,7 +620,7 @@ struct etb_io {
/**
* offset 3
*/
pin_output_mode_e controlPinMode;
brain_pin_e disablePin;
/** total size 4*/
};
@ -547,11 +645,8 @@ struct engine_configuration_s {
*/
injector_s injector;
/**
* Should trigger emulator push data right into trigger handling logic, eliminating the need for physical jumper wires?
* See also triggerSimulatorPins
* PS: Funny name, right? :)
offset 76 bit 0 */
bool directSelfStimulation : 1;
bool unused76b0 : 1;
/**
offset 76 bit 1 */
bool activateAuxPid1 : 1;
@ -577,8 +672,9 @@ struct engine_configuration_s {
offset 76 bit 8 */
bool isVerboseAuxPid4 : 1;
/**
* enable cj125verbose/disable cj125verbose
offset 76 bit 9 */
bool useBiQuadAnalogFiltering : 1;
bool isCJ125Verbose : 1;
/**
* Is your UA CJ125 output wired to MCU via resistor divider?
offset 76 bit 10 */
@ -587,6 +683,7 @@ struct engine_configuration_s {
offset 76 bit 11 */
bool cj125isLsu49 : 1;
/**
* TLE7209 uses two-wire mode. TLE9201 and VNH2SP30 do NOT use two wire mode.
offset 76 bit 12 */
bool etb_use_two_wires : 1;
/**
@ -602,7 +699,7 @@ struct engine_configuration_s {
bool cj125isUrDivided : 1;
/**
offset 76 bit 16 */
bool useTLE8888_hall_mode : 1;
bool issue_294_unused : 1;
/**
offset 76 bit 17 */
bool useTLE8888_cranking_hack : 1;
@ -627,7 +724,7 @@ struct engine_configuration_s {
bool useRunningMathForCranking : 1;
/**
offset 76 bit 24 */
bool issue_294_25 : 1;
bool displayLogicLevelsInEngineSniffer : 1;
/**
offset 76 bit 25 */
bool issue_294_26 : 1;
@ -898,6 +995,7 @@ struct engine_configuration_s {
adc_channel_e fuelLevelSensor;
/**
* Second throttle body position sensor, single channel so far
* set_analog_input_pin tps2 X
* offset 515
*/
adc_channel_e tps2_1AdcChannel;
@ -959,6 +1057,7 @@ struct engine_configuration_s {
* Electronic throttle pedal position input
* First channel
* See also tps1_1AdcChannel
* set_analog_input_pin pps X
* offset 580
*/
adc_channel_e throttlePedalPositionAdcChannel;
@ -1103,10 +1202,12 @@ struct engine_configuration_s {
*/
pin_output_mode_e electronicThrottlePin1Mode;
/**
* set_cj125_heater_pin XXX
* offset 673
*/
brain_pin_e wboHeaterPin;
/**
* set_cj125_cs_pin XXX
* offset 674
*/
brain_pin_e cj125CsPin;
@ -1196,10 +1297,12 @@ struct engine_configuration_s {
*/
brain_pin_e sdCardCsPin;
/**
* set_can_tx_pin X
* offset 708
*/
brain_pin_e canTxPin;
/**
* set_can_rx_pin X
* offset 709
*/
brain_pin_e canRxPin;
@ -1210,7 +1313,7 @@ struct engine_configuration_s {
/**
* offset 711
*/
brain_pin_e debugTimerCallback;
uint8_t unused711;
/**
* offset 712
*/
@ -1234,7 +1337,7 @@ struct engine_configuration_s {
/**
* offset 732
*/
can_device_mode_e canDeviceMode;
int anUnused4Bytes;
/**
* Each rusEfi piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEfi board.
* See also directSelfStimulation which is different.
@ -1298,6 +1401,7 @@ struct engine_configuration_s {
offset 744 bit 13 */
bool verboseTLE8888 : 1;
/**
* enable can_broadcast/disable can_broadcast
offset 744 bit 14 */
bool enableVerboseCanTx : 1;
/**
@ -1305,6 +1409,7 @@ struct engine_configuration_s {
offset 744 bit 15 */
bool onOffAlternatorLogic : 1;
/**
* enable cj125/disable cj125
offset 744 bit 16 */
bool isCJ125Enabled : 1;
/**
@ -1386,7 +1491,11 @@ struct engine_configuration_s {
/**
* offset 760
*/
int unrealisticRpmThreashold;
uint8_t mc33_hvolt;
/**
* offset 761
*/
uint8_t unusedHere[3];
/**
* offset 764
*/
@ -1408,7 +1517,7 @@ struct engine_configuration_s {
/**
* offset 806
*/
brain_pin_e debugSetTimer;
uint8_t unused806;
/**
* offset 807
*/
@ -1445,15 +1554,18 @@ struct engine_configuration_s {
*/
int16_t stepperParkingExtraSteps;
/**
* This magic property is specific to Mazda Miata NB2
* offset 820
*/
float unusedmiataNb2VVTRatioFrom;
float unusedAntilagTimeout;
/**
* This magic property is specific to Mazda Miata NB2
* offset 824
*/
float unusedmiataNb2VVTRatioTo;
int16_t antiLagRpmTreshold;
/**
* Maximum time to crank starter
* offset 826
*/
int16_t startCrankingDuration;
/**
* This pin is used for debugging - snap a logic analyzer on it and see if it's ever high
* offset 828
@ -1603,22 +1715,22 @@ struct engine_configuration_s {
bool multisparkEnable : 1;
/**
offset 976 bit 4 */
bool unusedBit_251_4 : 1;
bool enableLaunchRetard : 1;
/**
offset 976 bit 5 */
bool unusedBit_251_5 : 1;
bool enableLaunchBoost : 1;
/**
offset 976 bit 6 */
bool unusedBit_251_6 : 1;
bool launchDisableBySpeed : 1;
/**
offset 976 bit 7 */
bool unusedBit_251_7 : 1;
bool enableCanVss : 1;
/**
offset 976 bit 8 */
bool unusedBit_251_8 : 1;
bool enableInnovateLC2 : 1;
/**
offset 976 bit 9 */
bool unusedBit_251_9 : 1;
bool showHumanReadableWarning : 1;
/**
offset 976 bit 10 */
bool unusedBit_251_10 : 1;
@ -1681,10 +1793,10 @@ struct engine_configuration_s {
bool unusedBit_251_29 : 1;
/**
offset 976 bit 30 */
bool unusedBit_280_30 : 1;
bool unusedBit_282_30 : 1;
/**
offset 976 bit 31 */
bool unusedBit_280_31 : 1;
bool unusedBit_282_31 : 1;
/**
* offset 980
*/
@ -1758,7 +1870,23 @@ struct engine_configuration_s {
/**
* offset 1052
*/
int unusedAtOldBoardConfigurationEnd[103];
int launchAdvanceRpmRange;
/**
* offset 1056
*/
int launchTpsTreshold;
/**
* offset 1060
*/
float launchActivateDelay;
/**
* offset 1064
*/
stft_s stft;
/**
* offset 1088
*/
int unusedAtOldBoardConfigurationEnd[94];
/**
offset 1464 bit 0 */
bool vvtDisplayInverted : 1;
@ -1790,9 +1918,11 @@ struct engine_configuration_s {
offset 1464 bit 7 */
bool useLinearCltSensor : 1;
/**
* enable can_read/disable can_read
offset 1464 bit 8 */
bool canReadEnabled : 1;
/**
* enable can_write/disable can_write
offset 1464 bit 9 */
bool canWriteEnabled : 1;
/**
@ -2147,7 +2277,7 @@ struct engine_configuration_s {
*/
int16_t tps2Max;
/**
* See also startStopButton
* See also startStopButtonPin
* offset 1772
*/
output_pin_e starterControlPin;
@ -2158,7 +2288,7 @@ struct engine_configuration_s {
/**
* offset 1774
*/
uint8_t unusedFormerWarmupAfrPid;
brain_pin_e mc33816_flag0;
/**
* offset 1775
*/
@ -2291,17 +2421,19 @@ struct engine_configuration_s {
*/
int16_t iacByTpsTaper;
/**
* set_aux_tx_pin X
* offset 2040
*/
brain_pin_e unusedErrorPin;
brain_pin_e auxSerialTxPin;
/**
* offset 2041
*/
brain_pin_e warningLedPin;
/**
* set_aux_rx_pin X
* offset 2042
*/
brain_pin_e unused1234234;
brain_pin_e auxSerialRxPin;
/**
* offset 2043
*/
@ -2369,7 +2501,11 @@ struct engine_configuration_s {
/**
* offset 2096
*/
uint32_t unused_former_warmup_target_afr[9];
uint32_t auxSerialSpeed;
/**
* offset 2100
*/
uint32_t unused_former_warmup_target_afr[8];
/**
* kPa value at which we need to cut fuel and spark, 0 if not enabled
* offset 2132
@ -2479,7 +2615,7 @@ struct engine_configuration_s {
/**
* offset 2332
*/
bi_quard_s biQuad;
uint8_t unusedOldBiquad[20];
/**
* CLT-based timing correction
* offset 2352
@ -2492,7 +2628,11 @@ struct engine_configuration_s {
/**
* offset 2416
*/
int nbVvtIndex;
tle8888_mode_e tle8888mode;
/**
* offset 2417
*/
uint8_t unusedSomethingWasHere[3];
/**
* offset 2420
*/
@ -2508,7 +2648,7 @@ struct engine_configuration_s {
/**
* offset 2432
*/
float postCrankingTargetClt;
float unused2432;
/**
* Fuel multiplier taper, see also postCrankingDurationSec
* offset 2436
@ -2957,10 +3097,19 @@ struct engine_configuration_s {
*/
uint8_t iacPidMultRpmBins[IAC_PID_MULT_SIZE];
/**
* set can_vss X
* offset 4140
*/
int mainUnusedEnd[527];
/** total size 6248*/
can_vss_nbc_e canVssNbcType;
/**
* offset 4144
*/
gppwm_channel gppwm[4];
/**
* offset 4496
*/
int mainUnusedEnd[376];
/** total size 6000*/
};
typedef struct engine_configuration_s engine_configuration_s;
@ -2971,6 +3120,26 @@ struct persistent_config_s {
* offset 0
*/
engine_configuration_s engineConfiguration;
/**
* offset 6000
*/
error_message_t warning_message;
/**
* offset 6120
*/
float afterstartCoolantBins[AFTERSTART_HOLD_CURVE_SIZE];
/**
* offset 6152
*/
float afterstartHoldTime[AFTERSTART_HOLD_CURVE_SIZE];
/**
* offset 6184
*/
float afterstartEnrich[AFTERSTART_ENRICH_CURVE_SIZE];
/**
* offset 6216
*/
float afterstartDecayTime[AFTERSTART_DECAY_CURVE_SIZE];
/**
* offset 6248
*/
@ -3242,4 +3411,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Fri Mar 20 19:55:09 EDT 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Sun Apr 26 14:18:05 EDT 2020

View File

@ -1,5 +1,5 @@
//
// was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt
// was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt
//
#define absoluteFuelPressure_offset 76
@ -53,6 +53,17 @@
#define afrTable_offset_hex 48a0
#define afterCrankingIACtaperDuration_offset 2036
#define afterCrankingIACtaperDuration_offset_hex 7f4
#define AFTERSTART_DECAY_CURVE_SIZE 8
#define AFTERSTART_ENRICH_CURVE_SIZE 8
#define AFTERSTART_HOLD_CURVE_SIZE 8
#define afterstartCoolantBins_offset 6120
#define afterstartCoolantBins_offset_hex 17e8
#define afterstartDecayTime_offset 6216
#define afterstartDecayTime_offset_hex 1848
#define afterstartEnrich_offset 6184
#define afterstartEnrich_offset_hex 1828
#define afterstartHoldTime_offset 6152
#define afterstartHoldTime_offset_hex 1808
#define alFIn_offset 4024
#define alFIn_offset_hex fb8
#define alignEngineSnifferAtTDC_offset 744
@ -96,6 +107,10 @@
#define antiLagActivationMode_offset_hex 400
#define antiLagEnabled_offset 76
#define antiLagEnabled_offset_hex 4c
#define antiLagRpmTreshold_offset 824
#define antiLagRpmTreshold_offset_hex 338
#define anUnused4Bytes_offset 732
#define anUnused4Bytes_offset_hex 2dc
#define autoTuneCltThreshold_offset 2420
#define autoTuneCltThreshold_offset_hex 974
#define autoTuneTpsQuietPeriod_offset 2428
@ -186,6 +201,12 @@
#define auxPidPins3_offset_hex 8ae
#define auxPidPins4_offset 2223
#define auxPidPins4_offset_hex 8af
#define auxSerialRxPin_offset 2042
#define auxSerialRxPin_offset_hex 7fa
#define auxSerialSpeed_offset 2096
#define auxSerialSpeed_offset_hex 830
#define auxSerialTxPin_offset 2040
#define auxSerialTxPin_offset_hex 7f8
#define auxTempSensor1_adcChannel_offset 2472
#define auxTempSensor1_adcChannel_offset_hex 9a8
#define auxTempSensor1_alignmentFill_at_29_offset 2473
@ -257,18 +278,6 @@
#define binarySerialRxPin_offset_hex 717
#define binarySerialTxPin_offset 1814
#define binarySerialTxPin_offset_hex 716
#define biQuad_a0_offset 2332
#define biQuad_a0_offset_hex 91c
#define biQuad_a1_offset 2336
#define biQuad_a1_offset_hex 920
#define biQuad_a2_offset 2340
#define biQuad_a2_offset_hex 924
#define biQuad_b1_offset 2344
#define biQuad_b1_offset_hex 928
#define biQuad_b2_offset 2348
#define biQuad_b2_offset_hex 92c
#define biQuad_offset 2332
#define biQuad_offset_hex 91c
#define BLOCKING_FACTOR 400
#define BOOST_LOAD_COUNT 8
#define BOOST_RPM_COUNT 8
@ -325,9 +334,7 @@
#define camInputs3_offset_hex 22e
#define camInputs4_offset 559
#define camInputs4_offset_hex 22f
#define can_device_mode_e_enum "v0", "v1"
#define canDeviceMode_offset 732
#define canDeviceMode_offset_hex 2dc
#define CAN_DEFAULT_BASE 0x200
#define canNbcType_offset 480
#define canNbcType_offset_hex 1e0
#define canReadEnabled_offset 1464
@ -338,6 +345,8 @@
#define canSleepPeriodMs_offset_hex 1e4
#define canTxPin_offset 708
#define canTxPin_offset_hex 2c4
#define canVssNbcType_offset 4140
#define canVssNbcType_offset_hex 102c
#define canWriteEnabled_offset 1464
#define canWriteEnabled_offset_hex 5b8
#define cdmInputPin_offset 937
@ -440,6 +449,9 @@
#define coastingFuelCutTps_offset_hex c50
#define communicationLedPin_offset 1812
#define communicationLedPin_offset_hex 714
#define COMPOSITE_DATA_LENGTH 2500
#define COMPOSITE_PACKET_COUNT 500
#define COMPOSITE_PACKET_SIZE 5
#define CONSOLE_DATA_PROTOCOL_TAG " @"
#define consoleLoopPeriodMs_offset 716
#define consoleLoopPeriodMs_offset_hex 2cc
@ -484,6 +496,7 @@
#define crankingTpsBins_offset_hex 688
#define crankingTpsCoef_offset 1640
#define crankingTpsCoef_offset_hex 668
#define CRITICAL_PREFIX "CRITICAL"
#define cutFuelOnHardLimit_offset 1464
#define cutFuelOnHardLimit_offset_hex 5b8
#define cutSparkOnHardLimit_offset 1464
@ -492,15 +505,11 @@
#define cylinderBore_offset_hex 198
#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", "Boost Control"
#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", "mode16", "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", "INVALID", "ETB Logic", "Boost Control", "Start/Stop", "Launch", "ETB Autotune", "Mode40"
#define debugMapAveraging_offset 807
#define debugMapAveraging_offset_hex 327
#define debugMode_offset 2092
#define debugMode_offset_hex 82c
#define debugSetTimer_offset 806
#define debugSetTimer_offset_hex 326
#define debugTimerCallback_offset 711
#define debugTimerCallback_offset_hex 2c7
#define debugTriggerSync_offset 676
#define debugTriggerSync_offset_hex 2a4
#define DIGIPOT_COUNT 4
@ -514,10 +523,10 @@
#define digitalPotentiometerChipSelect4_offset_hex 29f
#define digitalPotentiometerSpiDevice_offset 677
#define digitalPotentiometerSpiDevice_offset_hex 2a5
#define directSelfStimulation_offset 76
#define directSelfStimulation_offset_hex 4c
#define displacement_offset 396
#define displacement_offset_hex 18c
#define displayLogicLevelsInEngineSniffer_offset 76
#define displayLogicLevelsInEngineSniffer_offset_hex 4c
#define displayMode_offset 492
#define displayMode_offset_hex 1ec
#define dizzySparkOutputPin_offset 2226
@ -533,8 +542,16 @@
#define electronicThrottlePin1Mode_offset_hex 2a0
#define enableAemXSeries_offset 744
#define enableAemXSeries_offset_hex 2e8
#define enableCanVss_offset 976
#define enableCanVss_offset_hex 3d0
#define enabledStep1Limiter_offset 744
#define enabledStep1Limiter_offset_hex 2e8
#define enableInnovateLC2_offset 976
#define enableInnovateLC2_offset_hex 3d0
#define enableLaunchBoost_offset 976
#define enableLaunchBoost_offset_hex 3d0
#define enableLaunchRetard_offset 976
#define enableLaunchRetard_offset_hex 3d0
#define enableVerboseCanTx_offset 744
#define enableVerboseCanTx_offset_hex 2e8
#define engine_load_mode_e_enum "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY", "MAF Air Charge"
@ -557,6 +574,7 @@
#define engineSnifferRpmThreshold_offset_hex 4
#define engineType_offset 0
#define engineType_offset_hex 0
#define ERROR_BUFFER_SIZE 120
#define ETB_BIAS_CURVE_LENGTH 8
#define ETB_COUNT 2
#define etb_dFactor_offset 1744
@ -595,22 +613,22 @@
#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_disablePin_offset 983
#define etbIo1_disablePin_offset_hex 3d7
#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_disablePin_offset 987
#define etbIo2_disablePin_offset_hex 3db
#define etbIo2_offset 984
#define etbIo2_offset_hex 3d8
#define etbNeutralPosition_offset 1471
@ -639,6 +657,10 @@
#define FSIO_COMMAND_COUNT 16
#define FSIO_CURVE_16 16
#define FSIO_CURVE_8 8
#define FSIO_METHOD_FSIO_ANALOG_INPUT "fsio_analog_input"
#define FSIO_METHOD_FSIO_DIGITAL_INPUT "fsio_digital_input"
#define FSIO_METHOD_FSIO_SETTING "fsio_setting"
#define FSIO_METHOD_FSIO_TABLE "fsio_table"
#define fsio_setting10_offset 900
#define fsio_setting10_offset_hex 384
#define fsio_setting11_offset 904
@ -1024,6 +1046,97 @@
#define gpioPinModes8_offset_hex 303
#define gpioPinModes9_offset 772
#define gpioPinModes9_offset_hex 304
#define gppwm1_dutyIfError_offset 4145
#define gppwm1_dutyIfError_offset_hex 1031
#define gppwm1_loadAxis_offset 4150
#define gppwm1_loadAxis_offset_hex 1036
#define gppwm1_loadBins_offset 4152
#define gppwm1_loadBins_offset_hex 1038
#define gppwm1_offBelowDuty_offset 4149
#define gppwm1_offBelowDuty_offset_hex 1035
#define gppwm1_offset 4144
#define gppwm1_offset_hex 1030
#define gppwm1_onAboveDuty_offset 4148
#define gppwm1_onAboveDuty_offset_hex 1034
#define gppwm1_pad_offset 4151
#define gppwm1_pad_offset_hex 1037
#define gppwm1_pin_offset 4144
#define gppwm1_pin_offset_hex 1030
#define gppwm1_pwmFrequency_offset 4146
#define gppwm1_pwmFrequency_offset_hex 1032
#define gppwm1_rpmBins_offset 4160
#define gppwm1_rpmBins_offset_hex 1040
#define gppwm1_table_offset 4168
#define gppwm1_table_offset_hex 1048
#define gppwm2_dutyIfError_offset 4233
#define gppwm2_dutyIfError_offset_hex 1089
#define gppwm2_loadAxis_offset 4238
#define gppwm2_loadAxis_offset_hex 108e
#define gppwm2_loadBins_offset 4240
#define gppwm2_loadBins_offset_hex 1090
#define gppwm2_offBelowDuty_offset 4237
#define gppwm2_offBelowDuty_offset_hex 108d
#define gppwm2_offset 4232
#define gppwm2_offset_hex 1088
#define gppwm2_onAboveDuty_offset 4236
#define gppwm2_onAboveDuty_offset_hex 108c
#define gppwm2_pad_offset 4239
#define gppwm2_pad_offset_hex 108f
#define gppwm2_pin_offset 4232
#define gppwm2_pin_offset_hex 1088
#define gppwm2_pwmFrequency_offset 4234
#define gppwm2_pwmFrequency_offset_hex 108a
#define gppwm2_rpmBins_offset 4248
#define gppwm2_rpmBins_offset_hex 1098
#define gppwm2_table_offset 4256
#define gppwm2_table_offset_hex 10a0
#define gppwm3_dutyIfError_offset 4321
#define gppwm3_dutyIfError_offset_hex 10e1
#define gppwm3_loadAxis_offset 4326
#define gppwm3_loadAxis_offset_hex 10e6
#define gppwm3_loadBins_offset 4328
#define gppwm3_loadBins_offset_hex 10e8
#define gppwm3_offBelowDuty_offset 4325
#define gppwm3_offBelowDuty_offset_hex 10e5
#define gppwm3_offset 4320
#define gppwm3_offset_hex 10e0
#define gppwm3_onAboveDuty_offset 4324
#define gppwm3_onAboveDuty_offset_hex 10e4
#define gppwm3_pad_offset 4327
#define gppwm3_pad_offset_hex 10e7
#define gppwm3_pin_offset 4320
#define gppwm3_pin_offset_hex 10e0
#define gppwm3_pwmFrequency_offset 4322
#define gppwm3_pwmFrequency_offset_hex 10e2
#define gppwm3_rpmBins_offset 4336
#define gppwm3_rpmBins_offset_hex 10f0
#define gppwm3_table_offset 4344
#define gppwm3_table_offset_hex 10f8
#define gppwm4_dutyIfError_offset 4409
#define gppwm4_dutyIfError_offset_hex 1139
#define gppwm4_loadAxis_offset 4414
#define gppwm4_loadAxis_offset_hex 113e
#define gppwm4_loadBins_offset 4416
#define gppwm4_loadBins_offset_hex 1140
#define gppwm4_offBelowDuty_offset 4413
#define gppwm4_offBelowDuty_offset_hex 113d
#define gppwm4_offset 4408
#define gppwm4_offset_hex 1138
#define gppwm4_onAboveDuty_offset 4412
#define gppwm4_onAboveDuty_offset_hex 113c
#define gppwm4_pad_offset 4415
#define gppwm4_pad_offset_hex 113f
#define gppwm4_pin_offset 4408
#define gppwm4_pin_offset_hex 1138
#define gppwm4_pwmFrequency_offset 4410
#define gppwm4_pwmFrequency_offset_hex 113a
#define gppwm4_rpmBins_offset 4424
#define gppwm4_rpmBins_offset_hex 1148
#define gppwm4_table_offset 4432
#define gppwm4_table_offset_hex 1150
#define gppwm_channel_e_enum "TPS", "MAP", "CLT", "IAT"
#define GPPWM_LOAD_COUNT 8
#define GPPWM_RPM_COUNT 8
#define gps_rx_pin_offset 656
#define gps_rx_pin_offset_hex 290
#define gps_tx_pin_offset 657
@ -1337,6 +1450,8 @@
#define isBoostControlEnabled_offset_hex 5c4
#define isCJ125Enabled_offset 744
#define isCJ125Enabled_offset_hex 2e8
#define isCJ125Verbose_offset 76
#define isCJ125Verbose_offset_hex 4c
#define isCylinderCleanupEnabled_offset 1476
#define isCylinderCleanupEnabled_offset_hex 5c4
#define isDoubleSolenoidIdle_offset 76
@ -1361,8 +1476,6 @@
#define isMapAveragingEnabled_offset_hex 5c4
#define isSdCardEnabled_offset 744
#define isSdCardEnabled_offset_hex 2e8
#define issue_294_25_offset 76
#define issue_294_25_offset_hex 4c
#define issue_294_26_offset 76
#define issue_294_26_offset_hex 4c
#define issue_294_27_offset 76
@ -1375,6 +1488,8 @@
#define issue_294_30_offset_hex 4c
#define issue_294_31_offset 76
#define issue_294_31_offset_hex 4c
#define issue_294_unused_offset 76
#define issue_294_unused_offset_hex 4c
#define isTunerStudioEnabled_offset 1476
#define isTunerStudioEnabled_offset_hex 5c4
#define isVerboseAlternator_offset 744
@ -1415,15 +1530,21 @@
#define knockNoiseRpmBins_offset_hex 73c
#define knockVThreshold_offset 1512
#define knockVThreshold_offset_hex 5e8
#define launchActivateDelay_offset 1060
#define launchActivateDelay_offset_hex 424
#define launchActivatePin_offset 991
#define launchActivatePin_offset_hex 3df
#define launchActivationMode_e_enum "Switch Input", "Clutch Input", "Always Active(Disabled By Speed)","INVALID"
#define launchActivationMode_offset 1020
#define launchActivationMode_offset_hex 3fc
#define launchAdvanceRpmRange_offset 1052
#define launchAdvanceRpmRange_offset_hex 41c
#define launchBoostDuty_offset 1044
#define launchBoostDuty_offset_hex 414
#define launchControlEnabled_offset 76
#define launchControlEnabled_offset_hex 4c
#define launchDisableBySpeed_offset 976
#define launchDisableBySpeed_offset_hex 3d0
#define launchFuelAdded_offset 1040
#define launchFuelAdded_offset_hex 410
#define launchFuelCutEnable_offset 1464
@ -1442,6 +1563,8 @@
#define launchTimingRetard_offset_hex 140
#define launchTimingRpmRange_offset 1036
#define launchTimingRpmRange_offset_hex 40c
#define launchTpsTreshold_offset 1056
#define launchTpsTreshold_offset_hex 420
#define lcdThreadPeriodMs_offset 720
#define lcdThreadPeriodMs_offset_hex 2d0
#define LDS_ALTERNATOR_PID_STATE_INDEX 9
@ -1485,8 +1608,8 @@
#define mainRelayPin_offset_hex 2c2
#define mainRelayPinMode_offset 752
#define mainRelayPinMode_offset_hex 2f0
#define mainUnusedEnd_offset 4140
#define mainUnusedEnd_offset_hex 102c
#define mainUnusedEnd_offset 4496
#define mainUnusedEnd_offset_hex 1190
#define malfunctionIndicatorPin_offset 660
#define malfunctionIndicatorPin_offset_hex 294
#define malfunctionIndicatorPinMode_offset 661
@ -1563,6 +1686,8 @@
#define mc33816_cs_offset_hex c23
#define mc33816_driven_offset 2607
#define mc33816_driven_offset_hex a2f
#define mc33816_flag0_offset 1774
#define mc33816_flag0_offset_hex 6ee
#define mc33816_rstb_offset 2606
#define mc33816_rstb_offset_hex a2e
#define mc33816spiDevice_offset 4001
@ -1573,6 +1698,8 @@
#define mc33972_csPinMode_offset_hex 2a7
#define mc33972spiDevice_offset 4008
#define mc33972spiDevice_offset_hex fa8
#define mc33_hvolt_offset 760
#define mc33_hvolt_offset_hex 2f8
#define measureMapOnlyInOneCylinder_offset 744
#define measureMapOnlyInOneCylinder_offset_hex 2e8
#define MOCK_AFR_COMMAND "mock_afr_voltage"
@ -1582,7 +1709,6 @@
#define MOCK_MAP_COMMAND "mock_map_voltage"
#define MOCK_PPS_POSITION_COMMAND "mock_pps_position"
#define MOCK_PPS_VOLTAGE_COMMAND "mock_pps_voltage"
#define MOCK_TPS_COMMAND "mock_tps_voltage"
#define multisparkDwell_offset 1786
#define multisparkDwell_offset_hex 6fa
#define multisparkEnable_offset 976
@ -1600,8 +1726,6 @@
#define narrowToWideOxygen_offset_hex 8f8
#define narrowToWideOxygenBins_offset 2264
#define narrowToWideOxygenBins_offset_hex 8d8
#define nbVvtIndex_offset 2416
#define nbVvtIndex_offset_hex 970
#define noAccelAfterHardLimitPeriodSecs_offset 1536
#define noAccelAfterHardLimitPeriodSecs_offset_hex 600
#define o2heaterPin_offset 742
@ -1629,6 +1753,7 @@
#define overrideCrankingIacSetting_offset_hex 5c4
#define overrideCrankingIgnition_offset 516
#define overrideCrankingIgnition_offset_hex 204
#define PACK_ADD_TEMPERATURE 40
#define PACK_MULT_AFR 1000
#define PACK_MULT_ANGLE 50
#define PACK_MULT_MS 300
@ -1653,8 +1778,6 @@
#define postCrankingDurationSec_offset_hex 988
#define postCrankingFactor_offset 2436
#define postCrankingFactor_offset_hex 984
#define postCrankingTargetClt_offset 2432
#define postCrankingTargetClt_offset_hex 980
#define primeInjFalloffTemperature_offset 1486
#define primeInjFalloffTemperature_offset_hex 5ce
#define primingSquirtDurationMs_offset 96
@ -1720,6 +1843,8 @@
#define servoOutputPins7_offset_hex c4a
#define servoOutputPins8_offset 3147
#define servoOutputPins8_offset_hex c4b
#define showHumanReadableWarning_offset 976
#define showHumanReadableWarning_offset_hex 3d0
#define showSdCardWarning_offset 76
#define showSdCardWarning_offset_hex 4c
#define silentTriggerError_offset 1464
@ -1768,6 +1893,8 @@
#define spi3SckMode_offset_hex a2a
#define spi3sckPin_offset 936
#define spi3sckPin_offset_hex 3a8
#define startCrankingDuration_offset 826
#define startCrankingDuration_offset_hex 33a
#define starterControlPin_offset 1772
#define starterControlPin_offset_hex 6ec
#define starterRelayDisableMode_offset 809
@ -1792,6 +1919,57 @@
#define stepperForceParkingEveryRestart_offset_hex 2e8
#define stepperParkingExtraSteps_offset 818
#define stepperParkingExtraSteps_offset_hex 332
#define STFT_CELL_COUNT 4
#define stft_cellCfgs1_maxAdd_offset 1072
#define stft_cellCfgs1_maxAdd_offset_hex 430
#define stft_cellCfgs1_maxRemove_offset 1073
#define stft_cellCfgs1_maxRemove_offset_hex 431
#define stft_cellCfgs1_offset 1072
#define stft_cellCfgs1_offset_hex 430
#define stft_cellCfgs1_timeConstant_offset 1074
#define stft_cellCfgs1_timeConstant_offset_hex 432
#define stft_cellCfgs2_maxAdd_offset 1076
#define stft_cellCfgs2_maxAdd_offset_hex 434
#define stft_cellCfgs2_maxRemove_offset 1077
#define stft_cellCfgs2_maxRemove_offset_hex 435
#define stft_cellCfgs2_offset 1076
#define stft_cellCfgs2_offset_hex 434
#define stft_cellCfgs2_timeConstant_offset 1078
#define stft_cellCfgs2_timeConstant_offset_hex 436
#define stft_cellCfgs3_maxAdd_offset 1080
#define stft_cellCfgs3_maxAdd_offset_hex 438
#define stft_cellCfgs3_maxRemove_offset 1081
#define stft_cellCfgs3_maxRemove_offset_hex 439
#define stft_cellCfgs3_offset 1080
#define stft_cellCfgs3_offset_hex 438
#define stft_cellCfgs3_timeConstant_offset 1082
#define stft_cellCfgs3_timeConstant_offset_hex 43a
#define stft_cellCfgs4_maxAdd_offset 1084
#define stft_cellCfgs4_maxAdd_offset_hex 43c
#define stft_cellCfgs4_maxRemove_offset 1085
#define stft_cellCfgs4_maxRemove_offset_hex 43d
#define stft_cellCfgs4_offset 1084
#define stft_cellCfgs4_offset_hex 43c
#define stft_cellCfgs4_timeConstant_offset 1086
#define stft_cellCfgs4_timeConstant_offset_hex 43e
#define stft_deadband_offset 1067
#define stft_deadband_offset_hex 42b
#define stft_maxAfr_offset 1070
#define stft_maxAfr_offset_hex 42e
#define stft_maxIdleRegionRpm_offset 1064
#define stft_maxIdleRegionRpm_offset_hex 428
#define stft_maxOverrunLoad_offset 1065
#define stft_maxOverrunLoad_offset_hex 429
#define stft_minAfr_offset 1069
#define stft_minAfr_offset_hex 42d
#define stft_minClt_offset 1068
#define stft_minClt_offset_hex 42c
#define stft_minPowerLoad_offset 1066
#define stft_minPowerLoad_offset_hex 42a
#define stft_offset 1064
#define stft_offset_hex 428
#define stft_startupDelay_offset 1071
#define stft_startupDelay_offset_hex 42f
#define storageMode_offset 2260
#define storageMode_offset_hex 8d4
#define switch_input_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "N/A", "N/A", "PA10", "PA11", "PA12", "PA13", "N/A", "N/A", "N/A", "N/A", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "N/A", "N/A", "N/A", "N/A", "PB12", "PB13", "N/A", "N/A", "N/A", "N/A", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "N/A", "N/A", "N/A", "N/A", "PC14", "PC15", "PC16", "PC17", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "PD15", "PD16", "N/A", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"
@ -1884,12 +2062,17 @@
#define tle8888_cs_offset_hex c21
#define tle8888_csPinMode_offset 3106
#define tle8888_csPinMode_offset_hex c22
#define tle8888mode_offset 2416
#define tle8888mode_offset_hex 970
#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 TOOTH_DATA_LENGTH 2000
#define TOOTH_PACKET_COUNT 1000
#define TOOTH_PACKET_SIZE 2
#define TOP_DEAD_CENTER_MESSAGE "r"
#define TOTAL_CONFIG_SIZE 20000
#define TOTAL_CONFIG_SIZE_hex 4e20
@ -1941,7 +2124,13 @@
#define trigger_offset 524
#define trigger_offset_hex 20c
#define TRIGGER_SIMULATOR_PIN_COUNT 3
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Honda 4+24+1", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "1+60/2", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "2JZ", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped" , "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "trg43", "trg44", "trg45", "INVALID"
#define trigger_todoRemoveMeOneDay0_offset 528
#define trigger_todoRemoveMeOneDay0_offset_hex 210
#define trigger_todoRemoveMeOneDay1_offset 528
#define trigger_todoRemoveMeOneDay1_offset_hex 210
#define TRIGGER_TYPE_36_1 9
#define TRIGGER_TYPE_60_2 8
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Honda 4+24+1", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "1+60/2", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "2JZ", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped" , "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "trg43", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "trg47", "trg48", "INVALID"
#define trigger_type_offset 524
#define trigger_type_offset_hex 20c
#define trigger_unusedBit_4_10_offset 528
@ -2002,10 +2191,6 @@
#define trigger_unusedBit_4_8_offset_hex 210
#define trigger_unusedBit_4_9_offset 528
#define trigger_unusedBit_4_9_offset_hex 210
#define trigger_unusedTriggerBit0_offset 528
#define trigger_unusedTriggerBit0_offset_hex 210
#define trigger_unusedTriggerBit1_offset 528
#define trigger_unusedTriggerBit1_offset_hex 210
#define trigger_useOnlyFirstChannel_offset 528
#define trigger_useOnlyFirstChannel_offset_hex 210
#define triggerCompCenterVolt_offset 4036
@ -2041,8 +2226,10 @@
#define triggerSimulatorPins3_offset 738
#define triggerSimulatorPins3_offset_hex 2e2
#define TS_FILE_VERSION 20200310
#define TS_OUTPUT_SIZE 240
#define TS_OUTPUT_SIZE 244
#define ts_show_analog_divider true
#define ts_show_auxserial_pins true
#define ts_show_can_pins true
#define ts_show_cj125 true
#define ts_show_egt true
#define ts_show_etb true
@ -2052,8 +2239,11 @@
#define ts_show_hip9011 true
#define ts_show_joystick true
#define ts_show_lcd true
#define ts_show_sd_card true
#define ts_show_spi true
#define TS_SIGNATURE "rusEFI v1.2020.3"
#define ts_show_trigger_comparator true
#define ts_show_tunerstudio_port true
#define TS_SIGNATURE "rusEFI v1.2020.4"
#define tunerStudioSerialSpeed_offset 728
#define tunerStudioSerialSpeed_offset_hex 2d8
#define twoWireBatchIgnition_offset 1476
@ -2062,12 +2252,16 @@
#define twoWireBatchInjection_offset_hex 5c4
#define uartConsoleSerialSpeed_offset 2076
#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 unused2432_offset 2432
#define unused2432_offset_hex 980
#define unused711_offset 711
#define unused711_offset_hex 2c7
#define unused76b0_offset 76
#define unused76b0_offset_hex 4c
#define unused806_offset 806
#define unused806_offset_hex 326
#define unused_1484_bit_24_offset 1476
#define unused_1484_bit_24_offset_hex 5c4
#define unused_1484_bit_25_offset 1476
@ -2084,10 +2278,12 @@
#define unused_1484_bit_30_offset_hex 5c4
#define unused_1484_bit_31_offset 1476
#define unused_1484_bit_31_offset_hex 5c4
#define unused_former_warmup_target_afr_offset 2096
#define unused_former_warmup_target_afr_offset_hex 830
#define unusedAtOldBoardConfigurationEnd_offset 1052
#define unusedAtOldBoardConfigurationEnd_offset_hex 41c
#define unused_former_warmup_target_afr_offset 2100
#define unused_former_warmup_target_afr_offset_hex 834
#define unusedAntilagTimeout_offset 820
#define unusedAntilagTimeout_offset_hex 334
#define unusedAtOldBoardConfigurationEnd_offset 1088
#define unusedAtOldBoardConfigurationEnd_offset_hex 440
#define unusedBit4_1476_offset 1476
#define unusedBit4_1476_offset_hex 5c4
#define unusedBit_251_10_offset 976
@ -2130,34 +2326,20 @@
#define unusedBit_251_28_offset_hex 3d0
#define unusedBit_251_29_offset 976
#define unusedBit_251_29_offset_hex 3d0
#define unusedBit_251_4_offset 976
#define unusedBit_251_4_offset_hex 3d0
#define unusedBit_251_5_offset 976
#define unusedBit_251_5_offset_hex 3d0
#define unusedBit_251_6_offset 976
#define unusedBit_251_6_offset_hex 3d0
#define unusedBit_251_7_offset 976
#define unusedBit_251_7_offset_hex 3d0
#define unusedBit_251_8_offset 976
#define unusedBit_251_8_offset_hex 3d0
#define unusedBit_251_9_offset 976
#define unusedBit_251_9_offset_hex 3d0
#define unusedBit_280_30_offset 976
#define unusedBit_280_30_offset_hex 3d0
#define unusedBit_280_31_offset 976
#define unusedBit_280_31_offset_hex 3d0
#define unusedBit_282_30_offset 976
#define unusedBit_282_30_offset_hex 3d0
#define unusedBit_282_31_offset 976
#define unusedBit_282_31_offset_hex 3d0
#define unusedBit_34_31_offset 76
#define unusedBit_34_31_offset_hex 4c
#define unusedErrorPin_offset 2040
#define unusedErrorPin_offset_hex 7f8
#define unusedFlexFuelSensor_offset 3100
#define unusedFlexFuelSensor_offset_hex c1c
#define unusedFormerWarmupAfrPid_offset 1774
#define unusedFormerWarmupAfrPid_offset_hex 6ee
#define unusedmiataNb2VVTRatioFrom_offset 820
#define unusedmiataNb2VVTRatioFrom_offset_hex 334
#define unusedmiataNb2VVTRatioTo_offset 824
#define unusedmiataNb2VVTRatioTo_offset_hex 338
#define unusedHere_offset 761
#define unusedHere_offset_hex 2f9
#define unusedOldBiquad_offset 2332
#define unusedOldBiquad_offset_hex 91c
#define unusedSomethingWasHere_offset 2417
#define unusedSomethingWasHere_offset_hex 971
#define unusedSpiPadding4_offset 2593
#define unusedSpiPadding4_offset_hex a21
#define unusedSpiPadding5_offset 2713
@ -2172,8 +2354,6 @@
#define unusuedvref_offset_hex fb0
#define useAdvanceCorrectionsForCranking_offset 1476
#define useAdvanceCorrectionsForCranking_offset_hex 5c4
#define useBiQuadAnalogFiltering_offset 76
#define useBiQuadAnalogFiltering_offset_hex 4c
#define useConstantDwellDuringCranking_offset 1464
#define useConstantDwellDuringCranking_offset_hex 5b8
#define useETBforIdleControl_offset 744
@ -2238,8 +2418,6 @@
#define useStepperIdle_offset_hex 2e8
#define useTLE8888_cranking_hack_offset 76
#define useTLE8888_cranking_hack_offset_hex 4c
#define useTLE8888_hall_mode_offset 76
#define useTLE8888_hall_mode_offset_hex 4c
#define useTpicAdvancedMode_offset 744
#define useTpicAdvancedMode_offset_hex 2e8
#define useTPSAdvanceTable_offset 1476
@ -2279,6 +2457,8 @@
#define vvtMode_offset_hex 918
#define vvtOffset_offset 2052
#define vvtOffset_offset_hex 804
#define warning_message_offset 6000
#define warning_message_offset_hex 1770
#define warningLedPin_offset 2041
#define warningLedPin_offset_hex 7f9
#define warningPeriod_offset 1498

View File

@ -11,3 +11,5 @@
#define switch_input_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "N/A", "N/A", "PA10", "PA11", "PA12", "PA13", "N/A", "N/A", "N/A", "N/A", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "N/A", "N/A", "N/A", "N/A", "PB12", "PB13", "N/A", "N/A", "N/A", "N/A", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "N/A", "N/A", "N/A", "N/A", "PC14", "PC15", "PC16", "PC17", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "PD15", "PD16", "N/A", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"
#define output_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "N/A", "N/A", "PA10", "PA11", "PA12", "PA13", "N/A", "N/A", "N/A", "N/A", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "N/A", "N/A", "N/A", "N/A", "PB12", "PB13", "N/A", "N/A", "N/A", "N/A", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "N/A", "N/A", "N/A", "N/A", "PC14", "PC15", "PC16", "PC17", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "PD15", "PD16", "N/A", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16"
#define adc_channel_e_enum "PA2", "PA3", "INVALID", "PD3", "INVALID", "INVALID", "INVALID", "PB12", "PB13", "INVALID", "PE2", "INVALID", "PC14", "PC15", "PC16", "PC17", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
#define ts_show_trigger_comparator true

View File

@ -245,22 +245,17 @@
// todo: most of this should become configurable
// todo: switch to continues ADC conversion for slow ADC?
// https://github.com/rusefi/rusefi/issues/630
// todo: switch to continues ADC conversion for fast ADC?
#define EFI_INTERNAL_FAST_ADC_PWM &PWMD2
#define EFI_INTERNAL_FAST_ADC_GPT &GPTD2
// todo: why 64 SPLL prescaler doesn't work?
// 168000000/64/128/1025 = ~20Hz
// 168000000/64/16/16 = ~10.25kHz
// todo: warning! these numbers are "tricky"! need to investigate further!
//168000000/128/65535 = ~20Hz
#define PWM_FREQ_SLOW 20507 /* PWM clock frequency. */
#define PWM_PERIOD_SLOW 65535 /* PWM period (in PWM ticks). */
//168000000/128/131 = ~10kHz
#define PWM_FREQ_FAST 20507/*164062*/ /* PWM clock frequency. */
#define PWM_PERIOD_FAST 131 /* PWM period (in PWM ticks). */
#define GPT_FREQ_FAST 20507/*164062*/ /* PWM clock frequency. */
#define GPT_PERIOD_FAST 131 /* PWM period (in PWM ticks). */
#define EFI_SPI1_AF 3
@ -343,14 +338,10 @@
//#define CONSOLE_THREAD_STACK_SIZE UTILITY_THREAD_STACK_SIZE
#define BOARD_EXT_GPIOCHIPS 1
#define BOARD_TLE6240_COUNT 1
#define BOARD_MC33972_COUNT 0
#define BOARD_TLE8888_COUNT 0
// todo: move this outside of efifeatures.h
#define BOARD_EXT_PINREPOPINS 24
#define TLE6240_SS_PORT GPIOB
#define TLE6240_SS_PAD 0U
#define TLE6240_RESET_PORT NULL

View File

@ -111,7 +111,7 @@
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM TRUE
#define HAL_USE_PWM FALSE
#endif
/**
@ -171,13 +171,19 @@
#endif
/**
* @brief Enables the Comparator subsystem.
* @brief Enables the community overlay.
*/
#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
#define HAL_USE_COMMUNITY TRUE
#endif
/**
* @brief Enables the TIMCAP subsystem.
*/
#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
#define HAL_USE_COMP TRUE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/

View File

@ -0,0 +1,28 @@
/*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef HALCONF_COMMUNITY_H
#define HALCONF_COMMUNITY_H
/**
* @brief Enables the TIMCAP subsystem.
*/
#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
#define HAL_USE_COMP TRUE
#endif
#endif /* HALCONF_COMMUNITY_H */
/** @} */

View File

@ -13,8 +13,7 @@
#include "engine_configuration.h"
#include "smart_gpio.h"
EXTERN_ENGINE
;
EXTERN_ENGINE;
static void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}

View File

@ -0,0 +1,11 @@
cd ../../..
set PROJECT_BOARD=microrusefi
set PROJECT_CPU=ARCH_STM32F4
set DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=BMW_M73_MRE_SLAVE
set EXTRA_PARAMS=-DDUMMY -DEFI_CANBUS_SLAVE=TRUE
call config/boards/common_make.bat

View File

@ -14,6 +14,7 @@ ifeq ($(PROJECT_CPU),ARCH_STM32F4)
else
MCU_DEFS = -DSTM32F767xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
CONFDIR=config/stm32f7ems
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld

View File

@ -4,6 +4,13 @@
*
* @brief Configuration defaults for the microRusefi board
*
* MICRO_RUS_EFI
* set engine_type 60
*
* MRE_BOARD_TEST
* set engine_type 30
*
*
* See https://github.com/rusefi/rusefi_documentation/wiki/Hardware_microRusEfi_wiring
*
* @author Matthew Kennedy, (c) 2019
@ -18,6 +25,15 @@
EXTERN_ENGINE;
static const ConfigOverrides configOverrides = {
.canTxPin = GPIOB_6,
.canRxPin = GPIOB_12,
};
const ConfigOverrides& getConfigOverrides() {
return configOverrides;
}
static void setInjectorPins() {
engineConfiguration->injectionPins[0] = GPIOE_14;
engineConfiguration->injectionPins[1] = GPIOE_13;
@ -65,12 +81,12 @@ static void setupVbatt() {
engineConfiguration->analogInputDividerCoefficient = 2.5f / 1.5f;
*/
// 6.8k high side/10k low side = 1.6667 ratio divider
// 6.8k high side/10k low side = 1.68 ratio divider
engineConfiguration->analogInputDividerCoefficient = 16.8f / 10.0f;
// set vbatt_divider 8.16
// R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.166666f
engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f);
// set vbatt_divider 8.23
// R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.232f
engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
engineConfiguration->vbattAdcChannel = EFI_ADC_11;
engineConfiguration->adcVcc = 3.29f;
@ -103,25 +119,15 @@ static void setupEtb() {
engineConfiguration->etbIo[0].controlPin1 = GPIOC_7;
// DIR pin
engineConfiguration->etbIo[0].directionPin1 = GPIOA_8;
// set_fsio_output_pin 7 PC8
#if EFI_FSIO
// set_rpn_expression 8 "1"
// disable ETB by default
setFsio(7, GPIOC_8, "1" PASS_CONFIG_PARAMETER_SUFFIX);
// enable ETB
// set_rpn_expression 8 "0"
//setFsio(7, GPIOC_8, "0" PASS_CONFIG_PARAMETER_SUFFIX);
#endif /* EFI_FSIO */
// Disable pin
engineConfiguration->etbIo[0].disablePin = GPIOC_8;
// Unused
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
// set_analog_input_pin pps PA7
// EFI_ADC_7: "31 - AN volt 3" - PA7
// engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
// Unused
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
// we only have pwm/dir, no dira/dirb
engineConfiguration->etb_use_two_wires = false;

View File

@ -23,9 +23,9 @@ outputs:
# TLE8888 high current low side: VVT2 TLE8888_IN9 / TLE8888_OUT5
GPIOE_10: "3 - Lowside 2"
# TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21
# TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21#91
GPIOE_8: "35 - GP Out 1"
# TLE8888 half bridges (pushpull, lowside, or high-low) IN? / TLE8888_OUT22
# TLE8888 half bridges (pushpull, lowside, or high-low) IN? / TLE8888_OUT22#89
# this should work but it does not GPIOE_7: "34 - GP Out 2"
TLE8888_PIN_22: "34 - GP Out 2"
TLE8888_PIN_23: "33 - GP Out 3"

View File

@ -8,3 +8,6 @@
#define ts_show_etb_pins false
#define ts_show_analog_divider false
#define ts_show_spi false
#define ts_show_sd_card false
#define ts_show_can_pins false
#define ts_show_tunerstudio_port false

View File

@ -0,0 +1,4 @@
https://rusefi.com/forum/viewtopic.php?f=4&t=1538
https://github.com/rusefi/hw_microRusEfi

View File

@ -15,6 +15,7 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F746xx ^
-DEFI_FATAL_ERROR_PIN=GPIOB_14 ^
-DEFI_TOOTH_LOGGER=FALSE ^
-DRAM_UNUSED_SIZE=10 ^
-DSTATUS_LOGGING_BUFFER_SIZE=1400 ^
-DCCM_UNUSED_SIZE=10
set DEBUG_LEVEL_OPT="-O2"
call config/boards/common_make.bat

View File

@ -4,6 +4,7 @@ BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/NUCLEO_F767/board_configuration.cpp
# Required include directories
BOARDINC = $(PROJECT_DIR)/config/boards/NUCLEO_F746 $(PROJECT_DIR)/config/stm32f7ems
CONFDIR=config/stm32f7ems
LDSCRIPT= $(PROJECT_DIR)/config/boards/NUCLEO_F746/STM32F746xG.ld

View File

@ -12,6 +12,7 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^
-DEFI_INJECTOR_PIN3=GPIO_UNASSIGNED ^
-DFIRMWARE_ID=\"nucleo767\" ^
-DEFI_COMMUNICATION_PIN=GPIOB_7 ^
-DSTATUS_LOGGING_BUFFER_SIZE=1400 ^
-DEFI_FATAL_ERROR_PIN=GPIOB_14 ^
-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

View File

@ -4,6 +4,7 @@ BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/nucleo_f767/board_configuration.cpp
# Required include directories
BOARDINC = $(PROJECT_DIR)/config/boards/nucleo_f767 $(PROJECT_DIR)/config/stm32f7ems
CONFDIR=config/stm32f7ems
LDSCRIPT= $(PROJECT_DIR)/config/boards/nucleo_f767/STM32F76xxI.ld

View File

@ -258,7 +258,6 @@ void setBoardConfigurationOverrides(void) {
//engineConfiguration->isCJ125Enabled = true;
engineConfiguration->isCJ125Enabled = false;
engineConfiguration->canDeviceMode = CD_USE_CAN1;
engineConfiguration->canTxPin = GPIOB_9;
engineConfiguration->canRxPin = GPIOB_8;

View File

@ -9,8 +9,7 @@
#include "../../stm32f4ems/efifeatures.h"
#ifndef EFIFEATURES_PROMETHEUS_H_
#define EFIFEATURES_PROMETHEUS_H_
#pragma once
#undef EFI_RTC
#define EFI_RTC FALSE
@ -68,9 +67,6 @@
#define BOARD_TLE8888_COUNT 0
#endif
// todo: move this outside of efifeatures.h
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
#undef EFI_CONSOLE_TX_PORT
#define EFI_CONSOLE_TX_PORT GPIOA
@ -115,4 +111,3 @@
#define EFI_NARROW_EGO_AVERAGING TRUE
#endif /* EFIFEATURES_PROMETHEUS_H_ */

View File

@ -1,4 +1,5 @@
Prometheus board.
http://rusefi.com/forum/viewtopic.php?f=4&t=1215
https://github.com/andreika-git/rusefi/
https://github.com/andreika-git/prometheus

View File

@ -17,6 +17,7 @@ else
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld
CONFDIR=config/stm32f4ems
endif

View File

@ -43,6 +43,15 @@ static const brain_pin_e ignPins[] = {
GPIOG_2,
};
static const ConfigOverrides configOverrides = {
.canTxPin = GPIOD_1,
.canRxPin = GPIOD_0,
};
const ConfigOverrides& getConfigOverrides() {
return configOverrides;
}
static void setInjectorPins() {
copyArray(engineConfiguration->injectionPins, injPins);
engineConfiguration->injectionPinMode = OM_DEFAULT;
@ -86,6 +95,8 @@ static void setupEtb() {
engineConfiguration->etbIo[0].controlPin1 = GPIOD_12;
// DIR pin
engineConfiguration->etbIo[0].directionPin1 = GPIOD_10;
// Disable pin
engineConfiguration->etbIo[0].disablePin = GPIOD_11;
// Unused
engineConfiguration->etbIo[0].directionPin2 = GPIO_UNASSIGNED;
@ -94,25 +105,16 @@ static void setupEtb() {
engineConfiguration->etbIo[1].controlPin1 = GPIOD_13;
// DIR pin
engineConfiguration->etbIo[1].directionPin1 = GPIOD_9;
// Disable pin
engineConfiguration->etbIo[1].disablePin = GPIOD_8;
// Unused
engineConfiguration->etbIo[1].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 setupCanPins() {
engineConfiguration->canTxPin = GPIOD_1;
engineConfiguration->canRxPin = GPIOD_0;
}
static void setupDefaultSensorInputs() {
// trigger inputs
// Digital channel 1 as default - others not set
@ -164,7 +166,6 @@ void setBoardConfigurationOverrides(void) {
setLedPins();
setupVbatt();
setupEtb();
setupCanPins();
// "required" hardware is done - set some reasonable defaults
setupDefaultSensorInputs();

View File

@ -6,3 +6,7 @@
#define ts_show_egt false
#define ts_show_gps false
#define ts_show_analog_divider false
#define ts_show_spi false
#define ts_show_sd_card false
#define ts_show_can_pins false
#define ts_show_tunerstudio_port false

View File

@ -0,0 +1,4 @@
https://rusefi.com/forum/viewtopic.php?f=4&t=1646
https://github.com/mck1117/proteus

View File

@ -1 +1,4 @@
See [misc/jenkins/compile_other_versions/run.bat](misc/jenkins/compile_other_versions/run.bat) which is executed by build server.
See [misc/jenkins/compile_other_versions/run.bat](misc/jenkins/compile_other_versions/run.bat) which is executed by build server.
See https://rusefi.com/build_server/

View File

@ -86,11 +86,6 @@
#define BOARD_MC33972_COUNT 0
#define BOARD_TLE8888_COUNT 0
// Future: move these outside of efifeatures.h
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
#define BOARD_EXT_PINREPOPINS 24
/**
* if you have a 60-2 trigger, or if you just want better performance, you
* probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
@ -259,10 +254,8 @@
// todo: most of this should become configurable
// todo: switch to continuous ADC conversion for slow ADC?
// https://github.com/rusefi/rusefi/issues/630
// todo: switch to continues ADC conversion for fast ADC?
#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4
#define EFI_INTERNAL_FAST_ADC_GPT &GPTD6
#define EFI_SPI1_AF 5

File diff suppressed because it is too large Load Diff

View File

@ -34,9 +34,6 @@
#undef BOARD_TLE8888_COUNT
#define BOARD_TLE8888_COUNT 0
#undef BOARD_EXT_GPIOCHIPS
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
/*
* Board oscillators-related settings.
* NOTE: LSE not fitted.

View File

@ -221,7 +221,6 @@ void setBoardConfigurationOverrides(void) {
#endif
engineConfiguration->isCJ125Enabled = false;
engineConfiguration->canDeviceMode = CD_USE_CAN1;
engineConfiguration->canTxPin = GPIOD_0;
engineConfiguration->canRxPin = GPIOD_1;

View File

@ -9,8 +9,7 @@
#include "../../stm32f7ems/efifeatures.h"
#ifndef EFIFEATURES_SUBARUEJ20G_H_
#define EFIFEATURES_SUBARUEJ20G_H_
#pragma once
/* debug console */
#undef EFI_USE_UART_FOR_CONSOLE
@ -25,10 +24,6 @@
/* do not use serial device for console */
#undef TS_SERIAL_DEVICE
/* additional space for pins on gpioext */
#undef BOARD_EXT_PINREPOPINS
#define BOARD_EXT_PINREPOPINS (16 + 22)
#undef EFI_RTC
#define EFI_RTC FALSE
@ -113,4 +108,3 @@
#define EFI_NARROW_EGO_AVERAGING TRUE
#endif /* EFIFEATURES_SUBARUEJ20G_H_ */

View File

@ -30,8 +30,8 @@
* ECU pin 6: GND ECU
* 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 21: GND BRN BLK CLT sensor (only on first ECU)
* ECU pin 22: IN RED/BRN GRN CLT sensor (only on first ECU)
* 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
@ -39,7 +39,7 @@
* 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
*
* ECU pin 47: IN IAT sensor (only on second ECU)
*
* Plug #4 40 pin
* ECU pin 6: IN start signal from ignition key
@ -79,6 +79,7 @@ void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.cylindersCount = 12;
engineConfiguration->specs.displacement = 5.4;
engineConfiguration->specs.firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10;
CONFIG(isFasterEngineSpinUpEnabled) = true;
engineConfiguration->vvtMode = VVT_FIRST_HALF;
@ -252,7 +253,7 @@ GPIOA_6
*
* white#9 : orange : +5v
* white#17: green : PPS
* white#18: red
* white#18: red : TPS#2
* white#23: black : Sensor Ground
* white#24: red : TPS#1
*
@ -261,7 +262,7 @@ void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
// 12 injectors defined in boards/proteus/board_configuration.cpp
// set_analog_input_pin pps pa4
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_4;
// set vbatt_divider 8.16
@ -270,7 +271,8 @@ void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->vbattDividerCoeff = 7.6;
// TPS#2 = Analog volt
// engineConfiguration->tps2_1AdcChannel = EFI_ADC_;
// set_analog_input_pin tps2 pa6
engineConfiguration->tps2_1AdcChannel = EFI_ADC_6;
}

View File

@ -12,7 +12,9 @@
void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE);
// set engine_type 24
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE);
// set engine_type 63
void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -30,12 +30,16 @@
* ECU pin 2: OUT ORG injector #4
* ECU pin 6: GND ECU
* ECU pin 15: OUT ORG injector #2
* ECU pin 21: GND BRN BLK CLT sensor (only on first ECU)
* ECU pin 22: IN RED/BRN BLU CLT sensor (only on first ECU)
* ECU pin 27: OUT GRN injector #6
* ECU pin 28: OUT BLU injector #5
* ECU pin 32: IN WHT VR positive crankshaft sensor
* ECU pin 34: IN IAT sensor (only on second ECU)
* ECU pin 40: OUT BRN/BLK GRN injector #3
* ECU pin 41: OUT BRN/WHT BLU injector #1
* ECU pin 46: IN BLK BLU VR negative crankshaft sensor
* ECU pin 47: GND BRN IAT sensor (only on second ECU)
*
* Plug #4 40 pin
* ECU pin 6: IN ORG start signal from ignition key. Custom wiring: pulled-up thermistor wire on MRE
@ -46,9 +50,13 @@
* Plug #5 9 pin
* ECU pin 3: OUT BLK ORG coil signal
* ECU pin 5: GND BRN ground
* ECU pin 6: OUT BLK ORG coil signal
* ECU pin 9: OUT BLK ORG coil signal
*
* BMW_M73_MRE
* set engine_type 104
* BMW_M73_MRE_SLAVE
* set engine_type 105
*
*/
@ -61,7 +69,9 @@ void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 13641435991 injector
engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info
CONFIG(isFasterEngineSpinUpEnabled) = true;
engineConfiguration->globalTriggerAngleOffset = 90;
engineConfiguration->specs.cylindersCount = 6;
engineConfiguration->specs.displacement = 5.4 / 2;
engineConfiguration->specs.firingOrder = FO_1_5_3_6_2_4;
@ -70,10 +80,6 @@ void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->injectionMode = IM_BATCH;
// set_analog_input_pin pps PA7
// EFI_ADC_7: "31 - AN volt 3" - PA7
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_7;
// enable ETB
// set_rpn_expression 8 "0"
setFsio(7, GPIOC_8, "0" PASS_CONFIG_PARAMETER_SUFFIX);
@ -83,7 +89,8 @@ void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etb.pFactor = 2.00;
engineConfiguration->etb.iFactor = 0.35;
// AN Temp 4, orange wire
// set debug_mode 37
// 22 - AN Temp 4, orange wire
CONFIG(startStopButtonPin) = GPIOA_3;
#if (BOARD_TLE8888_COUNT > 0)
@ -92,6 +99,35 @@ void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#endif /* BOARD_TLE8888_COUNT */
engineConfiguration->canNbcType = CAN_BUS_NBC_NONE;
#if EFI_CANBUS_SLAVE
engineConfiguration->canReadEnabled = true;
engineConfiguration->canWriteEnabled = false;
#else /* EFI_CANBUS_SLAVE */
// set_analog_input_pin pps PA7
// EFI_ADC_7: "31 - AN volt 3" - PA7
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_7;
engineConfiguration->canReadEnabled = false;
engineConfiguration->canWriteEnabled = true;
CONFIG(enableVerboseCanTx) = true;
#endif /* EFI_CANBUS_SLAVE */
// do I have VR wires flipped?
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;
CONFIG(crankingTimingAngle) = 15;
// I am too lazy to add MAP sensor
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
// set cranking_fuel 15
engineConfiguration->cranking.baseFuel = 15;
//set tps_min 891
CONFIG(tpsMin) = 891;
//set tps_max 177

View File

@ -196,8 +196,6 @@ void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation
engineConfiguration->triggerSimulatorFrequency = 300;
engineConfiguration->cranking.rpm = 100;
@ -313,8 +311,6 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
engineConfiguration->directSelfStimulation = true;
#if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG
engineConfiguration->ignitionPins[0] = GPIOG_3;
engineConfiguration->ignitionPins[1] = GPIOG_4;
@ -349,11 +345,11 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// SF PF11
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
#if EFI_FSIO
setFsio(12, GPIOF_12, "0" PASS_CONFIG_PARAMETER_SUFFIX);
setFsio(14, GPIOF_13, "1" PASS_CONFIG_PARAMETER_SUFFIX);
#endif /* EFI_FSIO */
CONFIG(etbIo[0].directionPin1) = GPIOF_15;
CONFIG(etbIo[0].directionPin2) = GPIOF_14;
CONFIG(etbIo[0].disablePin) = GPIOF_12;
#endif /* STM32_HAS_GPIOF */
CONFIG(etb_use_two_wires) = true;
engineConfiguration->isHip9011Enabled = false;
@ -365,11 +361,11 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// IN2 PE4
// SF PE3
#if EFI_FSIO
setFsio(13, GPIOE_5, "0" PASS_CONFIG_PARAMETER_SUFFIX);
setFsio(15, GPIOE_6, "1" PASS_CONFIG_PARAMETER_SUFFIX);
#endif
CONFIG(etbIo[0].directionPin1) = GPIOE_2;
CONFIG(etbIo[0].directionPin2) = GPIOE_4;
CONFIG(etbIo[0].disablePin) = GPIOE_5;
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3; // PA3
@ -403,8 +399,6 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
*/
void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0)
engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation
engineConfiguration->debugMode = DBG_TLE8888;
engineConfiguration->triggerSimulatorFrequency = 60;
@ -528,13 +522,25 @@ void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// default spi3sckPin PB3
CONFIG(triggerSimulatorPins[0]) = GPIO_UNASSIGNED;
CONFIG(triggerSimulatorPins[1]) = GPIO_UNASSIGNED;
CONFIG(triggerSimulatorPins[2]) = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[0] = GPIOB_9; // #1
engineConfiguration->injectionPins[1] = GPIOE_2; // #2
engineConfiguration->injectionPins[2] = GPIOB_8; // #3
engineConfiguration->injectionPins[3] = GPIOB_7; // #4
// blue
CONFIG(mc33816_cs) = GPIOD_7;
// green
CONFIG(mc33816_rstb) = GPIOD_5;
CONFIG(mc33816_rstb) = GPIOD_4;
// yellow
CONFIG(mc33816_driven) = GPIOD_6;
CONFIG(mc33816_flag0) = GPIOD_3;
// enable_spi 3
CONFIG(is_enabled_spi_3) = true;
// Wire up spi3
@ -544,5 +550,7 @@ void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
CONFIG(isSdCardEnabled) = false;
CONFIG(mc33_hvolt) = 63;
CONFIG(mc33816spiDevice) = SPI_DEVICE_3;
}

View File

@ -265,12 +265,6 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.displacement = 1.996;
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->biQuad.a0 = 0.0000024635293743901;
engineConfiguration->biQuad.a1 = 0.00000492705874878021;
engineConfiguration->biQuad.a2 = 0.0000024635293743901;
engineConfiguration->biQuad.b1 = -1.9968534854;
engineConfiguration->biQuad.b2 = 0.9968633396;
/**
* 77C
* 1200 rpm

View File

@ -5,15 +5,19 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_MAZDA_MIATA_1_6_H_
#define CONFIG_ENGINES_MAZDA_MIATA_1_6_H_
#pragma once
#include "engine_configuration.h"
/**
* set engine_type 57
*/
void setMiataNA6_VAF_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE);
/**
* set engine_type 41
*/
void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void miataNAcommon(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_MAZDA_MIATA_1_6_H_ */

View File

@ -195,8 +195,6 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setCommonNTCSensor(&engineConfiguration->clt, 2700);
setCommonNTCSensor(&engineConfiguration->iat, 2700);
engineConfiguration->nbVvtIndex = 0;
engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control
// set idle_position 35
@ -273,7 +271,11 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set_whole_ve_map 80
setMazdaMiataNbInjectorLag(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->debugMode = DBG_IDLE_CONTROL;
CONFIG(debugTriggerSync) = GPIOD_3;
// engineConfiguration->debugMode = DBG_IDLE_CONTROL;
engineConfiguration->debugMode = DBG_TRIGGER_COUNTERS;
//set idle_offset 30
engineConfiguration->idleRpmPid.offset = 30;
engineConfiguration->idleRpmPid.pFactor = 0.07;
@ -396,7 +398,10 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// see setDefaultIdleParameters
engineConfiguration->adcVcc = 3.3f;
engineConfiguration->vbattDividerCoeff = 9.70f;
engineConfiguration->vbattDividerCoeff = 8.80f;
engineConfiguration->displayLogicLevelsInEngineSniffer = true;
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
// by the way NB2 MAF internal diameter is about 2.5 inches / 63mm
// 1K pull-down to read current from this MAF
@ -420,7 +425,6 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; // PC3 blue
engineConfiguration->idleMode = IM_AUTO;
CONFIG(useETBforIdleControl) = true;
// set_analog_input_pin pps PA2
/* a step back - Frankenso does not use ETB
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_2;
@ -461,8 +465,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
config->crankingFuelCoef[7] = 10;
config->crankingFuelBins[7] = 90;
// engineConfiguration->crankingIACposition = 65;
engineConfiguration->crankingIACposition = 90;
}
/**
@ -500,7 +503,11 @@ static void setMiataNB2_MRE_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->camInputs[0] = GPIOA_5;
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
engineConfiguration->useTLE8888_hall_mode = true;
/**
* By default "auto detection mode for VR sensor signals" is used
* We know that for short & strange Hall (?) signals like Miata NB2 crank sensor this does not work well above certain RPM.
*/
engineConfiguration->tle8888mode = TL_MANUAL;
// GPIOD_6: "13 - GP Out 6" - selected to +12v
engineConfiguration->alternatorControlPin = GPIOD_6;
@ -559,6 +566,8 @@ static void setMiataNB2_MRE_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setMiataNB2_MRE_ETB(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMiataNB2_MRE_common(PASS_CONFIG_PARAMETER_SIGNATURE);
CONFIG(useETBforIdleControl) = true;
#if EFI_FSIO
// enable ETB
// set_rpn_expression 8 "0"

View File

@ -14,9 +14,22 @@
void setMazdaMiataNbInjectorLag(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMazdaMiataNbTpsTps(DECLARE_CONFIG_PARAMETER_SIGNATURE);
/**
* Primary rusEfi test mule https://rusefi.com/forum/viewtopic.php?f=3&t=1095
* MAZDA_MIATA_2003
* set engine_type 47
*/
void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
/**
* race car - NA body and fuel system with NB2 engine
*/
void setMazdaMiata2003EngineConfigurationNaFuelRail(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiataNB2_MRE_ETB(DECLARE_CONFIG_PARAMETER_SIGNATURE);
/**
* OEM mechanical throttle body
* set engine_type 11
*/
void setMiataNB2_MRE_MTB(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -7,18 +7,19 @@
#include "me7pnp.h"
#include "global.h"
#include "engine.h"
#include "engine_math.h"
#include "allsensors.h"
#include "fsio_impl.h"
#include "engine_configuration.h"
#include "smart_gpio.h"
#include "cj125.h"
EXTERN_ENGINE
;
EXTERN_ENGINE;
void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
/**
* set engine_type 102
*/
void vag_18_Turbo(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
//Base Engine Settings
@ -56,8 +57,6 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
engineConfiguration->vbattAdcChannel = EFI_ADC_4;
engineConfiguration->vbattDividerCoeff = ((float) (10.0 + 33)) / 10 * 2;
engineConfiguration->cj125ur = EFI_ADC_11;
engineConfiguration->cj125ua = EFI_ADC_12;
engineConfiguration->mafAdcChannel = EFI_ADC_8;
//CAN Settings
@ -65,7 +64,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->canNbcType = CAN_BUS_NBC_VAG;
engineConfiguration->canReadEnabled = true;
engineConfiguration->canWriteEnabled = true;
engineConfiguration->canDeviceMode = CD_USE_CAN1;
engineConfiguration->canTxPin = GPIOB_6;
engineConfiguration->canRxPin = GPIOB_12;
@ -93,9 +92,10 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
//SPI Settings
engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->is_enabled_spi_2 = true;
engineConfiguration->is_enabled_spi_3 = false;
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
cj125defaultPinout(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->cj125ur = EFI_ADC_11;
engineConfiguration->cj125CsPin = GPIOB_11;
//Digital Inputs/Outputs
@ -114,10 +114,10 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->brakePedalPin = GPIOE_10;
engineConfiguration->camInputs[0] = GPIOA_2;
#if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG
engineConfiguration->triggerInputPins[0] = GPIOG_7;
// engineConfiguration->triggerInputPins[0] = GPIOG_7;
#endif /* STM32_HAS_GPIOF */
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
engineConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
// engineConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
#endif /* STM32_HAS_GPIOF */
@ -134,7 +134,6 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_FSIO
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
setFsio (12, GPIOF_12, "0" PASS_CONFIG_PARAMETER_SUFFIX);
setFsio (14, GPIOF_13, "1" PASS_CONFIG_PARAMETER_SUFFIX);
#endif /* STM32_HAS_GPIOF */
setFsioExt (3, GPIOE_0, "0.15 90 coolant 120 min max 90 - 30 / 0.8 * +", 25 PASS_CONFIG_PARAMETER_SUFFIX);
@ -144,15 +143,16 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
CONFIG(etbIo[0].directionPin1) = GPIOF_15;
CONFIG(etbIo[0].directionPin2) = GPIOF_14;
CONFIG(etbIo[0].disablePin) = GPIOF_12;
#endif /* STM32_HAS_GPIOF */
engineConfiguration->isHip9011Enabled = false;
#if EFI_FSIO
setFsio (13, GPIOE_5, "0" PASS_CONFIG_PARAMETER_SUFFIX);
setFsio (15, GPIOE_6, "1" PASS_CONFIG_PARAMETER_SUFFIX);
#endif
CONFIG(etbIo[1].directionPin1) = GPIOE_2;
CONFIG(etbIo[1].directionPin2) = GPIOE_4;
CONFIG(etbIo[1].disablePin) = GPIOE_5;
engineConfiguration->etb.pFactor = 1.07;
engineConfiguration->etb.iFactor = 0.18;

View File

@ -1,15 +1,13 @@
/*
* me7pnp.h
* @file me7pnp.h
*
* Created on: 1. mai 2019
* Author: Ola
*/
#ifndef CONFIG_ENGINES_ME7PNP_H_
#define CONFIG_ENGINES_ME7PNP_H_
#pragma once
#include "engine_configuration.h"
void vag_18_Turbo(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_ME7PNP_H_ */

View File

@ -4,11 +4,10 @@
* @date Aug 5, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef MITSUBISHI_H_
#define MITSUBISHI_H_
#pragma once
#include "engine_configuration.h"
void setMitsubishiConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* MITSUBISHI_H_ */

View File

@ -4,12 +4,9 @@
* @date Jun 27, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef ROVER_V8_H_
#define ROVER_V8_H_
#pragma once
#include "engine_configuration.h"
void setFrankenstein_01_LCD(engine_configuration_s *engineConfiguration);
void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* ROVER_V8_H_ */

View File

@ -4,11 +4,9 @@
* @date Jan 26, 2015
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_SACHS_H_
#define CONFIG_ENGINES_SACHS_H_
#pragma once
#include "engine_configuration.h"
void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_SACHS_H_ */

View File

@ -4,12 +4,8 @@
* @date Sep 14, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef SUBARU_H_
#define SUBARU_H_
#include "engine_configuration.h"
void setSubaru2003Wrx(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setSubaruEJ20GDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* SUBARU_H_ */

View File

@ -15,6 +15,7 @@
EXTERN_CONFIG;
// VW_ABA
void setVwAba(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);

View File

@ -762,9 +762,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
* so that it would not crash the error handler in case of stack issues
*/
#if CH_DBG_SYSTEM_STATE_CHECK
#define hasFatalError() (ch.dbg.panic_msg != NULL)
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
#else
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#endif

View File

@ -12,6 +12,9 @@
#define EFI_GPIO_HARDWARE TRUE
#define EFI_BOOST_CONTROL TRUE
#define EFI_LAUNCH_CONTROL FALSE
#define EFI_FSIO TRUE
#ifndef EFI_CDM_INTEGRATION
@ -143,12 +146,6 @@
#define BOARD_TLE8888_COUNT 1
#endif
// todo: move this outside of efifeatures.h
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
// todo: move this outside of efifeatures.h
#define BOARD_EXT_PINREPOPINS 24
#define EFI_ANALOG_SENSORS TRUE
#ifndef EFI_MAX_31855
@ -287,10 +284,8 @@
// todo: most of this should become configurable
// todo: switch to continues ADC conversion for slow ADC?
// https://github.com/rusefi/rusefi/issues/630
// todo: switch to continues ADC conversion for fast ADC?
#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4
#define EFI_INTERNAL_FAST_ADC_GPT &GPTD6
#define EFI_SPI1_AF 5

View File

@ -30,6 +30,20 @@
#include "mcuconf.h"
/* THIS IS HACK: to allow smooth transition to ChibiOS with ELF support we
* need to disable hal_flash.h until we move to ChibiOS EFL driver.
* hal_flash.h in ChibiOS has definitions that conflict with current RusEFI
* flash driver.
* but it is included unconditionaly from hal.h */
#define HAL_FLASH_H
/**
* @brief Enables the FLASH subsystem.
*/
#if !defined(HAL_USE_FLASH) || defined(__DOXYGEN__)
#define HAL_USE_FLASH FALSE
#endif
/**
* @brief Enables the PAL subsystem.
*/
@ -120,7 +134,7 @@
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM TRUE
#define HAL_USE_PWM FALSE
#endif
/**

View File

@ -180,7 +180,7 @@
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 FALSE
#define STM32_GPT_USE_TIM5 TRUE
#define STM32_GPT_USE_TIM6 FALSE
#define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM9 FALSE
@ -272,9 +272,7 @@
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
// maybe even swithc this one to software timer?
// todo: https://github.com/rusefi/rusefi/issues/630 ?
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM9 FALSE

View File

@ -764,9 +764,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
* so that it would not crash the error handler in case of stack issues
*/
#if CH_DBG_SYSTEM_STATE_CHECK
#define hasFatalError() (ch.dbg.panic_msg != NULL)
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
#else
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#endif

View File

@ -50,8 +50,6 @@
#define BOARD_TLE8888_COUNT 1
#endif
// todo: move this outside of efifeatures.h
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
#undef EFI_CAN_SUPPORT

View File

@ -30,6 +30,20 @@
#include "mcuconf.h"
/* THIS IS HACK: to allow smooth transition to ChibiOS with ELF support we
* need to disable hal_flash.h until we move to ChibiOS EFL driver.
* hal_flash.h in ChibiOS has definitions that conflict with current RusEFI
* flash driver.
* but it is included unconditionaly from hal.h */
#define HAL_FLASH_H
/**
* @brief Enables the FLASH subsystem.
*/
#if !defined(HAL_USE_FLASH) || defined(__DOXYGEN__)
#define HAL_USE_FLASH FALSE
#endif
/**
* @brief Enables the PAL subsystem.
*/
@ -111,7 +125,7 @@
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM TRUE
#define HAL_USE_PWM FALSE
#endif
/**

View File

@ -201,7 +201,7 @@
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 FALSE
#define STM32_GPT_USE_TIM5 TRUE
#define STM32_GPT_USE_TIM6 FALSE
#define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM9 FALSE
@ -283,7 +283,7 @@
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM9 FALSE

View File

@ -34,8 +34,7 @@ static thread_reference_t btThreadRef = nullptr; // used by thread suspend/resum
static LoggingWithStorage btLogger("bluetooth");
EXTERN_ENGINE
;
EXTERN_ENGINE;
// Main communication code

View File

@ -5,9 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef BLUETOOTH_H_
#define BLUETOOTH_H_
#pragma once
#include "global.h"
#include "tunerstudio_io.h"
@ -44,4 +42,3 @@ void bluetoothCancel(void);
*/
void bluetoothSoftwareDisconnectNotify();
#endif /* BLUETOOTH_H_ */

View File

@ -80,7 +80,7 @@
#include <string.h>
#include "engine_configuration.h"
#include "injector_central.h"
#include "bench_test.h"
#include "svnversion.h"
#include "loggingcentral.h"
#include "status_loop.h"
@ -89,7 +89,7 @@
#if EFI_SIMULATOR
#include "rusEfiFunctionalTest.h"
#endif
#endif /* EFI_SIMULATOR */
#if EFI_TUNER_STUDIO
@ -103,8 +103,7 @@
#endif /* EFI_IDLE_CONTROL */
EXTERN_ENGINE
;
EXTERN_ENGINE;
extern persistent_config_container_s persistentState;
@ -469,7 +468,8 @@ static bool isKnownCommand(char command) {
|| command == TS_CRC_CHECK_COMMAND
|| command == TS_GET_FIRMWARE_VERSION
|| command == TS_PERF_TRACE_BEGIN
|| command == TS_PERF_TRACE_GET_BUFFER;
|| command == TS_PERF_TRACE_GET_BUFFER
|| command == TS_GET_CONFIG_ERROR;
}
// this function runs indefinitely
@ -845,6 +845,9 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
break;
#endif /* ENABLE_PERF_TRACE */
case TS_GET_CONFIG_ERROR:
sr5SendResponse(tsChannel, TS_CRC, reinterpret_cast<const uint8_t*>(getFirmwareError()), strlen(getFirmwareError()));
break;
default:
tunerStudioError("ERROR: ignoring unexpected command");
return false;

View File

@ -5,9 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef TUNERSTUDIO_H_
#define TUNERSTUDIO_H_
#pragma once
#include "global.h"
#include "tunerstudio_io.h"
@ -106,5 +104,3 @@ typedef pre_packed struct
} TunerStudioWriteValueRequest;
#endif /* EFI_TUNER_STUDIO */
#endif /* TUNERSTUDIO_H_ */

View File

@ -18,6 +18,16 @@ typedef struct {
uint16_t values[EGT_CHANNEL_COUNT];
} egt_values_s;
enum class TsCalMode : uint8_t {
None = 0,
Tps1Max = 1,
Tps1Min = 2,
EtbKp = 3,
EtbKi = 4,
EtbKd = 5,
};
/**
* At the moment rusEfi does NOT have any code generation around TS output channels, three locations have to be changed manually
* 1) this TunerStudioOutputChannels firmware version of the structure
@ -57,10 +67,11 @@ typedef struct {
unsigned int isIatError : 1; // bit 21
unsigned int isAcSwitchEngaged : 1; // bit 22
unsigned int isTriggerError : 1; // bit 23
unsigned int hasFatalError : 1; // bit 24
unsigned int hasCriticalError : 1; // bit 24
unsigned int isWarnNow : 1; // bit 25
unsigned int unused80b8 : 1; // bit 26
unsigned int isPedalError : 1; // bit 26
unsigned int isKnockChipOk : 1; // bit 27
unsigned int launchTriggered : 1; // bit 28
// RPM, vss
scaled_channel<uint16_t> rpm; // 4
@ -151,15 +162,29 @@ typedef struct {
uint32_t firmwareVersion; // 120
uint32_t tsConfigVersion; // 124
// These two fields indicate to TS that we'd like to set a particular field to a particular value
// We use a maintainConstantValue in TS for each field we'd like to set, like this:
// maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax }
// maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin }
// When the mode is set to a particular value, TS will copy the calibrationValue in to the specified field.
//
// With this simple construct, the ECU can send any number of internally computed configuration fields
// back to TunerStudio, getting around the problem of setting values on the controller without TS's knowledge.
// The ECU simply has to sequentially set a mode/value, wait briefly, then repeat until all the values
// it wants to send have been sent.
float calibrationValue; // 128
TsCalMode calibrationMode; // 132
uint8_t padding[3]; // 133-135
// Errors
int totalTriggerErrorCounter; // 128
int orderingErrorCounter; // 132
int16_t warningCounter; // 136
int16_t lastErrorCode; // 138
int16_t recentErrorCodes[8]; // 140
int totalTriggerErrorCounter; // 136
int orderingErrorCounter; // 140
int16_t warningCounter; // 144
int16_t lastErrorCode; // 146
int16_t recentErrorCodes[8]; // 148-162
// Debug
float debugFloatField1; // 156
float debugFloatField1; // 164
float debugFloatField2;
float debugFloatField3;
float debugFloatField4;
@ -170,17 +195,24 @@ typedef struct {
int debugIntField2;
int debugIntField3;
int16_t debugIntField4;
int16_t debugIntField5; // 198
int16_t debugIntField5; // 206
// accelerometer
int16_t accelerationX; // 200
int16_t accelerationY; // 202
int16_t accelerationX; // 208
int16_t accelerationY; // 210
// EGT
egt_values_s egtValues; // 204
scaled_percent throttle2Position; // 220
egt_values_s egtValues; // 212
uint8_t unusedAtTheEnd[18]; // we have some unused bytes to allow compatible TS changes
scaled_percent throttle2Position; // 228
scaled_voltage rawTps1Primary; // 230
scaled_voltage rawPpsPrimary; // 232
scaled_voltage rawClt; // 234
scaled_voltage rawIat; // 236
scaled_voltage rawOilPressure; // 238
uint8_t unusedAtTheEnd[4]; // we have some unused bytes to allow compatible TS changes
// Temporary - will remove soon
TsDebugChannels* getDebugChannels() {

View File

@ -5,11 +5,10 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "global.h"
#include "engine.h"
#include "os_access.h"
#include "tunerstudio_io.h"
#include "console_io.h"
#include "engine.h"
#if EFI_SIMULATOR
#include "rusEfiFunctionalTest.h"
#endif

View File

@ -4,9 +4,8 @@
* @date Mar 8, 2015
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONSOLE_TUNERSTUDIO_TUNERSTUDIO_IO_H_
#define CONSOLE_TUNERSTUDIO_TUNERSTUDIO_IO_H_
#pragma once
#include "global.h"
#if EFI_PROD_CODE
@ -68,6 +67,7 @@ typedef struct {
#define TS_PAGE_COMMAND 'P' // 0x50
#define TS_COMMAND_F 'F' // 0x46
#define TS_GET_FIRMWARE_VERSION 'V' // versionInfo
#define TS_GET_CONFIG_ERROR 'e' // returns getFirmwareError()
// High speed logger commands
#define TS_SET_LOGGER_MODE 'l'
@ -108,4 +108,3 @@ int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size);
int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int timeout);
bool sr5IsReady(ts_channel_s *tsChannel);
#endif /* CONSOLE_TUNERSTUDIO_TUNERSTUDIO_IO_H_ */

View File

@ -18,7 +18,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "global.h"
#include "engine.h"
#include "console_io.h"
#include "os_util.h"
@ -39,9 +38,6 @@ extern SerialUSBDriver SDU1;
// 10 seconds
#define CONSOLE_WRITE_TIMEOUT 10000
int lastWriteSize;
int lastWriteActual;
static bool isSerialConsoleStarted = false;
static event_listener_t consoleEventListener;
@ -253,11 +249,8 @@ void consolePutChar(int x) {
}
void consoleOutputBuffer(const uint8_t *buf, int size) {
lastWriteSize = size;
#if !EFI_UART_ECHO_TEST_MODE
lastWriteActual = chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT);
// if (r != size)
// firmwareError(OBD_PCM_Processor_Fault, "Partial console write");
chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT);
#endif /* EFI_UART_ECHO_TEST_MODE */
}

View File

@ -4,9 +4,8 @@
* @date Dec 29, 2012
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONSOLE_IO_H_
#define CONSOLE_IO_H_
#pragma once
#ifdef __cplusplus
extern "C"
{
@ -42,4 +41,3 @@ bool isCommandLineConsoleReady(void);
#define isCommandLineConsoleReady() true
#endif
#endif /* CONSOLE_IO_H_ */

View File

@ -29,7 +29,7 @@
static LoggingWithStorage logger("console");
static void myfatal(void) {
static void testCritical(void) {
chDbgCheck(0);
}
@ -46,11 +46,18 @@ static void sayNothing(void) {
}
static void sayHello(void) {
scheduleMsg(&logger, "*** rusEFI (c) Andrey Belomutskiy 2012-2019. All rights reserved.");
scheduleMsg(&logger, "*** rusEFI LLC (c) 2012-2020. All rights reserved.");
scheduleMsg(&logger, "rusEFI v%d@%s", getRusEfiVersion(), VCS_VERSION);
scheduleMsg(&logger, "*** Chibios Kernel: %s", CH_KERNEL_VERSION);
scheduleMsg(&logger, "*** Compiled: " __DATE__ " - " __TIME__ "");
scheduleMsg(&logger, "COMPILER=%s", __VERSION__);
#if defined(STM32F4) || defined(STM32F7)
uint32_t *uid = ((uint32_t *)UID_BASE);
scheduleMsg(&logger, "UID=%x %x %x", uid[0], uid[1], uid[2]);
#endif
#ifdef CH_FREQUENCY
scheduleMsg(&logger, "CH_FREQUENCY=%d", CH_FREQUENCY);
#endif
@ -183,7 +190,7 @@ void initializeConsole(Logging *sharedLogger) {
addConsoleAction("reset", scheduleReset);
#endif
addConsoleAction("fatal", myfatal);
addConsoleAction("critical", testCritical);
addConsoleAction("error", myerror);
addConsoleAction("threadsinfo", cmd_threads);
}

View File

@ -6,12 +6,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef RFICONSOLE_H_
#define RFICONSOLE_H_
#pragma once
#include "datalogging.h"
void initializeConsole(Logging *sharedLogger);
void print(const char *fmt, ...);
#endif /* RFICONSOLE_H_ */

View File

@ -102,7 +102,6 @@ extern WaveChart waveChart;
int warningEnabled = true;
extern bool hasFirmwareErrorFlag;
extern int maxTriggerReentraint;
extern uint32_t maxLockedDuration;
@ -172,8 +171,7 @@ static void reportSensorI(Logging *log, const char *caption, const char *units,
#endif /* EFI_FILE_LOGGING */
}
EXTERN_ENGINE
;
EXTERN_ENGINE;
static char buf[6];
@ -206,18 +204,7 @@ static void printSensors(Logging *log) {
#endif
// why do we still send data into console in text mode?
if (hasCltSensor()) {
reportSensorF(log, "CLT", "C", getCoolantTemperature(), 2); // log column #4
}
SensorResult tps = Sensor::get(SensorType::Tps1);
if (tps) {
reportSensorF(log, "TPS", "%", tps.Value, 2); // log column #5
}
if (hasIatSensor()) {
reportSensorF(log, "IAT", "C", getIntakeAirTemperature(), 2); // log column #7
}
Sensor::showAllSensorInfo(log);
if (hasVBatt(PASS_ENGINE_PARAMETER_SIGNATURE)) {
reportSensorF(log, GAUGE_NAME_VBAT, "V", getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE), 2); // log column #6
@ -323,24 +310,20 @@ static void printSensors(Logging *log) {
reportSensorF(log, GAUGE_NAME_TIMING_ADVANCE, "deg", engine->engineState.timingAdvance, 2);
if (hasPedalPositionSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
// 136
reportSensorF(log, GAUGE_NAME_THROTTLE_PEDAL, "%", getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE), 2);
}
reportSensorF(log, GAUGE_NAME_THROTTLE_PEDAL, "%", Sensor::get(SensorType::AcceleratorPedal).value_or(0), 2);
floatms_t fuelBase = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX);
reportSensorF(log, GAUGE_NAME_FUEL_BASE, "ms", fuelBase, 2);
reportSensorF(log, GAUGE_NAME_FUEL_LAST_INJECTION, "ms", ENGINE(actualLastInjection), 2);
reportSensorF(log, GAUGE_NAME_INJECTOR_LAG, "ms", engine->engineState.running.injectorLag, 2);
reportSensorF(log, GAUGE_NAME_FUEL_RUNNING, "ms", ENGINE(engineState.running.fuel), 2);
// 268
reportSensorF(log, GAUGE_NAME_FUEL_PID_CORR, "ms", ENGINE(engineState.running.pidCorrection), 2);
floatms_t fuelBase = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX);
reportSensorF(log, GAUGE_NAME_FUEL_BASE, "ms", fuelBase, 2);
reportSensorF(log, GAUGE_NAME_FUEL_LAST_INJECTION, "ms", ENGINE(actualLastInjection), 2);
reportSensorF(log, GAUGE_NAME_INJECTOR_LAG, "ms", engine->engineState.running.injectorLag, 2);
reportSensorF(log, GAUGE_NAME_FUEL_RUNNING, "ms", ENGINE(engineState.running.fuel), 2);
// 268
reportSensorF(log, GAUGE_NAME_FUEL_PID_CORR, "ms", ENGINE(engineState.running.pidCorrection), 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_AMOUNT, "v", ENGINE(wallFuel[0]).getWallFuel(), 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_CORRECTION, "v", ENGINE(wallFuel[0]).wallFuelCorrection, 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_AMOUNT, "v", ENGINE(wallFuel[0]).getWallFuel(), 2);
reportSensorF(log, GAUGE_NAME_FUEL_WALL_CORRECTION, "v", ENGINE(wallFuel[0]).wallFuelCorrection, 2);
reportSensorI(log, GAUGE_NAME_VERSION, "#", getRusEfiVersion());
reportSensorI(log, GAUGE_NAME_VERSION, "#", getRusEfiVersion());
#if EFI_VEHICLE_SPEED
if (hasVehicleSpeedSensor()) {
@ -370,9 +353,6 @@ static void printSensors(Logging *log) {
reportSensorF(log, GAUGE_NAME_DWELL_DUTY, "%", getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX), 2);
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
for (int i = 0;i<FSIO_ANALOG_INPUT_COUNT;i++) {
if (engineConfiguration->fsioAdc[i] != EFI_ADC_NONE) {
strcpy(buf, "adcX");
@ -498,7 +478,7 @@ void updateDevConsoleState(void) {
#if EFI_PROD_CODE
// todo: unify with simulator!
if (hasFirmwareError()) {
scheduleMsg(&logger, "FATAL error: %s", getFirmwareError());
scheduleMsg(&logger, "%s error: %s", CRITICAL_PREFIX, getFirmwareError());
warningEnabled = false;
scheduleLogging(&logger);
return;
@ -585,14 +565,12 @@ static OutputPin *leds[] = { &enginePins.warningLedPin, &enginePins.runningLedPi
static void initStatusLeds(void) {
enginePins.communicationLedPin.initPin("led: comm status", engineConfiguration->communicationLedPin);
// we initialize this here so that we can blink it on start-up
enginePins.checkEnginePin.initPin("MalfunctionIndicator", CONFIG(malfunctionIndicatorPin), &CONFIG(malfunctionIndicatorPinMode));
enginePins.checkEnginePin.initPin("Check engine light", CONFIG(malfunctionIndicatorPin), &CONFIG(malfunctionIndicatorPinMode));
enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warningLedPin);
enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin);
enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync));
enginePins.debugTimerCallback.initPin("debug: timer callback", CONFIG(debugTimerCallback));
enginePins.debugSetTimer.initPin("debug: set timer", CONFIG(debugSetTimer));
}
#define BLINKING_PERIOD_MS 33
@ -617,8 +595,8 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
}
void setAllLeds(int value) {
// make sure we do not turn the fatal LED off if already have
// fatal error by now
// make sure we do not turn the critical LED off if already have
// critical error by now
for (uint32_t i = 0; !hasFirmwareError() && i < sizeof(leds) / sizeof(leds[0]); i++) {
leds[i]->setValue(value);
}
@ -637,9 +615,9 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
enginePins.warningLedPin.setValue(0);
} else {
if (hasFirmwareError()) {
// special behavior in case of fatal error - not equal on/off time
// special behavior in case of critical error - not equal on/off time
// this special behaviour helps to notice that something is not right, also
// differentiates software firmware error from fatal interrupt error with CPU halt.
// differentiates software firmware error from critical interrupt error with CPU halt.
offTimeMs = 50;
onTimeMs = 450;
} else {
@ -709,9 +687,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
executorStatistics();
#endif /* EFI_PROD_CODE */
float coolant = getCoolantTemperature();
float intake = getIntakeAirTemperature();
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
// header
@ -719,10 +694,20 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
// offset 0
tsOutputChannels->rpm = rpm;
// offset 4
tsOutputChannels->coolantTemperature = coolant;
// offset 8
tsOutputChannels->intakeAirTemperature = intake;
SensorResult clt = Sensor::get(SensorType::Clt);
tsOutputChannels->coolantTemperature = clt.Value;
tsOutputChannels->isCltError = !clt.Valid;
SensorResult iat = Sensor::get(SensorType::Iat);
tsOutputChannels->intakeAirTemperature = iat.Value;
tsOutputChannels->isIatError = !iat.Valid;
SensorResult auxTemp1 = Sensor::get(SensorType::AuxTemp1);
tsOutputChannels->auxTemp1 = auxTemp1.Value;
SensorResult auxTemp2 = Sensor::get(SensorType::AuxTemp2);
tsOutputChannels->auxTemp2 = auxTemp2.Value;
SensorResult tps1 = Sensor::get(SensorType::Tps1);
tsOutputChannels->throttlePosition = tps1.Value;
@ -732,6 +717,17 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
SensorResult tps2 = Sensor::get(SensorType::Tps2);
tsOutputChannels->throttle2Position = tps2.Value;
SensorResult pedal = Sensor::get(SensorType::AcceleratorPedal);
tsOutputChannels->pedalPosition = pedal.Value;
// Only report fail if you have one (many people don't)
tsOutputChannels->isPedalError = !pedal.Valid && Sensor::hasSensor(SensorType::AcceleratorPedal);
// Set raw sensors
tsOutputChannels->rawTps1Primary = Sensor::getRaw(SensorType::Tps1);
tsOutputChannels->rawPpsPrimary = Sensor::getRaw(SensorType::AcceleratorPedal);
tsOutputChannels->rawClt = Sensor::getRaw(SensorType::Clt);
tsOutputChannels->rawIat = Sensor::getRaw(SensorType::Iat);
tsOutputChannels->rawOilPressure = Sensor::getRaw(SensorType::OilPressure);
// offset 16
tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMafVoltage(PASS_ENGINE_PARAMETER_SIGNATURE) : 0;
@ -742,10 +738,10 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
}
// offset 24
tsOutputChannels->engineLoad = engineLoad;
if (hasVBatt(PASS_ENGINE_PARAMETER_SIGNATURE)) {
// offset 28
tsOutputChannels->vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
}
// KLUDGE? we always show VBatt because Proteus board has VBatt input sensor hardcoded
// offset 28
tsOutputChannels->vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
// offset 36
#if EFI_ANALOG_SENSORS
@ -771,8 +767,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->orderingErrorCounter = engine->triggerCentral.triggerState.orderingErrorCounter;
// 68
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
// 136
tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_SIGNATURE) ? getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE) : 0;
// 140
#if EFI_ENGINE_CONTROL
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX);
@ -828,13 +822,16 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->knockCount = engine->knockCount;
tsOutputChannels->knockLevel = engine->knockVolts;
tsOutputChannels->hasFatalError = hasFirmwareError();
tsOutputChannels->hasCriticalError = hasFirmwareError();
tsOutputChannels->isWarnNow = engine->engineState.warnings.isWarningNow(timeSeconds, true);
#if EFI_HIP_9011
tsOutputChannels->isKnockChipOk = (instance.invalidHip9011ResponsesCount == 0);
#endif /* EFI_HIP_9011 */
#if EFI_LAUNCH_CONTROL
tsOutputChannels->launchTriggered = engine->isLaunchCondition;
#endif
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
// engine load acceleration
@ -885,9 +882,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
#endif /* EFI_VEHICLE_SPEED */
#endif /* EFI_PROD_CODE */
tsOutputChannels->isCltError = !hasCltSensor();
tsOutputChannels->isIatError = !hasIatSensor();
tsOutputChannels->fuelConsumptionPerHour = engine->engineState.fuelConsumption.perSecondConsumption;
tsOutputChannels->warningCounter = engine->engineState.warnings.warningCounter;
@ -918,10 +912,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
#endif // EFI_ENGINE_CONTROL
switch (engineConfiguration->debugMode) {
case DBG_AUX_TEMPERATURE:
// // 68
tsOutputChannels->debugFloatField1 = engine->sensors.auxTemp1;
tsOutputChannels->debugFloatField2 = engine->sensors.auxTemp2;
case DBG_START_STOP:
tsOutputChannels->debugIntField1 = engine->startStopStateToggleCounter;
break;
case DBG_STATUS:
tsOutputChannels->debugFloatField1 = timeSeconds;
@ -950,16 +942,21 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
case DBG_TRIGGER_COUNTERS:
tsOutputChannels->debugIntField1 = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_FALLING);
tsOutputChannels->debugIntField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_FALLING);
tsOutputChannels->debugIntField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_FALLING);
// no one uses shaft so far tsOutputChannels->debugIntField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_FALLING);
#if EFI_PROD_CODE && HAL_USE_ICU == TRUE
tsOutputChannels->debugIntField3 = icuRisingCallbackCounter + icuFallingCallbackCounter;
tsOutputChannels->debugIntField4 = engine->triggerCentral.vvtEventRiseCounter;
tsOutputChannels->debugIntField5 = engine->triggerCentral.vvtEventFallCounter;
tsOutputChannels->debugFloatField5 = icuRisingCallbackCounter + icuFallingCallbackCounter;
#endif /* EFI_PROD_CODE */
tsOutputChannels->debugFloatField1 = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_RISING);
tsOutputChannels->debugFloatField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_RISING);
tsOutputChannels->debugFloatField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_RISING);
tsOutputChannels->debugIntField4 = engine->triggerCentral.triggerState.currentCycle.eventCount[0];
tsOutputChannels->debugIntField5 = engine->triggerCentral.triggerState.currentCycle.eventCount[1];
// debugFloatField6 used
// no one uses shaft so far tsOutputChannels->debugFloatField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_RISING);
break;
case DBG_FSIO_ADC:
// todo: implement a proper loop

View File

@ -11,47 +11,116 @@
#if EFI_TOOTH_LOGGER
EXTERN_ENGINE;
#include <cstddef>
#include "efitime.h"
#include "efilib.h"
#include "tunerstudio_configuration.h"
static uint16_t buffer[1000] CCM_OPTIONAL;
typedef struct __attribute__ ((packed)) {
uint16_t timestamp;
} tooth_logger_s;
typedef struct __attribute__ ((packed)) {
// the whole order of all packet bytes is reversed, not just the 'endian-swap' integers
uint32_t timestamp;
// unfortunately all these fields are required by TS...
bool priLevel : 1;
bool secLevel : 1;
bool trigger : 1;
bool sync : 1;
} composite_logger_s;
static composite_logger_s buffer[COMPOSITE_PACKET_COUNT] CCM_OPTIONAL;
static size_t NextIdx = 0;
static volatile bool ToothLoggerEnabled = false;
static uint32_t lastEdgeTimestamp = 0;
void SetNextEntry(uint16_t entry) {
static bool trigger1 = false;
static bool trigger2 = false;
//char (*__kaboom)[sizeof( composite_logger_s )] = 1;
//char (*__kaboom)[sizeof( buffer )] = 1;
//void SetNextToothEntry(uint16_t entry) {
// TS uses big endian, grumble
buffer[NextIdx] = SWAP_UINT16(entry);
// buffer[NextIdx] = SWAP_UINT16(entry);
//NextIdx++;
static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigger2,
bool isTDC DECLARE_ENGINE_PARAMETER_SUFFIX) {
uint32_t nowUs = NT2US(timestamp);
// TS uses big endian, grumble
buffer[NextIdx].timestamp = SWAP_UINT32(nowUs);
buffer[NextIdx].priLevel = trigger1;
buffer[NextIdx].secLevel = trigger2;
buffer[NextIdx].trigger = isTDC;
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
// todo:
//buffer[NextIdx].sync = isSynced;
//buffer[NextIdx].trigger = wtfIsTriggerIdk;
NextIdx++;
static_assert(sizeof(composite_logger_s) == COMPOSITE_PACKET_SIZE, "composite packet size");
// If we hit the end, loop
if (NextIdx >= sizeof(buffer) / sizeof(buffer[0])) {
NextIdx = 0;
}
}
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp) {
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
// bail if we aren't enabled
if (!ToothLoggerEnabled) {
return;
}
// We currently only support the primary trigger falling edge
// (this is the edge that VR sensors are accurate on)
// Since VR sensors are the most useful case here, this is okay for now.
if (tooth != SHAFT_PRIMARY_FALLING) {
return;
/*
// We currently only support the primary trigger falling edge
// (this is the edge that VR sensors are accurate on)
// Since VR sensors are the most useful case here, this is okay for now.
if (tooth != SHAFT_PRIMARY_FALLING) {
return;
}
uint32_t nowUs = NT2US(timestamp);
// 10us per LSB - this gives plenty of accuracy, yet fits 655.35 ms in to a uint16
uint16_t delta = static_cast<uint16_t>((nowUs - lastEdgeTimestamp) / 10);
lastEdgeTimestamp = nowUs;
SetNextEntry(delta);
*/
switch (tooth) {
case SHAFT_PRIMARY_FALLING:
trigger1 = false;
break;
case SHAFT_PRIMARY_RISING:
trigger1 = true;
break;
case SHAFT_SECONDARY_FALLING:
trigger2 = false;
break;
case SHAFT_SECONDARY_RISING:
trigger2 = true;
break;
default:
break;
}
uint32_t nowUs = NT2US(timestamp);
// 10us per LSB - this gives plenty of accuracy, yet fits 655.35 ms in to a uint16
uint16_t delta = static_cast<uint16_t>((nowUs - lastEdgeTimestamp) / 10);
lastEdgeTimestamp = nowUs;
SetNextCompositeEntry(timestamp, trigger1, trigger2, false PASS_ENGINE_PARAMETER_SUFFIX);
}
SetNextEntry(delta);
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
// bail if we aren't enabled
if (!ToothLoggerEnabled) {
return;
}
SetNextCompositeEntry(timestamp, trigger1, trigger2, true PASS_ENGINE_PARAMETER_SUFFIX);
}
void EnableToothLogger() {

View File

@ -11,6 +11,7 @@
#include <cstddef>
#include "efitime.h"
#include "rusefi_enums.h"
#include "engine.h"
// Enable the tooth logger - this clears the buffer starts logging
void EnableToothLogger();
@ -19,7 +20,9 @@ void EnableToothLogger();
void DisableToothLogger();
// A new tooth has arrived! Log to the buffer if enabled.
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp);
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
struct ToothLoggerBuffer
{

View File

@ -22,7 +22,7 @@
#include "local_version_holder.h"
#include "periodic_task.h"
#include "pwm_generator.h"
#include "pwm_generator_logic.h"
#include "pin_repository.h"
@ -30,14 +30,12 @@
#error "Unexpected OS ACCESS HERE"
#endif /* HAS_OS_ACCESS */
EXTERN_ENGINE
;
EXTERN_ENGINE;
static Logging *logger;
static SimplePwm alternatorControl("alt");
static pid_s *altPidS = &persistentState.persistentConfiguration.engineConfiguration.alternatorControl;
static PidIndustrial alternatorPid(altPidS);
static PidIndustrial alternatorPid(&persistentState.persistentConfiguration.engineConfiguration.alternatorControl);
static percent_t currentAltDuty;
@ -164,8 +162,7 @@ void initAlternatorCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
return;
if (CONFIG(onOffAlternatorLogic)) {
enginePins.alternatorPin.initPin("on/off alternator", CONFIG(alternatorControlPin));
enginePins.alternatorPin.initPin("Alternator control", CONFIG(alternatorControlPin));
} else {
startSimplePwmExt(&alternatorControl,
"Alternator control",

View File

@ -7,8 +7,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*
*/
#ifndef ALTERNATORCONTROLLER_H_
#define ALTERNATORCONTROLLER_H_
#pragma once
#include "engine.h"
void initAlternatorCtrl(Logging *sharedLogger);
@ -19,5 +19,3 @@ void showAltInfo(void);
void setDefaultAlternatorParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void onConfigurationChangeAlternatorCallback(engine_configuration_s *previousConfiguration);
#endif /* ALTERNATORCONTROLLER_H_ */

View File

@ -12,7 +12,7 @@
#include "allsensors.h"
#if EFI_AUX_PID
#include "pwm_generator.h"
#include "pwm_generator_logic.h"
#include "tunerstudio_configuration.h"
#include "fsio_impl.h"
#include "engine_math.h"
@ -23,10 +23,9 @@
#if defined(HAS_OS_ACCESS)
#error "Unexpected OS ACCESS HERE"
#endif
#endif /* HAS_OS_ACCESS */
EXTERN_ENGINE
;
EXTERN_ENGINE;
extern fsio8_Map3D_f32t fsioTable1;
@ -57,8 +56,7 @@ public:
void init(int index) {
this->index = index;
pid_s *auxPidS = &persistentState.persistentConfiguration.engineConfiguration.auxPid[index];
auxPid.initPidClass(auxPidS);
auxPid.initPidClass(&persistentState.persistentConfiguration.engineConfiguration.auxPid[index]);
table = getFSIOTable(index);
}
@ -124,7 +122,7 @@ static void turnAuxPidOn(int index) {
&engine->executor,
engineConfiguration->auxPidPins[index],
&instances[index].auxOutputPin,
engineConfiguration->auxPidFrequency[index], 0.1, (pwm_gen_callback*)applyPinState);
engineConfiguration->auxPidFrequency[index], 0.1);
}
void startAuxPins(void) {

View File

@ -5,8 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONTROLLERS_ALGO_AUX_PID_H_
#define CONTROLLERS_ALGO_AUX_PID_H_
#pragma once
#include "global.h"
@ -14,4 +13,3 @@ void initAuxPid(Logging *sharedLogger);
void startAuxPins(void);
void stopAuxPins(void);
#endif /* CONTROLLERS_ALGO_AUX_PID_H_ */

View File

@ -13,7 +13,7 @@
#endif /* EFI_TUNER_STUDIO */
#include "engine.h"
#include "boost_control.h"
#include "tps.h"
#include "sensor.h"
#include "map.h"
#include "io_pins.h"
#include "engine_configuration.h"
@ -22,7 +22,7 @@
#include "engine_controller.h"
#include "periodic_task.h"
#include "pin_repository.h"
#include "pwm_generator.h"
#include "pwm_generator_logic.h"
#include "pid_auto_tune.h"
#include "local_version_holder.h"
#define NO_PIN_PERIOD 500
@ -37,8 +37,7 @@ static Logging *logger;
static boostOpenLoop_Map3D_t boostMapOpen("boostmapopen", 1);
static boostOpenLoop_Map3D_t boostMapClosed("boostmapclosed", 1);
static SimplePwm boostPwmControl("boost");
static pid_s *boostPidS = &persistentState.persistentConfiguration.engineConfiguration.boostPid;
static Pid boostControlPid(boostPidS);
static Pid boostControlPid;
static bool shouldResetPid = false;
@ -51,6 +50,8 @@ static void pidReset(void) {
}
class BoostControl: public PeriodicTimerController {
DECLARE_ENGINE_PTR;
int getPeriodMs() override {
return GET_PERIOD_LIMITED(&engineConfiguration->boostPid);
}
@ -78,10 +79,13 @@ class BoostControl: public PeriodicTimerController {
percent_t duty = openLoopDuty;
if (engineConfiguration->boostType == CLOSED_LOOP) {
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
float targetBoost = boostMapClosed.getValue(rpm / RPM_1_BYTE_PACKING_MULT, tps / TPS_1_BYTE_PACKING_MULT) * LOAD_1_BYTE_PACKING_MULT;
closedLoopDuty = openLoopDuty + boostControlPid.getOutput(targetBoost, mapValue);
duty += closedLoopDuty;
auto [valid, tps] = Sensor::get(SensorType::DriverThrottleIntent);
if (valid) {
float targetBoost = boostMapClosed.getValue(rpm / RPM_1_BYTE_PACKING_MULT, tps / TPS_1_BYTE_PACKING_MULT) * LOAD_1_BYTE_PACKING_MULT;
closedLoopDuty = openLoopDuty + boostControlPid.getOutput(targetBoost, mapValue);
duty += closedLoopDuty;
}
}
boostControlPid.iTermMin = -50;
@ -95,16 +99,22 @@ class BoostControl: public PeriodicTimerController {
#endif /* EFI_TUNER_STUDIO */
}
#if EFI_LAUNCH_CONTROL
if (engine->setLaunchBoostDuty) {
duty = engineConfiguration->launchBoostDuty;
}
#endif /* EFI_LAUNCH_CONTROL */
boostPwmControl.setSimplePwmDutyCycle(PERCENT_TO_DUTY(duty));
}
};
static BoostControl BoostController;
#if !EFI_UNIT_TEST
void setBoostPFactor(float value) {
engineConfiguration->boostPid.pFactor = value;
boostControlPid.reset();
}
void setBoostIFactor(float value) {
@ -116,6 +126,7 @@ void setBoostDFactor(float value) {
engineConfiguration->boostPid.dFactor = value;
boostControlPid.reset();
}
#endif /* EFI_UNIT_TEST */
void setDefaultBoostParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->isBoostControlEnabled = true;
@ -146,6 +157,7 @@ void setDefaultBoostParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
static void turnBoostPidOn() {
#if !EFI_UNIT_TEST
if (CONFIG(boostControlPin) == GPIO_UNASSIGNED){
return;
}
@ -157,9 +169,9 @@ static void turnBoostPidOn() {
CONFIG(boostControlPin),
&enginePins.boostPin,
engineConfiguration->boostPwmFrequency,
0.5f,
(pwm_gen_callback*) applyPinState
0.5f
);
#endif /* EFI_UNIT_TEST */
}
void startBoostPin(void) {
@ -167,7 +179,9 @@ void startBoostPin(void) {
}
void stopBoostPin(void) {
#if !EFI_UNIT_TEST
brain_pin_markUnused(activeConfiguration.boostControlPin);
#endif /* EFI_UNIT_TEST */
}
void onConfigurationChangeBoostCallback(engine_configuration_s *previousConfiguration) {
@ -175,16 +189,22 @@ void onConfigurationChangeBoostCallback(engine_configuration_s *previousConfigur
}
void initBoostCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if !EFI_UNIT_TEST
if (CONFIG(boostControlPin) == GPIO_UNASSIGNED){
return;
}
#endif
boostControlPid.initPidClass(&engineConfiguration->boostPid);
logger = sharedLogger;
boostMapOpen.init(config->boostTableOpenLoop, config->boostMapBins, config->boostRpmBins);
boostMapClosed.init(config->boostTableClosedLoop, config->boostTpsBins, config->boostRpmBins);
boostControlPid.reset();
#if !EFI_UNIT_TEST
startBoostPin();
BoostController.Start();
#endif
}
#endif

View File

@ -9,19 +9,12 @@
#include "engine.h"
#include "periodic_task.h"
void startBoostPin(void);
void stopBoostPin(void);
void initBoostCtrl(Logging *sharedLogger);
void initBoostCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void setBoostPFactor(float p);
void setBoostIFactor(float i);
void setBoostDFactor(float d);
void setDefaultBoostParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void showBoostInfo(void);
void onConfigurationChangeBoostCallback(engine_configuration_s *previousConfiguration);

View File

@ -15,7 +15,7 @@
#include "dc_motor.h"
#include "efi_gpio.h"
#include "pwm_generator.h"
#include "pwm_generator_logic.h"
EXTERN_ENGINE;
@ -24,6 +24,7 @@ private:
OutputPin m_pinEnable;
OutputPin m_pinDir1;
OutputPin m_pinDir2;
OutputPin m_disablePin;
SimplePwm m_pwmEnable;
SimplePwm m_pwmDir1;
@ -32,7 +33,7 @@ private:
SimplePwm etbPwmUp;
public:
EtbHardware() : etbPwmUp("etbUp"), dcMotor(&m_pwmEnable, &m_pwmDir1, &m_pwmDir2) {}
EtbHardware() : etbPwmUp("etbUp"), dcMotor(&m_pwmEnable, &m_pwmDir1, &m_pwmDir2, &m_disablePin) {}
TwoPinDcMotor dcMotor;
@ -45,14 +46,17 @@ public:
void start(bool useTwoWires,
brain_pin_e pinEnable,
// since we have pointer magic here we cannot simply have value parameter
const pin_output_mode_e *pinEnableMode,
brain_pin_e pinDir1,
brain_pin_e pinDir2,
brain_pin_e pinDisable,
ExecutorInterface* executor,
int frequency) {
dcMotor.setType(useTwoWires ? TwoPinDcMotor::ControlType::PwmDirectionPins : TwoPinDcMotor::ControlType::PwmEnablePin);
m_pinEnable.initPin("ETB Enable", pinEnable, pinEnableMode);
// Configure the disable pin first - ensure things are in a safe state
m_disablePin.initPin("ETB Disable", pinDisable);
m_pinEnable.initPin("ETB Enable", pinEnable);
m_pinDir1.initPin("ETB Dir 1", pinDir1);
m_pinDir2.initPin("ETB Dir 2", pinDir2);
@ -65,24 +69,21 @@ public:
executor,
&m_pinEnable,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState
0
);
startSimplePwm(&m_pwmDir1, "ETB Dir 1",
executor,
&m_pinDir1,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState
0
);
startSimplePwm(&m_pwmDir2, "ETB Dir 2",
executor,
&m_pinDir2,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState
0
);
#endif /* EFI_UNIT_TEST */
}
@ -95,13 +96,12 @@ DcMotor* initDcMotor(size_t index DECLARE_ENGINE_PARAMETER_SUFFIX)
const auto& io = engineConfiguration->etbIo[index];
auto& hw = etbHardware[index];
// controlPinMode is a strange feature - it's simply because I am short on 5v I/O on Frankenso with Miata NB2 test mule
hw.start(
CONFIG(etb_use_two_wires),
io.controlPin1,
&io.controlPinMode,
io.directionPin1,
io.directionPin2,
io.disablePin,
&ENGINE(executor),
CONFIG(etbFreq)
);
@ -126,4 +126,4 @@ void showDcMotorInfo(Logging* logger) {
scheduleMsg(logger, "Motor: dir=%d DC=%f", etb->dcMotor.isOpenDirection(), etb->dcMotor.get());
}
}
#endif
#endif

View File

@ -76,13 +76,7 @@
#include "electronic_throttle.h"
#include "tps.h"
#include "io_pins.h"
#include "engine_configuration.h"
#include "pwm_generator_logic.h"
#include "pid.h"
#include "engine_controller.h"
#include "periodic_task.h"
#include "pin_repository.h"
#include "sensor.h"
#include "dc_motor.h"
#include "dc_motors.h"
#include "pid_auto_tune.h"
@ -95,10 +89,6 @@
#define ETB_MAX_COUNT 2
#endif /* ETB_MAX_COUNT */
static pid_s tuneWorkingPidSettings;
static Pid tuneWorkingPid(&tuneWorkingPidSettings);
static PID_AutoTune autoTune;
static LoggingWithStorage logger("ETB");
static pedal2tps_t pedal2tpsMap("Pedal2Tps", 1);
@ -108,19 +98,25 @@ static bool startupPositionError = false;
#define STARTUP_NEUTRAL_POSITION_ERROR_THRESHOLD 5
extern percent_t mockPedalPosition;
static SensorType indexToTpsSensor(size_t index) {
switch(index) {
case 0: return SensorType::Tps1;
default: return SensorType::Tps2;
}
}
static percent_t directPwmValue = NAN;
static percent_t currentEtbDuty;
#define ETB_DUTY_LIMIT 0.9
// 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))
#define ETB_PERCENT_TO_DUTY(x) (clampF(-ETB_DUTY_LIMIT, 0.01f * (x), ETB_DUTY_LIMIT))
void EtbController::init(DcMotor *motor, int ownIndex, pid_s *pidParameters) {
void EtbController::init(DcMotor *motor, int ownIndex, pid_s *pidParameters, const ValueProvider3D* pedalMap) {
m_motor = motor;
m_myIndex = ownIndex;
m_pid.initPidClass(pidParameters);
m_pedalMap = pedalMap;
}
void EtbController::reset() {
@ -141,6 +137,182 @@ int EtbController::getPeriodMs() {
return GET_PERIOD_LIMITED(&engineConfiguration->etb);
}
expected<percent_t> EtbController::observePlant() const {
return Sensor::get(indexToTpsSensor(m_myIndex));
}
void EtbController::setIdlePosition(percent_t pos) {
m_idlePosition = pos;
}
expected<percent_t> EtbController::getSetpoint() const {
// A few extra preconditions if throttle control is invalid
if (startupPositionError) {
return unexpected;
}
if (engineConfiguration->pauseEtbControl) {
return unexpected;
}
// If the pedal map hasn't been set, we can't provide a setpoint.
if (!m_pedalMap) {
return unexpected;
}
auto pedalPosition = Sensor::get(SensorType::AcceleratorPedal);
if (!pedalPosition.Valid) {
return unexpected;
}
float sanitizedPedal = clampF(0, pedalPosition.Value, 100);
float rpm = GET_RPM();
float targetFromTable = m_pedalMap->getValue(rpm / RPM_1_BYTE_PACKING_MULT, sanitizedPedal);
engine->engineState.targetFromTable = targetFromTable;
percent_t etbIdlePosition = clampF(
0,
CONFIG(useETBforIdleControl) ? m_idlePosition : 0,
100
);
percent_t etbIdleAddition = 0.01f * CONFIG(etbIdleThrottleRange) * etbIdlePosition;
// Interpolate so that the idle adder just "compresses" the throttle's range upward.
// [0, 100] -> [idle, 100]
// 0% target from table -> idle position as target
// 100% target from table -> 100% target position
percent_t targetPosition = interpolateClamped(0, etbIdleAddition, 100, 100, targetFromTable);
#if EFI_TUNER_STUDIO
if (m_myIndex == 0) {
tsOutputChannels.etbTarget = targetPosition;
}
#endif
return targetPosition;
}
expected<percent_t> EtbController::getOpenLoop(percent_t target) const {
float ff = interpolate2d("etbb", target, engineConfiguration->etbBiasBins, engineConfiguration->etbBiasValues);
engine->engineState.etbFeedForward = ff;
return ff;
}
expected<percent_t> EtbController::getClosedLoopAutotune(percent_t actualThrottlePosition) {
// Estimate gain at 60% position - this should be well away from the spring and in the linear region
bool isPositive = actualThrottlePosition > 60.0f;
float autotuneAmplitude = 20;
// End of cycle - record & reset
if (!isPositive && m_lastIsPositive) {
efitick_t now = getTimeNowNt();
// Determine period
float tu = NT2US((float)(now - m_cycleStartTime)) / 1e6;
m_cycleStartTime = now;
// Determine amplitude
float a = m_maxCycleTps - m_minCycleTps;
// Filter - it's pretty noisy since the ultimate period is not very many loop periods
constexpr float alpha = 0.05;
m_a = alpha * a + (1 - alpha) * m_a;
m_tu = alpha * tu + (1 - alpha) * m_tu;
// Reset bounds
m_minCycleTps = 100;
m_maxCycleTps = 0;
// Math is for ÅströmHägglund (relay) auto tuning
// https://warwick.ac.uk/fac/cross_fac/iatl/reinvention/archive/volume5issue2/hornsey
// Publish to TS state
#if EFI_TUNER_STUDIO
if (engineConfiguration->debugMode == DBG_ETB_AUTOTUNE) {
// a - amplitude of output (TPS %)
tsOutputChannels.debugFloatField1 = m_a;
float b = 2 * autotuneAmplitude;
// b - amplitude of input (Duty cycle %)
tsOutputChannels.debugFloatField2 = b;
// Tu - oscillation period (seconds)
tsOutputChannels.debugFloatField3 = m_tu;
// Ultimate gain per A-H relay tuning rule
// Ku
float ku = 4 * b / (3.14159f * m_a);
tsOutputChannels.debugFloatField4 = ku;
// The multipliers below are somewhere near the "no overshoot"
// and "some overshoot" flavors of the Ziegler-Nichols method
// Kp
tsOutputChannels.debugFloatField5 = 0.35f * ku;
// Ki
tsOutputChannels.debugFloatField6 = 0.25f * ku / m_tu;
// Kd
tsOutputChannels.debugFloatField7 = 0.08f * ku * m_tu;
}
#endif
}
m_lastIsPositive = isPositive;
// Find the min/max of each cycle
if (actualThrottlePosition < m_minCycleTps) {
m_minCycleTps = actualThrottlePosition;
}
if (actualThrottlePosition > m_maxCycleTps) {
m_maxCycleTps = actualThrottlePosition;
}
// Bang-bang control the output to induce oscillation
return autotuneAmplitude * (isPositive ? -1 : 1);
}
expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t actualThrottlePosition) {
if (m_shouldResetPid) {
m_pid.reset();
m_shouldResetPid = false;
}
// Only report the 0th throttle
if (m_myIndex == 0) {
#if EFI_TUNER_STUDIO
// Error is positive if the throttle needs to open further
tsOutputChannels.etb1Error = target - actualThrottlePosition;
#endif /* EFI_TUNER_STUDIO */
}
// Only allow autotune with stopped engine
if (GET_RPM() == 0 && engine->etbAutoTune) {
return getClosedLoopAutotune(actualThrottlePosition);
} else {
// Normal case - use PID to compute closed loop part
return m_pid.getOutput(target, actualThrottlePosition);
}
}
void EtbController::setOutput(expected<percent_t> outputValue) {
#if EFI_TUNER_STUDIO
// Only report first-throttle stats
if (m_myIndex == 0) {
tsOutputChannels.etb1DutyCycle = outputValue.value_or(0);
}
#endif
if (!m_motor) return;
if (outputValue) {
m_motor->enable();
m_motor->set(ETB_PERCENT_TO_DUTY(outputValue.Value));
} else {
m_motor->disable();
}
}
void EtbController::PeriodicTask() {
#if EFI_TUNER_STUDIO
// Only debug throttle #0
@ -156,60 +328,11 @@ void EtbController::PeriodicTask() {
}
#endif /* EFI_TUNER_STUDIO */
if (!m_motor) {
return;
}
if (startupPositionError) {
m_motor->set(0);
return;
}
if (m_shouldResetPid) {
m_pid.reset();
m_shouldResetPid = false;
}
if (!cisnan(directPwmValue)) {
m_motor->set(directPwmValue);
return;
}
if (engineConfiguration->pauseEtbControl) {
m_motor->set(0);
return;
}
percent_t actualThrottlePosition = getTPSWithIndex(m_myIndex 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 = CONFIG(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;
@ -217,27 +340,16 @@ void EtbController::PeriodicTask() {
#endif /* EFI_TUNER_STUDIO */
}
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);
m_pid.iTermMin = engineConfiguration->etb_iTermMin;
m_pid.iTermMax = engineConfiguration->etb_iTermMax;
currentEtbDuty = engine->engineState.etbFeedForward +
m_pid.getOutput(targetPosition, actualThrottlePosition);
m_motor->set(ETB_PERCENT_TO_DUTY(currentEtbDuty));
if (engineConfiguration->isVerboseETB) {
m_pid.showPidStatus(&logger, "ETB");
}
update();
DISPLAY_STATE(Engine)
DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
DISPLAY_TEXT(Electronic_Throttle);
DISPLAY_SENSOR(TPS)
DISPLAY_TEXT(eol);
@ -276,19 +388,6 @@ DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
/* DISPLAY_ELSE */
DISPLAY_TEXT(No_Pedal_Sensor);
/* DISPLAY_ENDIF */
// Only report the 0th throttle
if (m_myIndex == 0) {
#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;
#endif /* EFI_TUNER_STUDIO */
}
}
// real implementation (we mock for some unit tests)
@ -296,8 +395,6 @@ EtbController etbControllers[ETB_COUNT];
static void showEthInfo(void) {
#if EFI_PROD_CODE
static char pinNameBuffer[16];
if (engine->etbActualCount == 0) {
scheduleMsg(&logger, "ETB DISABLED since no PPS");
}
@ -305,13 +402,7 @@ static void showEthInfo(void) {
scheduleMsg(&logger, "etbAutoTune=%d",
engine->etbAutoTune);
scheduleMsg(&logger, "throttlePedal=%.2f %.2f/%.2f @%s",
getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE),
engineConfiguration->throttlePedalUpVoltage,
engineConfiguration->throttlePedalWOTVoltage,
getPinNameByAdcChannel("tPedal", engineConfiguration->throttlePedalPositionAdcChannel, pinNameBuffer));
scheduleMsg(&logger, "TPS=%.2f", getTPS(PASS_ENGINE_PARAMETER_SIGNATURE));
scheduleMsg(&logger, "TPS=%.2f", Sensor::get(SensorType::Tps1).value_or(0));
scheduleMsg(&logger, "etbControlPin1=%s duty=%.2f freq=%d",
@ -371,8 +462,6 @@ static void etbReset() {
}
etbPidReset();
mockPedalPosition = MOCK_UNDEFINED;
}
#endif /* EFI_PROD_CODE */
@ -415,34 +504,19 @@ void setEtbOffset(int value) {
#endif /* EFI_UNIT_TEST */
void setBoschVNH2SP30Curve(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etbBiasBins[0] = 0;
engineConfiguration->etbBiasBins[1] = 1;
engineConfiguration->etbBiasBins[2] = 5;
/**
* This specific throttle has default position of about 7% open
*/
engineConfiguration->etbBiasBins[3] = 7;
engineConfiguration->etbBiasBins[4] = 14;
engineConfiguration->etbBiasBins[5] = 65;
engineConfiguration->etbBiasBins[6] = 66;
engineConfiguration->etbBiasBins[7] = 100;
/**
* This specific throttle has default position of about 7% open
*/
static const float boschBiasBins[] = {
0, 1, 5, 7, 14, 65, 66, 100
};
static const float boschBiasValues[] = {
-15, -15, -10, 0, 19, 20, 26, 28
};
/**
* Some negative bias for below-default position
*/
engineConfiguration->etbBiasValues[0] = -15;
engineConfiguration->etbBiasValues[1] = -15;
engineConfiguration->etbBiasValues[2] = -10;
/**
* Zero bias for index which corresponds to default throttle position, when no current is applied
* This specific throttle has default position of about 7% open
*/
engineConfiguration->etbBiasValues[3] = 0;
engineConfiguration->etbBiasValues[4] = 19;
engineConfiguration->etbBiasValues[5] = 20;
engineConfiguration->etbBiasValues[6] = 26;
engineConfiguration->etbBiasValues[7] = 28;
void setBoschVNH2SP30Curve(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
copyArray(CONFIG(etbBiasBins), boschBiasBins);
copyArray(CONFIG(etbBiasValues), boschBiasValues);
}
void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
@ -461,17 +535,17 @@ void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->throttlePedalUpVoltage = 0; // that's voltage, not ADC like with TPS
engineConfiguration->throttlePedalWOTVoltage = 6; // that's voltage, not ADC like with TPS
engineConfiguration->etb.pFactor = 1;
engineConfiguration->etb.iFactor = 0.05;
engineConfiguration->etb.dFactor = 0.0;
engineConfiguration->etb.periodMs = (1000 / DEFAULT_ETB_LOOP_FREQUENCY);
engineConfiguration->etbFreq = DEFAULT_ETB_PWM_FREQUENCY;
engineConfiguration->etb = {
1, // Kp
10, // Ki
0.05, // Kd
0, // offset
(1000 / DEFAULT_ETB_LOOP_FREQUENCY),
-100, 100 // min/max
};
engineConfiguration->etb_iTermMin = -300;
engineConfiguration->etb_iTermMax = 300;
// values are above 100% since we have feedforward part of the total summation
engineConfiguration->etb.minValue = -200;
engineConfiguration->etb.maxValue = 200;
}
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration) {
@ -493,58 +567,24 @@ static void setAutoStep(float value) {
autoTune.SetOutputStep(value);
}
static void setAutoPeriod(int period) {
tuneWorkingPidSettings.periodMs = period;
autoTune.reset();
}
static void setAutoOffset(int offset) {
tuneWorkingPidSettings.offset = offset;
autoTune.reset();
}
#endif /* EFI_PROD_CODE */
void setDefaultEtbBiasCurve(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etbBiasBins[0] = 0;
engineConfiguration->etbBiasBins[1] = 1;
engineConfiguration->etbBiasBins[2] = 2;
/**
* This specific throttle has default position of about 4% open
*/
engineConfiguration->etbBiasBins[3] = 4;
engineConfiguration->etbBiasBins[4] = 7;
engineConfiguration->etbBiasBins[5] = 98;
engineConfiguration->etbBiasBins[6] = 99;
engineConfiguration->etbBiasBins[7] = 100;
static const float defaultBiasBins[] = {
0, 1, 2, 4, 7, 98, 99, 100
};
static const float defaultBiasValues[] = {
-20, -18, -17, 0, 20, 21, 22, 25
};
/**
* Some negative bias for below-default position
*/
engineConfiguration->etbBiasValues[0] = -20;
engineConfiguration->etbBiasValues[1] = -18;
engineConfiguration->etbBiasValues[2] = -17;
/**
* Zero bias for index which corresponds to default throttle position, when no current is applied
* This specific throttle has default position of about 4% open
*/
engineConfiguration->etbBiasValues[3] = 0;
engineConfiguration->etbBiasValues[4] = 20;
engineConfiguration->etbBiasValues[5] = 21;
engineConfiguration->etbBiasValues[6] = 22;
engineConfiguration->etbBiasValues[7] = 25;
void setDefaultEtbBiasCurve(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
copyArray(CONFIG(etbBiasBins), defaultBiasBins);
copyArray(CONFIG(etbBiasValues), defaultBiasValues);
}
void unregisterEtbPins() {
// todo: we probably need an implementation here?!
}
void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &etbControllers[i];
}
doInitElectronicThrottle(PASS_ENGINE_PARAMETER_SIGNATURE);
}
void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
efiAssertVoid(OBD_PCM_Processor_Fault, engine->etbControllers != NULL, "etbControllers NULL");
#if EFI_PROD_CODE
@ -553,14 +593,14 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
addConsoleActionI("etb_freq", setEtbFrequency);
#endif /* EFI_PROD_CODE */
engine->engineState.hasEtbPedalPositionSensor = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
if (!engine->engineState.hasEtbPedalPositionSensor) {
#if EFI_PROD_CODE
// TODO: Once switched to new sensor model for pedal, we don't need this to be test-guarded.
// If you don't have a pedal, we have no business here.
if (!Sensor::hasSensor(SensorType::AcceleratorPedal)) {
return;
#endif
}
engine->etbActualCount = hasSecondThrottleBody(PASS_ENGINE_PARAMETER_SIGNATURE) ? 2 : 1;
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
engine->etbActualCount = Sensor::hasSensor(SensorType::Tps2) ? 2 : 1;
for (int i = 0 ; i < engine->etbActualCount; i++) {
auto motor = initDcMotor(i PASS_ENGINE_PARAMETER_SUFFIX);
@ -568,23 +608,16 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// If this motor is actually set up, init the etb
if (motor)
{
engine->etbControllers[i]->init(motor, i, &engineConfiguration->etb);
engine->etbControllers[i]->init(motor, i, &engineConfiguration->etb, &pedal2tpsMap);
INJECT_ENGINE_REFERENCE(engine->etbControllers[i]);
}
}
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
#if 0
// not alive code
autoTune.SetOutputStep(0.1);
#endif
#if 0 && ! EFI_UNIT_TEST
percent_t startupThrottlePosition = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
if (absF(startupThrottlePosition - engineConfiguration->etbNeutralPosition) > STARTUP_NEUTRAL_POSITION_ERROR_THRESHOLD) {
/**
* Unexpected electronic throttle start-up position is worth a fatal error
* Unexpected electronic throttle start-up position is worth a critical error
*/
firmwareError(OBD_Throttle_Actuator_Control_Range_Performance_Bank_1, "startup ETB position %.2f not %d",
startupThrottlePosition,
@ -612,24 +645,6 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
addConsoleActionNANF(CMD_ETB_DUTY, setThrottleDutyCycle);
#endif /* EFI_PROD_CODE */
#if EFI_PROD_CODE && 0
tuneWorkingPidSettings.pFactor = 1;
tuneWorkingPidSettings.iFactor = 0;
tuneWorkingPidSettings.dFactor = 0;
// tuneWorkingPidSettings.offset = 10; // todo: not hard-coded value
//todo tuneWorkingPidSettings.periodMs = 10;
tuneWorkingPidSettings.minValue = 0;
tuneWorkingPidSettings.maxValue = 100;
tuneWorkingPidSettings.periodMs = 100;
// this is useful once you do "enable etb_auto"
addConsoleActionF("set_etbat_output", setTempOutput);
addConsoleActionF("set_etbat_step", setAutoStep);
addConsoleActionI("set_etbat_period", setAutoPeriod);
addConsoleActionI("set_etbat_offset", setAutoOffset);
#endif /* EFI_PROD_CODE */
etbPidReset(PASS_ENGINE_PARAMETER_SIGNATURE);
for (int i = 0 ; i < engine->etbActualCount; i++) {
@ -637,6 +652,26 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
}
void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (hasFirmwareError()) {
return;
}
for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &etbControllers[i];
}
doInitElectronicThrottle(PASS_ENGINE_PARAMETER_SIGNATURE);
}
void setEtbIdlePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX) {
for (int i = 0; i < ETB_COUNT; i++) {
auto etb = engine->etbControllers[i];
if (etb) {
etb->setIdlePosition(pos);
}
}
}
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */

View File

@ -12,21 +12,25 @@
#define DEFAULT_ETB_PWM_FREQUENCY 300
#include "engine.h"
#include "closed_loop_controller.h"
#include "expected.h"
#include "periodic_task.h"
class DcMotor;
class Logging;
class IEtbController : public PeriodicTimerController{
class IEtbController : public PeriodicTimerController, public ClosedLoopController<percent_t, percent_t> {
public:
DECLARE_ENGINE_PTR;
virtual void init(DcMotor *motor, int ownIndex, pid_s *pidParameters) = 0;
virtual void init(DcMotor *motor, int ownIndex, pid_s *pidParameters, const ValueProvider3D* pedalMap) = 0;
virtual void reset() = 0;
virtual void setIdlePosition(percent_t pos) = 0;
};
class EtbController final : public IEtbController {
public:
void init(DcMotor *motor, int ownIndex, pid_s *pidParameters) override;
void init(DcMotor *motor, int ownIndex, pid_s *pidParameters, const ValueProvider3D* pedalMap) override;
void setIdlePosition(percent_t pos) override;
// PeriodicTimerController implementation
int getPeriodMs() override;
@ -40,18 +44,42 @@ public:
// Print this throttle's status.
void showStatus(Logging* logger);
// Helpers for individual parts of throttle control
expected<percent_t> observePlant() const override;
expected<percent_t> getSetpoint() const override;
expected<percent_t> getOpenLoop(percent_t target) const override;
expected<percent_t> getClosedLoop(percent_t setpoint, percent_t target) override;
expected<percent_t> getClosedLoopAutotune(percent_t actualThrottlePosition);
void setOutput(expected<percent_t> outputValue) override;
// Used to inspect the internal PID controller's state
const pid_state_s* getPidState() const { return &m_pid; };
private:
int m_myIndex;
DcMotor *m_motor;
int m_myIndex = 0;
DcMotor *m_motor = nullptr;
Pid m_pid;
bool m_shouldResetPid = false;
// Pedal -> target map
const ValueProvider3D* m_pedalMap = nullptr;
float m_idlePosition = 0;
// Autotune helpers
bool m_lastIsPositive = false;
efitick_t m_cycleStartTime = 0;
float m_minCycleTps = 0;
float m_maxCycleTps = 0;
float m_a = 0;
float m_tu = 0;
};
void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setEtbIdlePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX);
void setDefaultEtbBiasCurve(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -0,0 +1,54 @@
#include "global.h"
#include "engine.h"
#include "gppwm_channel.h"
#include "pwm_generator_logic.h"
EXTERN_ENGINE;
static GppwmChannel channels[4];
static OutputPin pins[4];
static SimplePwm outputs[4];
static gppwm_Map3D_t table1("GPPWM 1");
static gppwm_Map3D_t table2("GPPWM 2");
static gppwm_Map3D_t table3("GPPWM 3");
static gppwm_Map3D_t table4("GPPWM 4");
static gppwm_Map3D_t* tables[] = {
&table1,
&table2,
&table3,
&table4,
};
void initGpPwm(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (size_t i = 0; i < efi::size(channels); i++) {
auto& cfg = CONFIG(gppwm)[i];
// If no pin, don't enable this channel.
if (cfg.pin == GPIO_UNASSIGNED) continue;
// Determine frequency and whether PWM is enabled
float freq = cfg.pwmFrequency;
bool usePwm = freq > 0;
// Setup pin & pwm
pins[i].initPin("gp pwm", cfg.pin);
startSimplePwm(&outputs[i], "gp pwm", &engine->executor, &pins[i], freq, 0);
// Set up this channel's lookup table
tables[i]->init(cfg.table, cfg.loadBins, cfg.rpmBins);
// Finally configure the channel
INJECT_ENGINE_REFERENCE(&channels[i]);
channels[i].init(usePwm, &outputs[i], tables[i], &cfg);
}
}
void updateGppwm() {
for (size_t i = 0; i < efi::size(channels); i++) {
channels[i].update();
}
}

View File

@ -0,0 +1,6 @@
#pragma once
#include "engine.h"
void initGpPwm(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void updateGppwm();

View File

@ -0,0 +1,89 @@
#include "gppwm_channel.h"
#include "engine.h"
#include "pwm_generator_logic.h"
#include "table_helper.h"
#include "expected.h"
#include "sensor.h"
#include "map.h"
EXTERN_ENGINE;
expected<float> readGppwmChannel(gppwm_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX) {
switch (channel) {
case GPPWM_Tps:
return Sensor::get(SensorType::Tps1);
case GPPWM_Map: {
float map = getMap(PASS_ENGINE_PARAMETER_SIGNATURE);
if (cisnan(map)) {
return unexpected;
}
return map;
}
case GPPWM_Clt:
return Sensor::get(SensorType::Clt);
case GPPWM_Iat:
return Sensor::get(SensorType::Iat);
default:
return unexpected;
}
}
void GppwmChannel::setOutput(float result) {
// Not init yet, nothing to do.
if (!m_pwm || !m_config) {
return;
}
if (!m_usePwm) {
// Apply hysteresis with provided values
if (m_state && result < m_config->offBelowDuty) {
m_state = false;
} else if (!m_state && result > m_config->onAboveDuty) {
m_state = true;
}
result = m_state ? 100 : 0;
}
m_pwm->setSimplePwmDutyCycle(clampF(0, result / 100.0f, 1));
}
void GppwmChannel::init(bool usePwm, SimplePwm* pwm, const ValueProvider3D* table, const gppwm_channel* config) {
m_usePwm = usePwm;
m_pwm = pwm;
m_table = table;
m_config = config;
}
float GppwmChannel::getOutput() const {
expected<float> loadAxisValue = readGppwmChannel(m_config->loadAxis PASS_ENGINE_PARAMETER_SUFFIX);
// If we couldn't get load axis value, fall back on error value
if (!loadAxisValue) {
return m_config->dutyIfError;
}
float rpm = GET_RPM();
float result = m_table->getValue(rpm / RPM_1_BYTE_PACKING_MULT, loadAxisValue.Value);
if (cisnan(result)) {
return m_config->dutyIfError;
}
return result;
}
void GppwmChannel::update() {
// Without a config, nothing to do.
if (!m_config) {
return;
}
float output = getOutput();
setOutput(output);
}

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