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

This commit is contained in:
rusefi 2020-11-29 12:51:04 -05:00
commit 6bf93b653f
86 changed files with 301 additions and 448 deletions

View File

@ -25,7 +25,10 @@ Release template (copy/paste this for new release):
All notable user-facing or behavior-altering changes will be documented in this file.
## November 2020 Release
## XXX 202X Release
## November 2020 Release - "Black Friday"
### Breaking Changes
- "AFR target" table is now "Lambda target" table. It should convert itself correctly, but a backup of that table is recommended when updating firmware/ini.
@ -34,7 +37,7 @@ All notable user-facing or behavior-altering changes will be documented in this
### Added
- High & low pressure fuel sensor channels
- Electronic throttle-style wastegate control found on some VW turbos (and VGTs)
- Improved TLE8888 driver on microRusEfi
- Improved TLE8888 driver on microRusEFI
- Improved setting ECU presets/defaults from TunerStudio
### Fixed
@ -44,7 +47,7 @@ All notable user-facing or behavior-altering changes will be documented in this
### Added
- `iat` as FSIO variable to read intake air temperature
- [ALPHA] Software based knock detection on Proteus v0.4+. Possible on microRusEfi and Frankenso too with hardware modification.
- [ALPHA] Software based knock detection on Proteus v0.4+. Possible on microRusEFI and Frankenso too with hardware modification.
- [ALPHA] Early framing work for automatic transmission control!
### Fixed

View File

@ -4,4 +4,6 @@ export PROJECT_BOARD=proteus
export PROJECT_CPU=ARCH_STM32F4
export EXTRA_PARAMS=-DSHORT_BOARD_NAME=proteus_f4
# export DEBUG_LEVEL_OPT="-O0 -ggdb -g3"
bash ../common_make.sh

View File

@ -89,9 +89,9 @@ analog_inputs:
EFI_ADC_6: "Analog Volt 11"
# PA7
EFI_ADC_7: "Battery Sense"
# CLT = Analog Temp 3 = PB0
# CLT, PB0, pin #20
EFI_ADC_8: "Analog Temp 3"
# PB1
# PB1, pin #31
EFI_ADC_9: "Analog Temp 4"
# MAP = Analog volt 1 = PC0
EFI_ADC_10: "Analog Volt 1"

View File

@ -157,22 +157,7 @@
DEFAULT_GPIO_SPEED(14) | \
DEFAULT_GPIO_SPEED(15))
#define VAL_GPIO_ODR_ALL_DEFAULT (PIN_ODR_HIGH(0) | \
PIN_ODR_HIGH(1) | \
PIN_ODR_HIGH(2) | \
PIN_ODR_HIGH(3) | \
PIN_ODR_HIGH(4) | \
PIN_ODR_HIGH(5) | \
PIN_ODR_HIGH(6) | \
PIN_ODR_HIGH(7) | \
PIN_ODR_HIGH(8) | \
PIN_ODR_HIGH(9) | \
PIN_ODR_HIGH(10) | \
PIN_ODR_HIGH(11) | \
PIN_ODR_HIGH(12) | \
PIN_ODR_HIGH(13) | \
PIN_ODR_HIGH(14) | \
PIN_ODR_HIGH(15))
#define VAL_GPIO_ODR_ALL_DEFAULT 0
#define VAL_GPIO_PUPDR_ALL_DEFAULT (EFI_DR_DEFAULT(0) | \
EFI_DR_DEFAULT(1) | \

View File

@ -97,7 +97,11 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
/*
* this configuration is used on HW CI - in HW CI 'inverted' would rightfully fail unless there is pull-up
engineConfiguration->injectionPinMode = OM_INVERTED;
*/
engineConfiguration->injectionPins[0] = GPIOB_8; // #1
engineConfiguration->injectionPins[1] = GPIOE_2; // #2
engineConfiguration->injectionPins[2] = GPIOE_3; // #3
@ -105,7 +109,10 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->injectionPins[4] = GPIOE_5; // #5
engineConfiguration->injectionPins[5] = GPIOE_6; // #6
/*
* this configuration is used on HW CI - in HW CI 'inverted' would rightfully fail unless there is pull-up
engineConfiguration->ignitionPinMode = OM_INVERTED;
*/
engineConfiguration->ignitionPins[0] = GPIOB_5; // #1
engineConfiguration->ignitionPins[2] = GPIOB_6; // #3
@ -125,7 +132,10 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// idle
engineConfiguration->idle.solenoidPin = GPIOC_14;
/*
* this configuration is used on HW CI - in HW CI 'inverted' would rightfully fail unless there is pull-up
engineConfiguration->idle.solenoidPinMode = OM_INVERTED;
*/
engineConfiguration->idle.solenoidFrequency = 300;
engineConfiguration->manIdlePosition = 50; // set_idle_pwm 50

View File

@ -93,6 +93,7 @@ void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
strcpy(CONFIG(engineCode), "M73");
engineConfiguration->specs.firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10;
CONFIG(isFasterEngineSpinUpEnabled) = true;
CONFIG(fuelAlgorithm) = LM_ALPHA_N;
engineConfiguration->vvtMode = VVT_FIRST_HALF;
@ -298,6 +299,10 @@ void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->vbattDividerCoeff = 7.6; // is that Proteus 0.2 value?
// no idea why https://github.com/rusefi/rusefi/wiki/HOWTO-M73-v12-on-Proteus uses non default CLT pin
// AT3, Proteus pin #31
engineConfiguration->clt.adcChannel = EFI_ADC_9;
// GPIOE_0: "Lowside 14"
CONFIG(starterControlPin) = GPIOE_0;

View File

@ -120,7 +120,7 @@ void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
CONFIG(crankingTimingAngle) = 30;
// I am too lazy to add MAP sensor
engineConfiguration->fuelAlgorithm = LM_ALPHA_N_2;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
// set cranking_fuel 15
engineConfiguration->cranking.baseFuel = 15;

View File

@ -1,46 +0,0 @@
/*
* @file chevrolet_c20_1973.cpp
*
* most stuff is from a 1991
* 5.7L SBC
* 4 wire IAC
* 8 pin HEI module
*
* set engine_type 37
*
*
* @date Dec 20, 2015
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "chevrolet_c20_1973.h"
#include "engine_math.h"
EXTERN_CONFIG;
void set1973c20(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.displacement = 5.7;
engineConfiguration->specs.cylindersCount = 8;
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
engineConfiguration->ignitionMode = IM_ONE_COIL;
engineConfiguration->specs.firingOrder = FO_1_8_4_3_6_5_7_2;
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
engineConfiguration->injectionMode = IM_SIMULTANEOUS;
/**
* 8/0 toothed wheel
*/
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->trigger.customSkippedToothCount = 0;
engineConfiguration->rpmHardLimit = 5000;
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
}

View File

@ -1,13 +0,0 @@
/*
* @file chevrolet_c20_1973.h
*
* @date Dec 20, 2015
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#include "engine_configuration.h"
void set1973c20(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -74,7 +74,7 @@ void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
/**
* Algorithm Alpha-N setting
*/
setAlgorithm(LM_ALPHA_N_2 PASS_CONFIG_PARAMETER_SUFFIX);
setAlgorithm(LM_ALPHA_N PASS_CONFIG_PARAMETER_SUFFIX);
setTimingRpmBin(800, 7000 PASS_CONFIG_PARAMETER_SUFFIX);
/**

View File

@ -108,7 +108,7 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_DODGE_NEON_1995;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N_2;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
// engineConfiguration->spi2SckMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
// engineConfiguration->spi2MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4

View File

@ -30,10 +30,8 @@ ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \
$(PROJECT_DIR)/config/engines/vw.cpp \
$(PROJECT_DIR)/config/engines/vw_b6.cpp \
$(PROJECT_DIR)/config/engines/chevrolet_camaro_4.cpp \
$(PROJECT_DIR)/config/engines/chevrolet_c20_1973.cpp \
$(PROJECT_DIR)/config/engines/toyota_jzs147.cpp \
$(PROJECT_DIR)/config/engines/lada_kalina.cpp \
$(PROJECT_DIR)/config/engines/zil130.cpp \
$(PROJECT_DIR)/config/engines/honda_600.cpp \
$(PROJECT_DIR)/config/engines/me7pnp.cpp \
$(PROJECT_DIR)/config/engines/ford_festiva.cpp \

View File

@ -48,7 +48,7 @@ static void setDefaultCustomMaps(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_HONDA_CBR_600_CUSTOM;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N_2;
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
// upside down wiring
engineConfiguration->triggerInputPins[0] = GPIOA_5;
@ -132,7 +132,7 @@ void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->injectionPins[3] = GPIOB_8; // #4
setDefaultCustomMaps(PASS_CONFIG_PARAMETER_SIGNATURE);
setAlgorithm(LM_ALPHA_N_2 PASS_CONFIG_PARAMETER_SUFFIX);
setAlgorithm(LM_ALPHA_N PASS_CONFIG_PARAMETER_SUFFIX);
engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;

View File

@ -6,7 +6,7 @@
* http://rusefi.com/wiki/index.php?title=Vehicle:Mazda_Protege_1993
*
* MIATA_1990 = 19 (Frankenstein board)
* MIATA_1994_DEVIATOR = 20
* MRE_MIATA_94_MAP = 20
* MIATA_1996 = 21
* set engine_type 21
*
@ -247,26 +247,6 @@ static void setMiata1994_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// end of 1994 commond
}
/**
* Frankenso board
* set engine_type 20
*/
void setMiata1994_d(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMiata1994_common(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->vbattDividerCoeff = ((float) (8.2 + 33)) / 8.2 * 2;
/**
* This board was avoiding PE0 & PE1 mosfets altogether
*/
engineConfiguration->injectionPins[0] = GPIOD_7; // avoiding PE1
engineConfiguration->injectionPins[1] = GPIOE_2;
engineConfiguration->injectionPins[2] = GPIOB_8;
engineConfiguration->injectionPins[3] = GPIOB_7;
// todo: add the diode? change idle valve logic?
engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
}
/**
* Tom tomiata, Frankenstein board
*/

View File

@ -15,5 +15,4 @@
void common079721_2351(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1990(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1994_d(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata1996(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -458,3 +458,14 @@ void setMiataNA6_MAP_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#endif /* BOARD_TLE8888_COUNT */
}
void setMiata94_MAP_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMiataNA6_MAP_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->injectionMode = IM_SEQUENTIAL;
engineConfiguration->specs.displacement = 1.8;
strcpy(CONFIG(engineMake), ENGINE_MAKE_MAZDA);
strcpy(CONFIG(engineCode), "94");
}

View File

@ -22,3 +22,5 @@ void miataNAcommon(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiataNA6_MAP_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setMiata94_MAP_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -19,11 +19,6 @@ void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_NISSAN_SR20VE;
engineConfiguration->ignitionPins[0] = GPIOD_7;
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
engineConfiguration->ignitionPins[2] = GPIOD_6;
engineConfiguration->auxValves[0] = GPIOE_14;
engineConfiguration->auxValves[1] = GPIOE_12;
}

View File

@ -55,7 +55,10 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set ignition_mode 2
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
/*
* this configuration is used on HW CI - in HW CI 'inverted' would rightfully fail unless there is pull-up
engineConfiguration->ignitionPinMode = OM_INVERTED;
*/
// set_ignition_channels
engineConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: low side - out #x (?)

View File

@ -1,69 +0,0 @@
/*
* @file zil130.cpp
*
* http://rusefi.com/forum/viewtopic.php?f=15&t=644
*
* set engine_type 42
*
* @date May 4, 2016
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "engine_template.h"
#include "custom_engine.h"
EXTERN_CONFIG;
void setZil130(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->specs.cylindersCount = 8;
engineConfiguration->specs.displacement = 5.9;
engineConfiguration->specs.firingOrder = FO_1_5_4_2_6_3_7_8;
engineConfiguration->injectionMode = IM_BATCH;
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 30;
engineConfiguration->trigger.customSkippedToothCount = 1;
engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
// engineConfiguration->twoWireBatchInjection = true;
engineConfiguration->injectionPinMode = OM_INVERTED;
engineConfiguration->injectionPins[0] = GPIOB_8; // #1
engineConfiguration->injectionPins[1] = GPIOE_2; // #2
engineConfiguration->injectionPins[2] = GPIOE_3; // #3
engineConfiguration->injectionPins[3] = GPIOE_4; // #4
engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED; // #5
engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED; // #6
engineConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
engineConfiguration->ignitionPins[0] = GPIOB_5; // #1
engineConfiguration->ignitionPins[1] = GPIOB_6; // #2
engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; // #3
engineConfiguration->ignitionPins[3] = GPIOB_7; // #4
engineConfiguration->ignitionPins[4] = GPIOC_7; // #5
// fuel pump
engineConfiguration->fuelPumpPin = GPIOD_4;
// idle
engineConfiguration->idle.solenoidPin = GPIOC_14;
engineConfiguration->idle.solenoidPinMode = OM_INVERTED;
engineConfiguration->idle.solenoidFrequency = 300;
engineConfiguration->manIdlePosition = 50; // set_idle_pwm 50
// disable sd_card
engineConfiguration->sdCardCsPin = GPIO_UNASSIGNED;
engineConfiguration->is_enabled_spi_2 = false;
engineConfiguration->is_enabled_spi_3 = false;
engineConfiguration->max31855spiDevice = SPI_NONE;
engineConfiguration->fanPin = GPIO_UNASSIGNED;
}

View File

@ -1,13 +0,0 @@
/*
* @file engine_template.h
*
* @date May 4, 2016
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#include "engine_configuration.h"
void setZil130(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -63,8 +63,6 @@ extern SERIAL_USB_DRIVER EFI_CONSOLE_USB_DEVICE;
static bool isSerialConsoleStarted = false;
static event_listener_t consoleEventListener;
bool consoleByteArrived = false;
void onDataArrived(void) {

View File

@ -279,11 +279,6 @@ void updateDevConsoleState(void) {
*/
static void showFuelInfo2(float rpm, float engineLoad) {
float baseFuelMs = 0; // TODO
float magicAir = SpeedDensityBase::getAirmassImpl(1, 100, convertCelsiusToKelvin(20) PASS_ENGINE_PARAMETER_SUFFIX);
scheduleMsg(&logger, "inj flow %.2fcc/min displacement %.2fL", engineConfiguration->injector.flow,
engineConfiguration->specs.displacement);
@ -303,13 +298,9 @@ static void showFuelInfo2(float rpm, float engineLoad) {
float cltCorrection = engine->engineState.running.coolantTemperatureCoefficient;
floatms_t injectorLag = engine->engineState.running.injectorLag;
scheduleMsg(&logger2, "rpm=%.2f engineLoad=%.2f", rpm, engineLoad);
scheduleMsg(&logger2, "baseFuel=%.2f", baseFuelMs);
scheduleMsg(&logger2, "iatCorrection=%.2f cltCorrection=%.2f injectorLag=%.2f", iatCorrection, cltCorrection,
injectorLag);
float value = getRunningFuel(baseFuelMs PASS_ENGINE_PARAMETER_SUFFIX);
scheduleMsg(&logger2, "injection pulse width: %.2f", value);
}
#endif
}
@ -725,6 +716,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
switch (engineConfiguration->debugMode) {
case DBG_START_STOP:
tsOutputChannels->debugIntField1 = engine->startStopStateToggleCounter;
tsOutputChannels->debugIntField2 = enginePins.starterControl.getLogicValue();
tsOutputChannels->debugIntField3 = enginePins.starterRelayDisable.getLogicValue();
break;
case DBG_STATUS:
tsOutputChannels->debugFloatField1 = timeSeconds;

View File

@ -134,7 +134,7 @@ void startAuxPins(void) {
void stopAuxPins(void) {
#if EFI_PROD_CODE
for (int i = 0;i < AUX_PID_COUNT;i++) {
brain_pin_markUnused(activeConfiguration.auxPidPins[i]);
efiSetPadUnused(activeConfiguration.auxPidPins[i]);
}
#endif /* EFI_PROD_CODE */
}

View File

@ -67,6 +67,12 @@ expected<float> BoostController::observePlant() const {
}
expected<float> BoostController::getSetpoint() const {
// If we're in open loop only mode, disregard any target computation.
// Open loop needs to work even in case of invalid closed loop config
if (engineConfiguration->boostType != CLOSED_LOOP) {
return 0;
}
float rpm = GET_RPM();
auto tps = Sensor::get(SensorType::DriverThrottleIntent);
@ -140,13 +146,14 @@ expected<percent_t> BoostController::getClosedLoop(float target, float manifoldP
void BoostController::setOutput(expected<float> output) {
// TODO: hook up safe duty cycle
float duty = PERCENT_TO_DUTY(output.value_or(/*CONFIG(boostControlSafeDutyCycle)*/ 0));
percent_t percent = output.value_or(/*CONFIG(boostControlSafeDutyCycle)*/ 0);
float duty = PERCENT_TO_DUTY(percent);
if (m_pwm) {
m_pwm->setSimplePwmDutyCycle(duty);
}
setEtbWastegatePosition(duty PASS_ENGINE_PARAMETER_SUFFIX);
setEtbWastegatePosition(percent PASS_ENGINE_PARAMETER_SUFFIX);
}
void BoostController::PeriodicTask() {
@ -205,7 +212,7 @@ void startBoostPin() {
void stopBoostPin() {
#if !EFI_UNIT_TEST
brain_pin_markUnused(activeConfiguration.boostControlPin);
efiSetPadUnused(activeConfiguration.boostControlPin);
#endif /* EFI_UNIT_TEST */
}

View File

@ -910,6 +910,11 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void setEtbIdlePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!Sensor::hasSensor(SensorType::AcceleratorPedal)) {
firmwareError(CUSTOM_NO_ETB_FOR_IDLE, "No ETB to use for idle");
return;
}
for (int i = 0; i < ETB_COUNT; i++) {
if (auto etb = engine->etbControllers[i]) {
etb->setIdlePosition(pos);

View File

@ -55,14 +55,6 @@ void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX) {
float duty = PERCENT_TO_DUTY(position);
if (CONFIG(useETBforIdleControl)) {
if (!Sensor::hasSensor(SensorType::AcceleratorPedal)) {
//todo: something is wrong here in unit test mode?
#if !EFI_UNIT_TEST
firmwareError(CUSTOM_NO_ETB_FOR_IDLE, "No ETB to use for idle");
#endif
return;
}
#if EFI_ELECTRONIC_THROTTLE_BODY
setEtbIdlePosition(position PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_ELECTRONIC_THROTTLE_BODY
@ -124,14 +116,10 @@ bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_PROD_CODE
brain_pin_markUnused(activeConfiguration.stepperEnablePin);
brain_pin_markUnused(activeConfiguration.idle.stepperStepPin);
brain_pin_markUnused(activeConfiguration.idle.solenoidPin);
brain_pin_markUnused(activeConfiguration.secondSolenoidPin);
// brain_pin_markUnused(activeConfiguration.idle.);
// brain_pin_markUnused(activeConfiguration.idle.);
// brain_pin_markUnused(activeConfiguration.idle.);
// brain_pin_markUnused(activeConfiguration.idle.);
efiSetPadUnused(activeConfiguration.stepperEnablePin);
efiSetPadUnused(activeConfiguration.idle.stepperStepPin);
efiSetPadUnused(activeConfiguration.idle.solenoidPin);
efiSetPadUnused(activeConfiguration.secondSolenoidPin);
#endif /* EFI_PROD_CODE */
}

View File

@ -1,7 +1,7 @@
#include "global.h"
#include "rusefi_enums.h"
#include "rusefi_hw_enums.h"
// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Wed Nov 11 04:12:23 UTC 2020
// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Sun Nov 29 03:50:34 UTC 2020
// see also gen_config_and_enums.bat
@ -748,8 +748,8 @@ const char *getEngine_load_mode_e(engine_load_mode_e value){
switch(value) {
case Force_4_bytes_size_engine_load_mode:
return "Force_4_bytes_size_engine_load_mode";
case LM_ALPHA_N_2:
return "LM_ALPHA_N_2";
case LM_ALPHA_N:
return "LM_ALPHA_N";
case LM_MOCK:
return "LM_MOCK";
case LM_REAL_MAF:
@ -831,8 +831,6 @@ case MAZDA_MIATA_NB1:
return "MAZDA_MIATA_NB1";
case MIATA_1990:
return "MIATA_1990";
case MIATA_1994_DEVIATOR:
return "MIATA_1994_DEVIATOR";
case MIATA_1996:
return "MIATA_1996";
case MIATA_NA6_MAP:
@ -853,6 +851,8 @@ case MRE_BOARD_OLD_TEST:
return "MRE_BOARD_OLD_TEST";
case MRE_BODY_CONTROL:
return "MRE_BODY_CONTROL";
case MRE_MIATA_94_MAP:
return "MRE_MIATA_94_MAP";
case MRE_MIATA_NA6_MAP:
return "MRE_MIATA_NA6_MAP";
case MRE_MIATA_NA6_VAF:

View File

@ -79,6 +79,7 @@ class Engine final : public TriggerStateListener {
public:
explicit Engine(persistent_config_s *config);
Engine();
bool isPwmEnabled = true;
IEtbController *etbControllers[ETB_COUNT] = {nullptr};
IFuelComputer *fuelComputer = nullptr;

View File

@ -69,11 +69,9 @@
#include "me7pnp.h"
#include "vw_b6.h"
#include "chevrolet_camaro_4.h"
#include "chevrolet_c20_1973.h"
#include "toyota_jzs147.h"
#include "ford_festiva.h"
#include "lada_kalina.h"
#include "zil130.h"
#include "honda_600.h"
#include "boost_control.h"
#if EFI_IDLE_CONTROL
@ -740,7 +738,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
CONFIG(mapMinBufferLength) = 1;
CONFIG(startCrankingDuration) = 7;
CONFIG(startCrankingDuration) = 3;
CONFIG(compressionRatio) = 9;
@ -1168,6 +1166,8 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
// todo: is it time to replace MICRO_RUS_EFI, PROTEUS, PROMETHEUS_DEFAULTS with MINIMAL_PINS? maybe rename MINIMAL_PINS to DEFAULT?
case PROTEUS:
case PROMETHEUS_DEFAULTS:
case CHEVY_C20_1973:
case ZIL_130:
case MINIMAL_PINS:
// all basic settings are already set in prepareVoidConfiguration(), no need to set anything here
// nothing to do - we do it all in setBoardConfigurationOverrides
@ -1218,6 +1218,9 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case MRE_MIATA_NA6_VAF:
setMiataNA6_VAF_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_94_MAP:
setMiata94_MAP_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NA6_MAP:
setMiataNA6_MAP_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1254,9 +1257,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case HONDA_ACCORD_CD:
setHondaAccordConfigurationThreeWires(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case ZIL_130:
setZil130(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_NA6_MAP:
setMiataNA6_MAP_Frankenso(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1311,9 +1311,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case MIATA_1990:
setMiata1990(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_1994_DEVIATOR:
setMiata1994_d(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MIATA_1996:
setMiata1996(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1359,9 +1356,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case CAMARO_4:
setCamaro4(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case CHEVY_C20_1973:
set1973c20(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case TOYOTA_2JZ_GTE_VVTi:
setToyota_2jz_vics(PASS_CONFIG_PARAMETER_SIGNATURE);
break;

View File

@ -168,7 +168,7 @@ AirmassModelBase* getAirmassModel(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
switch (CONFIG(fuelAlgorithm)) {
case LM_SPEED_DENSITY: return &sdAirmass;
case LM_REAL_MAF: return &mafAirmass;
case LM_ALPHA_N_2: return &alphaNAirmass;
case LM_ALPHA_N: return &alphaNAirmass;
#if EFI_UNIT_TEST
case LM_MOCK: return engine->mockAirmassModel;
#endif

View File

@ -30,7 +30,6 @@
*/
typedef enum {
DEFAULT_FRANKENSO = ET_DEFAULT_FRANKENSO,
MIATA_PROTEUS_TCU = ET_MIATA_TCU_PROTEUS,
/**
* 1995 Dodge Neon
* http://rusefi.com/forum/viewtopic.php?t=360
@ -56,19 +55,26 @@ typedef enum {
*/
GY6_139QMB = 8,
MAZDA_MIATA_NB1 = 9,
ROVER_V8 = ET_ROVER_V8,
MRE_MIATA_NB2_MAP = 11,
MIATA_PROTEUS_TCU = ET_MIATA_TCU_PROTEUS,
MAZDA_MIATA_NB1 = 9,
MRE_MIATA_NB2_MAP = ET_MRE_MIATA_NB2_MAP,
MRE_MIATA_NA6_VAF = ET_MRE_MIATA_NA6_VAF,
MRE_MIATA_NB2_ETB = 13,
MRE_MIATA_NA6_MAP = ET_MRE_MIATA_NA6_MAP,
MRE_MIATA_NB2_MAF = ET_MRE_MIATA_NB2_MAF,
// Frankenstein board
MIATA_1990 = 19,
// Frankenso board
MIATA_NA6_MAP = ET_FRANKENSO_MIATA_NA6,
MRE_MIATA_94_MAP = ET_MRE_MIATA_94_MAP,
MIATA_1996 = 21,
FORD_ESCORT_GT = ET_FORD_ESCORT_GT,
MRE_MIATA_NB2_MAF = ET_MRE_MIATA_NB2_MAF,
MITSU_4G93 = 16,
@ -79,10 +85,6 @@ typedef enum {
HONDA_ACCORD_CD_DIP = 18,
// Frankenstein board
MIATA_1990 = 19,
MIATA_1994_DEVIATOR = 20,
MIATA_1996 = 21,
SUBARU_2003_WRX = 22,
@ -128,8 +130,6 @@ typedef enum {
BMW_M73_F = ET_BMW_M73_F,
// Frankenso board
MIATA_NA6_MAP = ET_FRANKENSO_MIATA_NA6,
ZIL_130 = 42,
@ -192,8 +192,6 @@ typedef enum {
DODGE_RAM = 64,
CITROEN_TU3JP = ET_CITROEN_TU3JP,
MRE_MIATA_NA6_MAP = ET_MRE_MIATA_NA6_MAP,
/**
* this configuration has as few pins configured as possible
@ -456,8 +454,7 @@ typedef enum {
*/
LM_REAL_MAF = 4,
// todo: rename after LM_ALPHA_N is removed
LM_ALPHA_N_2 = 5,
LM_ALPHA_N = 5,
// This mode is for unit testing only, so that tests don't have to rely on a particular real airmass mode
LM_MOCK = 100,

View File

@ -65,34 +65,21 @@ bool isRunningBenchTest(void) {
static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, float onTimeMs, float offTimeMs,
int count) {
int delaySt = delayMs < 1 ? 1 : TIME_MS2I(delayMs);
int onTimeSt = onTimeMs < 1 ? 1 : TIME_MS2I(onTimeMs);
int offTimeSt = offTimeMs < 1 ? 1 : TIME_MS2I(offTimeMs);
if (delaySt < 0) {
scheduleMsg(logger, "Invalid delay %.2f", delayMs);
return;
}
if (onTimeSt <= 0) {
scheduleMsg(logger, "Invalid onTime %.2f", onTimeMs);
return;
}
if (offTimeSt <= 0) {
scheduleMsg(logger, "Invalid offTime %.2f", offTimeMs);
return;
}
scheduleMsg(logger, "Running bench: ON_TIME=%.2f ms OFF_TIME=%.2fms Counter=%d", onTimeMs, offTimeMs, count);
int delayUs = MS2US(maxF(1, delayMs));
int onTimeUs = MS2US(maxF(1, onTimeMs));
int offTimeUs = MS2US(maxF(1, offTimeMs));
scheduleMsg(logger, "Running bench: ON_TIME=%.2f us OFF_TIME=%.2f us Counter=%d", onTimeUs, offTimeUs, count);
scheduleMsg(logger, "output on %s", hwPortname(brainPin));
if (delaySt != 0) {
chThdSleep(delaySt);
}
chThdSleepMicroseconds(delayUs);
isRunningBench = true;
for (int i = 0; i < count; i++) {
output->setValue(true);
chThdSleep(onTimeSt);
chThdSleepMicroseconds(onTimeUs);
output->setValue(false);
chThdSleep(offTimeSt);
chThdSleepMicroseconds(offTimeUs);
}
scheduleMsg(logger, "Done!");
isRunningBench = false;

View File

@ -1,2 +1,2 @@
#pragma once
#define VCS_DATE 20201123
#define VCS_DATE 20201129

View File

@ -78,6 +78,9 @@ void setMockVBattVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
void setMockState(brain_pin_e pin, bool state) {
#if EFI_UNIT_TEST
mockPinStates[static_cast<int>(pin)] = state;
#else
UNUSED(pin);
UNUSED(state);
#endif
}

View File

@ -314,7 +314,7 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now
#endif /* EFI_DEFAILED_LOGGING */
}
static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
ScopePerf perf(PE::HandleFuel);
efiAssertVoid(CUSTOM_STACK_6627, getCurrentRemainingStack() > 128, "lowstck#3");
@ -508,7 +508,7 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
CONFIG(primeInjFalloffTemperature), 0.0f, Sensor::get(SensorType::Clt).value_or(70));
if (pulseLength > 0) {
startSimultaniousInjection(engine);
efitimeus_t turnOffDelayUs = (efitimeus_t)efiRound(MS2US(pulseLength), 1.0f);
int turnOffDelayUs = efiRound(MS2US(pulseLength), 1.0f);
engine->executor.scheduleForLater(sDown, turnOffDelayUs, { &endSimultaniousInjectionOnlyTogglePins, engine });
}
}

View File

@ -319,7 +319,7 @@ bool scheduleOrQueue(AngleBasedEvent *event,
}
}
static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventIndex, IgnitionEvent *event,
static void handleSparkEvent(bool limitedSpark, uint32_t trgEventIndex, IgnitionEvent *event,
int rpm, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
angle_t sparkAngle = event->sparkAngle;
@ -333,14 +333,13 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
return;
}
floatus_t chargeDelayUs = ENGINE(rpmCalculator.oneDegreeUs) * event->dwellPosition.angleOffsetFromTriggerEvent;
int isIgnitionError = chargeDelayUs < 0;
float angleOffset = event->dwellPosition.angleOffsetFromTriggerEvent;
int isIgnitionError = angleOffset < 0;
ignitionErrorDetection.add(isIgnitionError);
if (isIgnitionError) {
#if EFI_PROD_CODE
scheduleMsg(logger, "Negative spark delay=%.2f", chargeDelayUs);
scheduleMsg(logger, "Negative spark delay=%.1f deg", angleOffset);
#endif /* EFI_PROD_CODE */
chargeDelayUs = 0;
return;
}
@ -351,7 +350,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
*/
if (!limitedSpark) {
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs,
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)angleOffset,
event->sparkId);
#endif /* SPARK_EXTREME_LOGGING */
@ -361,7 +360,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
* the coil.
*/
engine->executor.scheduleByTimestampNt(&event->dwellStartTimer, edgeTimestamp + US2NT(chargeDelayUs), { &turnSparkPinHigh, event });
scheduleByAngle(&event->dwellStartTimer, edgeTimestamp, angleOffset, { &turnSparkPinHigh, event } PASS_ENGINE_PARAMETER_SUFFIX);
event->sparksRemaining = ENGINE(engineState.multispark.count);
} else {
@ -421,7 +420,7 @@ void initializeIgnitionActions(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
list->isReady = true;
}
static ALWAYS_INLINE void prepareIgnitionSchedule(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
static void prepareIgnitionSchedule(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
ScopePerf perf(PE::PrepareIgnitionSchedule);
/**

View File

@ -142,7 +142,7 @@ static void lcdPrintf(const char *fmt, ...) {
lcd_HD44780_print_string(lcdLineBuffer);
}
static void showLine(lcd_line_e line, int screenY) {
static void showLine(lcd_line_e line, int /*screenY*/) {
static char buffer[_MAX_FILLER + 2];
switch (line) {

View File

@ -1,4 +1,4 @@
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 22 23:31:54 UTC 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 29 03:21:46 UTC 2020
// by class com.rusefi.output.FileFsioSettingsConsumer
FSIO_SETTING_FANONTEMPERATURE = 1000,

View File

@ -1,4 +1,4 @@
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 22 23:31:54 UTC 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 29 03:21:46 UTC 2020
// by class com.rusefi.output.FileFsioSettingsConsumer
case FSIO_SETTING_FANONTEMPERATURE:

View File

@ -1,4 +1,4 @@
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 22 23:31:54 UTC 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 29 03:21:46 UTC 2020
// by class com.rusefi.output.FileFsioSettingsConsumer
static LENameOrdinalPair lefanOnTemperature(FSIO_SETTING_FANONTEMPERATURE, "cfg_fanOnTemperature");

View File

@ -1,4 +1,4 @@
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 22 23:31:54 UTC 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Nov 29 03:21:46 UTC 2020
// by class com.rusefi.output.FileFsioSettingsConsumer
case FSIO_SETTING_FANONTEMPERATURE:

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD all
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 4111359558
#define TS_SIGNATURE "rusEFI 2020.11.22.all.4111359558"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 3115617215
#define TS_SIGNATURE "rusEFI 2020.11.29.all.3115617215"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD frankenso_na6
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 1669263293
#define TS_SIGNATURE "rusEFI 2020.11.22.frankenso_na6.1669263293"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 801389124
#define TS_SIGNATURE "rusEFI 2020.11.29.frankenso_na6.801389124"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD hellen_cypress
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 1023408261
#define TS_SIGNATURE "rusEFI 2020.11.22.hellen_cypress.1023408261"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 1883581820
#define TS_SIGNATURE "rusEFI 2020.11.29.hellen_cypress.1883581820"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD kin
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 1843643007
#define TS_SIGNATURE "rusEFI 2020.11.22.kin.1843643007"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 559486854
#define TS_SIGNATURE "rusEFI 2020.11.29.kin.559486854"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD mre_f4
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 3806232639
#define TS_SIGNATURE "rusEFI 2020.11.22.mre_f4.3806232639"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 2925811142
#define TS_SIGNATURE "rusEFI 2020.11.29.mre_f4.2925811142"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD mre_f7
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 3806232639
#define TS_SIGNATURE "rusEFI 2020.11.22.mre_f7.3806232639"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 2925811142
#define TS_SIGNATURE "rusEFI 2020.11.29.mre_f7.2925811142"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD prometheus_405
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 3084277783
#define TS_SIGNATURE "rusEFI 2020.11.22.prometheus_405.3084277783"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 4218195438
#define TS_SIGNATURE "rusEFI 2020.11.29.prometheus_405.4218195438"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD prometheus_469
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 3084277783
#define TS_SIGNATURE "rusEFI 2020.11.22.prometheus_469.3084277783"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 4218195438
#define TS_SIGNATURE "rusEFI 2020.11.29.prometheus_469.4218195438"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD proteus_f4
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 1017386136
#define TS_SIGNATURE "rusEFI 2020.11.22.proteus_f4.1017386136"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 1881063777
#define TS_SIGNATURE "rusEFI 2020.11.29.proteus_f4.1881063777"

View File

@ -3,6 +3,6 @@
//
#define SIGNATURE_BOARD proteus_f7
#define SIGNATURE_DATE 2020.11.22
#define SIGNATURE_HASH 1017386136
#define TS_SIGNATURE "rusEFI 2020.11.22.proteus_f7.1017386136"
#define SIGNATURE_DATE 2020.11.29
#define SIGNATURE_HASH 1881063777
#define TS_SIGNATURE "rusEFI 2020.11.29.proteus_f7.1881063777"

View File

@ -67,7 +67,7 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
switch (engineConfiguration->fuelAlgorithm) {
case LM_SPEED_DENSITY:
return getMap(PASS_ENGINE_PARAMETER_SIGNATURE);
case LM_ALPHA_N_2:
case LM_ALPHA_N:
return Sensor::get(SensorType::Tps1).value_or(0);
case LM_REAL_MAF:
return getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -33,7 +33,7 @@ public:
return result;
}
void showInfo(Logging* logger, const char* sensorName) const override {}
void showInfo(Logging* /*logger*/, const char* /*sensorName*/) const override {}
private:
float (*m_func)();

View File

@ -36,7 +36,7 @@ void RedundantSensor::showInfo(Logging* logger, const char* sensorName) const {
scheduleMsg(logger, "Sensor \"%s\" is redundant combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
}
void RpmCalculator::showInfo(Logging* logger, const char* sensorName) const {
void RpmCalculator::showInfo(Logging* logger, const char* /*sensorName*/) const {
scheduleMsg(logger, "RPM sensor: stopped: %d spinning up: %d cranking: %d running: %d rpm: %f",
isStopped(),
isSpinningUp(),

View File

@ -35,7 +35,7 @@ static void completionCallback(ADCDriver* adcp, adcsample_t*, size_t) {
}
}
static void errorCallback(ADCDriver*, adcerror_t err) {
static void errorCallback(ADCDriver*, adcerror_t) {
}
static const uint32_t smpr1 =
@ -91,7 +91,6 @@ static const ADCConversionGroup adcConvGroupCh2 = { FALSE, 1, &completionCallbac
0, // sqr2
ADC_SQR3_SQ1_N(KNOCK_ADC_CH2)
};
#endif // KNOCK_HAS_CH2
static bool cylinderUsesChannel2(uint8_t cylinderIndex) {
// C/C++ can't index in to bit fields, we have to provide lookup ourselves
@ -112,6 +111,8 @@ static bool cylinderUsesChannel2(uint8_t cylinderIndex) {
}
}
#endif // KNOCK_HAS_CH2
const ADCConversionGroup* getConversionGroup(uint8_t cylinderIndex) {
#if KNOCK_HAS_CH2
if (cylinderUsesChannel2(cylinderIndex)) {

View File

@ -145,22 +145,10 @@ const char* getConfigurationName(engine_type_e engineType) {
return "Mi4G93";
case MIATA_1990:
return "MX590";
case MIATA_1994_DEVIATOR:
return "MX594d";
case MIATA_1996:
return "MX596";
case BMW_E34:
return "BMWe34";
case VW_ABA:
return "VW_ABA";
case SACHS:
return "SACHS";
case CAMARO_4:
return "CAMARO_4";
case CHEVY_C20_1973:
return "CHEVY C20";
case DODGE_RAM:
return "DODGE_RAM";
default:
return getEngine_type_e(engineType);
}
@ -570,6 +558,17 @@ static void setIgnitionPin(const char *indexStr, const char *pinName) {
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
}
// this method is useful for desperate time debugging
static void readPin(const char *pinName) {
brain_pin_e pin = parseBrainPin(pinName);
if (pin == GPIO_INVALID) {
scheduleMsg(&logger, "invalid pin name [%s]", pinName);
return;
}
int physicalValue = palReadPad(getHwPort("read", pin), getHwPin("read", pin));
scheduleMsg(&logger, "pin %s value %d", hwPortname(pin), physicalValue);
}
static void setIndividualPin(const char *pinName, brain_pin_e *targetPin, const char *name) {
brain_pin_e pin = parseBrainPin(pinName);
if (pin == GPIO_INVALID) {
@ -887,6 +886,8 @@ static void enableOrDisable(const char *param, bool isEnabled) {
engineConfiguration->canWriteEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, CMD_INJECTION)) {
engineConfiguration->isInjectionEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, CMD_PWM)) {
engine->isPwmEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "trigger_details")) {
engineConfiguration->verboseTriggerSynchDetails = isEnabled;
} else if (strEqualCaseInsensitive(param, "vvt_details")) {
@ -1376,6 +1377,7 @@ void initSettings(void) {
addConsoleActionS("set_cj125_heater_pin", setCj125HeaterPin);
addConsoleActionS("set_trigger_sync_pin", setTriggerSyncPin);
addConsoleActionS("readpin", readPin);
addConsoleActionS("set_can_rx_pin", setCanRxPin);
addConsoleActionS("set_can_tx_pin", setCanTxPin);

View File

@ -7,13 +7,13 @@ EXTERN_CONFIG;
OutputPin tcuSolenoids[TCU_SOLENOID_COUNT];
void SimpleTransmissionController::init() {
for (int i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
for (size_t i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
tcuSolenoids[i].initPin("Transmission Solenoid", CONFIG(tcu_solenoid)[i], &CONFIG(tcu_solenoid_mode)[i]);
}
}
void SimpleTransmissionController::update(gear_e gear) {
for (int i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
for (size_t i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
#ifndef EFI_UNIT_TEST
tcuSolenoids[i].setValue(config->tcuSolenoidTable[static_cast<int>(gear) + 1][i]);
#endif

View File

@ -395,7 +395,7 @@ void OutputPin::toggle() {
}
bool OutputPin::getAndSet(int logicValue) {
bool oldValue = currentLogicValue;
bool oldValue = getLogicValue();
setValue(logicValue);
return oldValue;
}
@ -442,7 +442,8 @@ void OutputPin::setValue(int logicValue) {
}
bool OutputPin::getLogicValue() const {
return currentLogicValue;
// Compare against 1 since it could also be INITIAL_PIN_STATE (which means 0, but we haven't initialized the pin yet)
return currentLogicValue == 1;
}
void OutputPin::setDefaultPinState(const pin_output_mode_e *outputMode) {
@ -542,6 +543,20 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
// mystery state being driven on the pin (potentially dangerous).
setDefaultPinState(outputMode);
efiSetPadMode(msg, brainPin, mode);
if (brain_pin_is_onchip(brainPin)) {
int actualValue = palReadPad(port, pin);
// we had enough drama with pin configuration in board.h and else that we shall self-check
// todo: handle OM_OPENDRAIN and OM_OPENDRAIN_INVERTED as well
if (*outputMode == OM_DEFAULT || *outputMode == OM_INVERTED) {
if (*outputMode == OM_INVERTED) {
actualValue = !actualValue;
}
if (actualValue) {
firmwareError(OBD_PCM_Processor_Fault, "%s: startup pin state %s value=%d mode=%s", msg, hwPortname(brainPin), actualValue, getPin_output_mode_e(*outputMode));
}
}
}
#endif /* EFI_GPIO_HARDWARE */
}
@ -549,7 +564,7 @@ void OutputPin::unregisterOutput(brain_pin_e oldPin) {
if (oldPin != GPIO_UNASSIGNED) {
scheduleMsg(logger, "unregistering %s", hwPortname(oldPin));
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
brain_pin_markUnused(oldPin);
efiSetPadUnused(oldPin);
port = nullptr;
#endif /* EFI_GPIO_HARDWARE */
}

View File

@ -74,7 +74,7 @@ public:
brain_pin_e brainPin;
#endif /* EFI_GPIO_HARDWARE */
int8_t currentLogicValue = 0;
int8_t currentLogicValue = INITIAL_PIN_STATE;
/**
* we track current pin status so that we do not touch the actual hardware if we want to write new pin bit
* which is same as current pin value. This maybe helps in case of status leds, but maybe it's a total over-engineering

View File

@ -13,9 +13,12 @@
#include "pwm_generator_logic.h"
#include "perf_trace.h"
EXTERN_ENGINE;
#if EFI_PROD_CODE
#include "mpu_util.h"
#endif
#include "engine.h"
#endif // EFI_PROD_CODE
// 1% duty cycle
#define ZERO_PWM_THRESHOLD 0.01
@ -375,6 +378,16 @@ void startSimplePwmHard(SimplePwm *state, const char *msg,
* This method takes ~350 ticks.
*/
void applyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
#if EFI_PROD_CODE
if (!engine->isPwmEnabled) {
for (int channelIndex = 0; channelIndex < state->multiChannelStateSequence.waveCount; channelIndex++) {
OutputPin *output = state->outputPins[channelIndex];
output->setValue(0);
}
return;
}
#endif // EFI_PROD_CODE
efiAssertVoid(CUSTOM_ERR_6663, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6664, state->multiChannelStateSequence.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
for (int channelIndex = 0; channelIndex < state->multiChannelStateSequence.waveCount; channelIndex++) {

View File

@ -320,7 +320,7 @@ static char shaft_signal_msg_index[15];
static const bool isUpEvent[6] = { false, true, false, true, false, true };
static const char *eventId[6] = { PROTOCOL_CRANK1, PROTOCOL_CRANK1, PROTOCOL_CRANK2, PROTOCOL_CRANK2, PROTOCOL_CRANK3, PROTOCOL_CRANK3 };
static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
static void reportEventToWaveChart(trigger_event_e ckpSignalType, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!ENGINE(isEngineChartEnabled)) { // this is here just as a shortcut so that we avoid engine sniffer as soon as possible
return; // engineSnifferRpmThreshold is accounted for inside ENGINE(isEngineChartEnabled)
}

View File

@ -27,12 +27,9 @@
#if defined __GNUC__
// GCC
#include <sys/types.h>
#define ALWAYS_INLINE __attribute__((always_inline)) inline
#else
// IAR
typedef unsigned int time_t;
// todo: what's the IAR option?
#define ALWAYS_INLINE INLINE
#endif
#ifdef __cplusplus
@ -99,14 +96,4 @@ typedef unsigned int time_t;
#define CCM_OPTIONAL
#endif /* EFI_USE_CCM */
/**
* converts efitimeus_t to efitick_t
*/
#define US2NT(us) (((efitime_t)(us))*US_TO_NT_MULTIPLIER)
/**
* converts efitick_t to efitimeus_t
*/
#define NT2US(nt) ((nt) / US_TO_NT_MULTIPLIER)
#define UNIT_TEST_BUSY_WAIT_CALLBACK() {}

View File

@ -60,7 +60,7 @@ void ButtonDebounce::stopConfiguration () {
if (*m_pin != active_pin || *m_mode != active_mode || (isActiveConfigurationVoid && (*m_pin != 0 || *m_mode != 0))) {
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
#ifndef EFI_UNIT_TEST
brain_pin_markUnused(active_pin);
efiSetPadUnused(active_pin);
needsInit = true;
#endif /* EFI_UNIT_TEST */
}

View File

@ -217,7 +217,7 @@ void stopDigitalCapture(const char *msg, brain_pin_e brainPin) {
if (brainPin == GPIO_UNASSIGNED) {
return;
}
brain_pin_markUnused(brainPin);
efiSetPadUnused(brainPin);
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
if (driver == NULL) {

View File

@ -156,8 +156,8 @@ static brain_pin_e currentTxPin = GPIO_UNASSIGNED;
static brain_pin_e currentRxPin = GPIO_UNASSIGNED;
void stopCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
brain_pin_markUnused(currentTxPin);
brain_pin_markUnused(currentRxPin);
efiSetPadUnused(currentTxPin);
efiSetPadUnused(currentRxPin);
}
void startCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {

View File

@ -50,8 +50,8 @@ void enableAuxSerial(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void stopAuxSerialPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
brain_pin_markUnused(activeConfiguration.auxSerialTxPin);
brain_pin_markUnused(activeConfiguration.auxSerialRxPin);
efiSetPadUnused(activeConfiguration.auxSerialTxPin);
efiSetPadUnused(activeConfiguration.auxSerialRxPin);
}
void startAuxSerialPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
@ -90,4 +90,4 @@ void initAuxSerial(void) {
serialRead.Start();
}
#endif // EFI_AUX_SERIAL
#endif // EFI_AUX_SERIAL

View File

@ -148,7 +148,10 @@ static Logging *sharedLogger;
static int fastMapSampleIndex;
static int hipSampleIndex;
static int tpsSampleIndex;
#if HAL_TRIGGER_USE_ADC
static int triggerSampleIndex;
#endif
#if HAL_USE_ADC
extern AdcDevice fastAdc;
@ -288,9 +291,9 @@ void stopSpi(spi_device_e device) {
return; // not turned on
}
isSpiInitialized[device] = false;
brain_pin_markUnused(getSckPin(device));
brain_pin_markUnused(getMisoPin(device));
brain_pin_markUnused(getMosiPin(device));
efiSetPadUnused(getSckPin(device));
efiSetPadUnused(getMisoPin(device));
efiSetPadUnused(getMosiPin(device));
#endif /* HAL_USE_SPI */
}
@ -368,7 +371,7 @@ void applyNewHardwareSettings(void) {
stopBoostPin();
#endif
if (isPinOrModeChanged(clutchUpPin, clutchUpPinMode)) {
brain_pin_markUnused(activeConfiguration.clutchUpPin);
efiSetPadUnused(activeConfiguration.clutchUpPin);
}
enginePins.unregisterPins();

View File

@ -58,7 +58,7 @@ void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
if (!wasUsed) {
/*check if on-chip pin or external */
if (brain_pin_is_onchip(brainPin)) {
/* on-cip */
/* on-chip */
ioportid_t port = getHwPort(msg, brainPin);
ioportmask_t pin = getHwPin(msg, brainPin);
/* paranoid */
@ -84,8 +84,11 @@ void efiSetPadUnused(brain_pin_e brainPin)
ioportid_t port = getHwPort("unused", brainPin);
ioportmask_t pin = getHwPin("unused", brainPin);
/* input with pull up, is it safe? */
/* input with pull up, is it safe?
* todo: shall we reuse 'default state' constants with board.h?
* */
palSetPadMode(port, pin, mode);
palWritePad(port, pin, 0);
}
#if (BOARD_EXT_GPIOCHIPS > 0)
else {

View File

@ -10,6 +10,7 @@
#include "global.h"
#define INITIAL_PIN_STATE -1
#define GPIO_NULL NULL
// mode >= 0 is always true since that's an unsigned

View File

@ -47,7 +47,7 @@ enum {
// LCD_2X16_BUSY_FLAG = 0x80,
// LCD_2X16_COMMAND = 0x01,
// LCD_2X16_DATA = 0x00,
} lcd_HD44780_command;
} /*lcd_HD44780_command*/;
// http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html
static const int lineStart[] = { 0, 0x40, 0x14, 0x54 };
@ -169,12 +169,12 @@ static void lcdInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void stopHD44780_pins() {
brain_pin_markUnused(activeConfiguration.HD44780_rs);
brain_pin_markUnused(activeConfiguration.HD44780_e);
brain_pin_markUnused(activeConfiguration.HD44780_db4);
brain_pin_markUnused(activeConfiguration.HD44780_db5);
brain_pin_markUnused(activeConfiguration.HD44780_db6);
brain_pin_markUnused(activeConfiguration.HD44780_db7);
efiSetPadUnused(activeConfiguration.HD44780_rs);
efiSetPadUnused(activeConfiguration.HD44780_e);
efiSetPadUnused(activeConfiguration.HD44780_db4);
efiSetPadUnused(activeConfiguration.HD44780_db5);
efiSetPadUnused(activeConfiguration.HD44780_db6);
efiSetPadUnused(activeConfiguration.HD44780_db7);
}
void startHD44780_pins() {

View File

@ -277,14 +277,12 @@ static void enable_flash() {
}
static void download_RAM(int target) {
unsigned short memory_area = 0; // memory area
unsigned short start_address = 0; // start address
unsigned short codeWidthRegAddr = 0; // code width register address
unsigned short size = 0; // size of RAM data
unsigned short command = 0; // command data
unsigned short data = 0; // RAM data
unsigned int k = 0; // used in loop for writing RAM data to the chip
const unsigned short *RAM_ptr; // pointer to array of data to be sent to the chip
uint16_t memory_area = 0; // memory area
uint16_t start_address = 0; // start address
uint16_t codeWidthRegAddr = 0; // code width register address
uint16_t size = 0; // size of RAM data
uint16_t command = 0; // command data
const uint16_t *RAM_ptr; // pointer to array of data to be sent to the chip
//Why Again? For Every time, just in case?
@ -341,26 +339,16 @@ static void download_RAM(int target) {
command = start_address << 5;
spi_writew(command); // sends start address command
/*
for(k = 0; k < size; k++) // downloads RAM
{
data = *RAM_ptr; // retrieves data to be sent
spi_writew(data); // sends data
RAM_ptr++;
}
*/
spiSend(driver, size, RAM_ptr);
spiUnselect(driver);
}
static void download_register(int r_target) {
unsigned short r_start_address = 0; // start address
unsigned short r_size = 0; // size of configuration data
unsigned short r_command = 0; // command data
unsigned short r_data = 0; // configuration data
int n = 0; // used for loop for writing data to the chip
unsigned short remainder_size = 0; // remainder size
const unsigned short *reg_ptr; // pointer to array of data to be sent to the chip
uint16_t r_start_address = 0; // start address
uint16_t r_size = 0; // size of configuration data
uint16_t r_command = 0; // command data
uint16_t remainder_size = 0; // remainder size
const uint16_t *reg_ptr; // pointer to array of data to be sent to the chip
switch(r_target) // selects target
{

View File

@ -386,8 +386,8 @@ static msg_t hipThread(void *arg) {
void stopHip9001_pins() {
#if EFI_PROD_CODE
brain_pin_markUnused(activeConfiguration.hip9011IntHoldPin);
brain_pin_markUnused(activeConfiguration.hip9011CsPin);
efiSetPadUnused(activeConfiguration.hip9011IntHoldPin);
efiSetPadUnused(activeConfiguration.hip9011CsPin);
#endif /* EFI_PROD_CODE */
}

View File

@ -95,9 +95,9 @@ static bool isJoystickEnabled() {
}
void stopJoystickPins() {
brain_pin_markUnused(activeConfiguration.joystickCenterPin);
brain_pin_markUnused(activeConfiguration.joystickAPin);
brain_pin_markUnused(activeConfiguration.joystickDPin);
efiSetPadUnused(activeConfiguration.joystickCenterPin);
efiSetPadUnused(activeConfiguration.joystickAPin);
efiSetPadUnused(activeConfiguration.joystickDPin);
}
void startJoystickPins() {

View File

@ -260,16 +260,16 @@ void initSmartGpio() {
#if (BOARD_EXT_GPIOCHIPS > 0)
void stopSmartCsPins() {
#if (BOARD_TLE8888_COUNT > 0)
brain_pin_markUnused(activeConfiguration.tle8888_cs);
efiSetPadUnused(activeConfiguration.tle8888_cs);
#endif /* BOARD_TLE8888_COUNT */
#if (BOARD_TLE6240_COUNT > 0)
brain_pin_markUnused(activeConfiguration.tle6240_cs);
efiSetPadUnused(activeConfiguration.tle6240_cs);
#endif /* BOARD_TLE6240_COUNT */
#if (BOARD_MC33972_COUNT > 0)
brain_pin_markUnused(activeConfiguration.mc33972_cs);
efiSetPadUnused(activeConfiguration.mc33972_cs);
#endif /* BOARD_MC33972_COUNT */
#if (BOARD_DRV8860_COUNT > 0)
brain_pin_markUnused(activeConfiguration.drv8860_cs);
efiSetPadUnused(activeConfiguration.drv8860_cs);
#endif /* BOARD_DRV8860_COUNT */
}

View File

@ -195,7 +195,7 @@ bool StepDirectionStepper::pulse() {
}
void StepperHw::pause() const {
chThdSleepMilliseconds(m_reactionTime);
chThdSleepMicroseconds((int)(MS2US(m_reactionTime)));
}
void StepperHw::setReactionTime(float ms) {

View File

@ -409,6 +409,7 @@ end_struct
#define ET_DODGE_NEON_2003_CRANK 46
#define ET_MRE_MIATA_NA6_VAF 12
#define ET_MRE_MIATA_94_MAP 20
#define ET_MRE_MIATA_NB2_MAP 11
#define ET_MRE_MIATA_NB2_MAF 15
#define ET_MRE_BODY_CONTROL 23
@ -967,7 +968,9 @@ custom maf_sensor_type_e 4 bits, S32, @OFFSET@, [0:1], @@maf_sensor_type_e_enum@
pin_output_mode_e drv8860_csPinMode;
brain_pin_e drv8860_miso;
int[64] unusedAtOldBoardConfigurationEnd;;"units", 1, 0, -20, 100, 0
int[63] unusedAtOldBoardConfigurationEnd;;"units", 1, 0, -20, 100, 0
uint16_t vehicleWeight;;"kg", 1, 0, 0, 10000, 0
uint16_t unusedHereHereHere;;"ADC", 1, 0, 0, 1000, 0
uint16_t tps2SecondaryMin;;"ADC", 1, 0, 0, 1000, 0
uint16_t tps2SecondaryMax;;"ADC", 1, 0, 0, 1000, 0
@ -1711,6 +1714,7 @@ end_struct
#define CMD_ENGINE_TYPE "engine_type"
#define CMD_INJECTION "injection"
#define CMD_IGNITION "ignition"
#define CMD_PWM "pwm"
#define CMD_TRIGGERINFO "triggerinfo"
#define CMD_WRITECONFIG "writeconfig"
#define CMD_DATE "date"

View File

@ -415,19 +415,19 @@ enable2ndByteCanID = false
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
; Alternator TPS Acceleration GPPWM Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID FSIO_1_7 CJ125 CAN TLE8888 Analog inputs 2 Boost Start Launcher ETB Autotune FSIO_8_14 FSIO_SPECIAL Injector flow compensation
; DBG_ALTERNATOR_PID DBG_TPS_ACCEL DBG_GPPWM DBG_IDLE_CONTROL
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "GPPWM 1", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "fsio 1", "24:df1", "CJ125: output", "", "", "", "", "", "", "TPS1 Pri/Sec Diff", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude", "", "fsio 8", "idle offset", "Pressure across injector(kpa)", ""
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "GPPWM 2", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "fsio 2", "24:df2", "CJ125: i-term", "", "", "", "", "", "", "TPS2 Pri/Sec Diff", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude", "", "fsio 9", "idle min", "Pressure ratio vs. nominal", ""
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "GPPWM 3", "prev error", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "fsio 3", "24:df3", "CJ125: err", "", "", "", "", "", "", "TPS1/2 Diff", "", "", "", "", "S unused" "", "Tu", "", "fsio 10", "", "Flow ratio vs. configured", ""
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "GPPWM 4", "I Gain", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "fsio 4", "24:df4", "CJ125: UA", "", "", "", "", "", "", "Acc Pedal Pri/Sec Diff","", "", "", "", "S unused" "", "Ku", "", "fsio 11", "", "", ""
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "D Gain", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "fsio 5", "24:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp", "", "fsio 12", "", "", ""
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "D Term", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "fsio 6", "24:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki", "", "fsio 13", "", "", ""
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "Max-Value", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "fsio 7", "24:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd", "", "fsio 14", "", "", ""
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "GPPWM 1", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "fsio 1", "24:df1", "CJ125: output", "", "", "", "", "", "", "TPS1 Pri/Sec Diff", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude", "", "fsio 8", "idle offset", "Pressure across injector(kpa)", ""
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "GPPWM 2", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "fsio 2", "24:df2", "CJ125: i-term", "", "", "", "", "", "", "TPS2 Pri/Sec Diff", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude", "", "fsio 9", "idle min", "Pressure ratio vs. nominal", ""
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "GPPWM 3", "prev error", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "fsio 3", "24:df3", "CJ125: err", "", "", "", "", "", "", "TPS1/2 Diff", "", "", "", "", "S unused" "", "Tu", "", "fsio 10", "", "Flow ratio vs. configured", ""
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "GPPWM 4", "I Gain", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "fsio 4", "24:df4", "CJ125: UA", "", "", "", "", "", "", "Acc Pedal Pri/Sec Diff","", "", "", "", "S unused" "", "Ku", "", "fsio 11", "", "", ""
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "D Gain", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "fsio 5", "24:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp", "", "fsio 12", "", "", ""
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "D Term", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "fsio 6", "24:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki", "", "fsio 13", "", "", ""
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "Max-Value", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "fsio 7", "24:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd", "", "fsio 14", "", "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "P-Gain", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "24:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", "", "", "", "", "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "Offset", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "24:di2", "", "write count","", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", "", "", "", "", "", ""
debugFieldI3List = bits, U08, [0:7], "Reset Cnt", "", "", "Reset Cnt", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "24:di3", "", "write err", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", "", "", "", "", "", ""
debugFieldI4List = bits, U08, [0:7], "Period", "", "", "State", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "24:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", "", "", "", "", "", ""
debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "di5", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "", "di5", "di5", "di5", "di5", "S di5" "", "", "", "", "", "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "P-Gain", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "24:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count", "", "", "", "", "", "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "Offset", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "24:di2", "", "write count","", "", "", "", "Latest Transmit","", "", "", "", "", "Starter Enable", "", "", "", "", "", "", ""
debugFieldI3List = bits, U08, [0:7], "Reset Cnt", "", "", "Reset Cnt", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "24:di3", "", "write err", "", "", "", "", "Latest Received","", "", "", "", "", "Starter Disable","", "", "", "", "", "", ""
debugFieldI4List = bits, U08, [0:7], "Period", "", "", "State", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "24:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", "", "", "", "", "", ""
debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "di5", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "", "di5", "di5", "di5", "di5", "S di5" "", "", "", "", "", "", ""
[ConstantsExtensions]
; defaultValue is used to provide TunerStudio with a value to use in the case of
@ -1617,6 +1617,8 @@ cmd_set_engine_type_microRusEFI_Miata_NA6_VAF = "@@TS_IO_TEST_COMMAND_char@@\x
cmd_set_engine_type_microRusEFI_Miata_NA6_MAP = "@@TS_IO_TEST_COMMAND_char@@\x00\x30@@ET_MRE_MIATA_NA6_MAP_16_hex@@"
cmd_set_engine_type_microRusEFI_Miata_94_MAP = "@@TS_IO_TEST_COMMAND_char@@\x00\x30@@ET_MRE_MIATA_94_MAP_16_hex@@"
; MRE_MIATA_NB2_MAF = 15
cmd_set_engine_type_microRusEFI_Miata_NB2_MAF = "@@TS_IO_TEST_COMMAND_char@@\x00\x30@@ET_MRE_MIATA_NB2_MAF_16_hex@@"
@ -1704,6 +1706,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "Number of Cylinders", cylindersCount
field = "Engine Displacement", displacement
field = "Firing Order", firingOrder
field = "Vehicle Weight", vehicleWeight
; this field is useful for rusEFI online catalog
field = "Compression Ratio", compressionRatio
; this field is useful for rusEFI online catalog
@ -3212,6 +3215,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
commandButton = "microRusEFI Miata NA6 VAF", cmd_set_engine_type_microRusEFI_Miata_NA6_VAF@@if_show_microRusEFI_presets
commandButton = "microRusEFI Miata NA6 MAP", cmd_set_engine_type_microRusEFI_Miata_NA6_MAP@@if_show_microRusEFI_presets
commandButton = "microRusEFI Miata 94/95 MAP", cmd_set_engine_type_microRusEFI_Miata_94_MAP@@if_show_microRusEFI_presets
commandButton = "microRusEfi Miata NB2 MAP", cmd_set_engine_type_microRusEFI_Miata_NB2_MAP@@if_show_microRusEFI_presets
commandButton = "microRusEFI Miata NB2 MAF", cmd_set_engine_type_microRusEFI_Miata_NB2_MAF@@if_show_microRusEFI_presets
commandButton = "microRusEFI Defaults", cmd_set_engine_type_microRusEFI_Defaults@@if_show_microRusEFI_presets

View File

@ -19,8 +19,17 @@
#define MS2US(MS_TIME) ((MS_TIME) * 1000)
// microseconds to ticks
#define US2NT(us) (((efitime_t)(us)) * US_TO_NT_MULTIPLIER)
#define USF2NT(us_float) ((us_float) * US_TO_NT_MULTIPLIER)
// And back
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
// milliseconds to ticks
#define MS2NT(msTime) US2NT(MS2US(msTime))
#define MSF2NT(msTimeFloat) USF2NT(MS2US(msTimeFloat))
/**
* We use this 'deep in past, before ECU has ever started' value as a way to unify

View File

@ -59,15 +59,23 @@ public class BaseTest {
log.info("AUTOTEST setEngineType " + type);
currentEngineType = type;
// sendCommand(CMD_PINS);
/*
* we need to stop all activity - that means:
* - stopping input event
* - waiting for scheduled actuator actions to run out
* - disabling PWM
*/
sendCommand(getDisableCommand(Fields.CMD_SELF_STIMULATION));
sendCommand(getDisableCommand(Fields.CMD_INJECTION));
sendCommand(getDisableCommand(Fields.CMD_IGNITION));
sendCommand(getDisableCommand(Fields.CMD_PWM));
// changing engine type while engine is running does not work well - we rightfully
// get invalid configuration critical errors
sleepSeconds(2);
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + type, COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT);
// TODO: document the reason for this sleep?!
sleepSeconds(3);
sendCommand(getEnableCommand(Fields.CMD_PWM));
sendCommand(getEnableCommand(Fields.CMD_SELF_STIMULATION));
}
}

View File

@ -30,12 +30,6 @@
#define US_TO_NT_MULTIPLIER 100
#define ALWAYS_INLINE
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
// need to fight 32bit int overflow
#define MY_US2ST(x) ((x) / 10)

View File

@ -17,6 +17,8 @@
#include "sensor.h"
#include "mocks.h"
#include <unordered_map>
extern EnginePins enginePins;
class EngineTestHelperBase

View File

@ -58,12 +58,6 @@ void print(const char *fmt, ...);
#define VCS_VERSION "321"
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
#define ALWAYS_INLINE INLINE
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
#define INLINE inline
#define EFI_ERROR_CODE 0xffffffff

View File

@ -15,6 +15,7 @@ TEST(BoostControl, Setpoint) {
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
engineConfiguration->boostType = CLOSED_LOOP;
BoostController bc;
INJECT_ENGINE_REFERENCE(&bc);
@ -114,7 +115,7 @@ TEST(BoostControl, SetOutput) {
INJECT_ENGINE_REFERENCE(&bc);
// ETB wastegate position & PWM should both be set
EXPECT_CALL(etb, setWastegatePosition(0.25f));
EXPECT_CALL(etb, setWastegatePosition(25.0f));
EXPECT_CALL(pwm, setSimplePwmDutyCycle(0.25f));
// Don't crash if not init'd (don't deref null ptr m_pwm)

View File

@ -9,7 +9,8 @@
#include "engine_controller.h"
TEST(start, startStop) {
WITH_ENGINE_TEST_HELPER(BMW_M73_PROTEUS);
std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }};
WITH_ENGINE_TEST_HELPER_SENS(BMW_M73_PROTEUS, sensorVals);
eth.smartMoveTimeForwardSeconds(1); // '0' time has special meaning for implementation so let's move forward
// this is a pull-up, so 'true' on start-up

View File

@ -525,7 +525,6 @@ TEST(misc, testTriggerDecoder) {
}
testTriggerDecoder2("miata 1990", MIATA_1990, 11, 0.2985, 0.3890);
testTriggerDecoder3("miata 1994", MIATA_1994_DEVIATOR, 11, 0.2985, 0.3890, MIATA_NA_GAP);
testTriggerDecoder3("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0, 2.9994);
testTriggerDecoder2("CAMARO_4", CAMARO_4, 40, 0.5, 0);