Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
57e3b9b644
|
@ -433,6 +433,7 @@ void Engine::injectEngineReferences() {
|
|||
|
||||
INJECT_ENGINE_REFERENCE(&primaryTriggerConfiguration);
|
||||
INJECT_ENGINE_REFERENCE(&vvtTriggerConfiguration);
|
||||
INJECT_ENGINE_REFERENCE(&limpManager);
|
||||
|
||||
primaryTriggerConfiguration.update();
|
||||
vvtTriggerConfiguration.update();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "local_version_holder.h"
|
||||
#include "buttonshift.h"
|
||||
#include "gear_controller.h"
|
||||
#include "limp_manager.h"
|
||||
|
||||
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
||||
// PROD real firmware uses this implementation
|
||||
|
@ -262,7 +263,6 @@ public:
|
|||
efitimeus_t acSwitchLastChangeTime = 0;
|
||||
|
||||
bool isRunningPwmTest = false;
|
||||
bool isRpmHardLimit = false;
|
||||
|
||||
int getRpmHardLimit(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
@ -375,6 +375,8 @@ public:
|
|||
|
||||
AirmassModelBase* mockAirmassModel = nullptr;
|
||||
|
||||
LimpManager limpManager;
|
||||
|
||||
private:
|
||||
/**
|
||||
* By the way:
|
||||
|
|
|
@ -181,6 +181,8 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
updateLaunchConditions(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif //EFI_LAUNCH_CONTROL
|
||||
|
||||
engine->limpManager.updateState(rpm);
|
||||
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ CONTROLLERS_SRC_CPP = \
|
|||
$(CONTROLLERS_DIR)/gear_controller.cpp \
|
||||
$(CONTROLLERS_DIR)/start_stop.cpp \
|
||||
$(CONTROLLERS_DIR)/simple_tcu.cpp \
|
||||
$(CONTROLLERS_DIR)/limp_manager.cpp \
|
||||
|
||||
CONTROLLERS_INC=\
|
||||
$(CONTROLLERS_DIR) \
|
||||
|
|
|
@ -244,6 +244,7 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
|
|||
#if EFI_PROD_CODE
|
||||
if (hasFirmwareErrorFlag)
|
||||
return;
|
||||
engine->limpManager.fatalError();
|
||||
engine->engineState.warnings.addWarningCode(code);
|
||||
#ifdef EFI_PRINT_ERRORS_AS_WARNINGS
|
||||
va_list ap;
|
||||
|
|
|
@ -423,16 +423,10 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE
|
|||
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
|
||||
return;
|
||||
}
|
||||
bool limitedSpark = ENGINE(isRpmHardLimit);
|
||||
bool limitedFuel = ENGINE(isRpmHardLimit);
|
||||
|
||||
if (CONFIG(boostCutPressure) != 0) {
|
||||
// todo: move part of this to periodicFast? probably not cool to decode MAP sensor inside trigger callback?
|
||||
if (getMap(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(boostCutPressure)) {
|
||||
limitedSpark = true;
|
||||
limitedFuel = true;
|
||||
}
|
||||
}
|
||||
bool limitedSpark = !ENGINE(limpManager).allowIgnition();
|
||||
bool limitedFuel = !ENGINE(limpManager).allowInjection();
|
||||
|
||||
#if EFI_LAUNCH_CONTROL
|
||||
if (engine->isLaunchCondition && !limitedSpark && !limitedFuel) {
|
||||
/* in case we are not already on a limited conditions, check launch as well */
|
||||
|
|
|
@ -268,7 +268,6 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
|||
}
|
||||
rpmState->onNewEngineCycle();
|
||||
rpmState->lastRpmEventTimeNt = nowNt;
|
||||
engine->isRpmHardLimit = GET_RPM() > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD all
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 3327659370
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.all.3327659370"
|
||||
#define SIGNATURE_HASH 267210507
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.all.267210507"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD frankenso_na6
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 1344846993
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.frankenso_na6.1344846993"
|
||||
#define SIGNATURE_HASH 2577268464
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.frankenso_na6.2577268464"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD hellen_cypress
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 262777769
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.hellen_cypress.262777769"
|
||||
#define SIGNATURE_HASH 3323783624
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.hellen_cypress.3323783624"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD kin
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 1588957523
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.kin.1588957523"
|
||||
#define SIGNATURE_HASH 2533413682
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.kin.2533413682"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD mre_f4
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 3515405075
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.mre_f4.3515405075"
|
||||
#define SIGNATURE_HASH 406688114
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.mre_f4.406688114"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD mre_f7
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 3515405075
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.mre_f7.3515405075"
|
||||
#define SIGNATURE_HASH 406688114
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.mre_f7.406688114"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD prometheus_405
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 2222983995
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.prometheus_405.2222983995"
|
||||
#define SIGNATURE_HASH 1295337818
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.prometheus_405.1295337818"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD prometheus_469
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 2222983995
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.prometheus_469.2222983995"
|
||||
#define SIGNATURE_HASH 1295337818
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.prometheus_469.1295337818"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD proteus_f4
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 267536308
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.proteus_f4.267536308"
|
||||
#define SIGNATURE_HASH 3326543317
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.proteus_f4.3326543317"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#define SIGNATURE_BOARD proteus_f7
|
||||
#define SIGNATURE_DATE 2020.12.26
|
||||
#define SIGNATURE_HASH 267536308
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.proteus_f7.267536308"
|
||||
#define SIGNATURE_HASH 3326543317
|
||||
#define TS_SIGNATURE "rusEFI 2020.12.26.proteus_f7.3326543317"
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
#include "limp_manager.h"
|
||||
#include "engine.h"
|
||||
#include "map.h"
|
||||
#include "efilib.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
void LimpManager::updateState(int rpm) {
|
||||
// User-configured hard RPM limit
|
||||
bool isRevLimited = rpm > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
// TODO: user configurable what gets limited
|
||||
bool limitFuel = isRevLimited;
|
||||
bool limitSpark = isRevLimited;
|
||||
|
||||
// Force fuel limiting on the fault rev limit
|
||||
if (rpm > m_faultRevLimit) {
|
||||
limitFuel = true;
|
||||
}
|
||||
|
||||
// Limit fuel only on boost pressure (limiting spark bends valves)
|
||||
if (CONFIG(boostCutPressure) != 0) {
|
||||
if (getMap(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(boostCutPressure)) {
|
||||
limitFuel = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_transientLimitInjection = limitFuel;
|
||||
m_transientLimitIgnition = limitSpark;
|
||||
}
|
||||
|
||||
void LimpManager::etbProblem() {
|
||||
m_allowEtb.clear();
|
||||
setFaultRevLimit(1500);
|
||||
}
|
||||
|
||||
void LimpManager::fatalError() {
|
||||
m_allowEtb.clear();
|
||||
m_allowIgnition.clear();
|
||||
m_allowInjection.clear();
|
||||
m_allowTriggerInput.clear();
|
||||
|
||||
setFaultRevLimit(0);
|
||||
}
|
||||
|
||||
void LimpManager::setFaultRevLimit(int limit) {
|
||||
// Only allow decreasing the limit
|
||||
// aka uses the limit of the worst fault to yet occur
|
||||
m_faultRevLimit = minI(m_faultRevLimit, limit);
|
||||
}
|
||||
|
||||
bool LimpManager::allowElectronicThrottle() const {
|
||||
return m_allowEtb;
|
||||
}
|
||||
|
||||
bool LimpManager::allowTriggerInput() const {
|
||||
return m_allowTriggerInput;
|
||||
}
|
||||
|
||||
bool LimpManager::allowInjection() const {
|
||||
return !m_transientLimitInjection && m_allowInjection;
|
||||
}
|
||||
|
||||
bool LimpManager::allowIgnition() const {
|
||||
return !m_transientLimitIgnition && m_allowIgnition;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#pragma once
|
||||
|
||||
#include "engine_ptr.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
// Only allows clearing the value, but never resetting it.
|
||||
class Clearable {
|
||||
public:
|
||||
void clear() {
|
||||
m_value = false;
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_value = true;
|
||||
};
|
||||
|
||||
class LimpManager {
|
||||
public:
|
||||
DECLARE_ENGINE_PTR;
|
||||
|
||||
// This is called from periodicFastCallback to update internal state
|
||||
void updateState(int rpm);
|
||||
|
||||
// Other subsystems call these APIs to determine their behavior
|
||||
bool allowElectronicThrottle() const;
|
||||
|
||||
bool allowInjection() const;
|
||||
bool allowIgnition() const;
|
||||
|
||||
bool allowTriggerInput() const;
|
||||
|
||||
// Other subsystems call these APIs to indicate a problem has occured
|
||||
void etbProblem();
|
||||
void fatalError();
|
||||
|
||||
private:
|
||||
void setFaultRevLimit(int limit);
|
||||
|
||||
// Start with no fault rev limit
|
||||
int32_t m_faultRevLimit = INT32_MAX;
|
||||
|
||||
Clearable m_allowEtb;
|
||||
Clearable m_allowInjection;
|
||||
Clearable m_allowIgnition;
|
||||
Clearable m_allowTriggerInput;
|
||||
|
||||
bool m_transientLimitInjection = false;
|
||||
bool m_transientLimitIgnition = false;
|
||||
};
|
|
@ -276,6 +276,11 @@ uint32_t triggerMaxDuration = 0;
|
|||
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
|
||||
ScopePerf perf(PE::HandleShaftSignal);
|
||||
|
||||
// Don't accept trigger input in case of some problems
|
||||
if (!engine->limpManager.allowTriggerInput()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if VR_HW_CHECK_MODE
|
||||
// some boards do not have hardware VR input LEDs which makes such boards harder to validate
|
||||
// from experience we know that assembly mistakes happen and quality control is required
|
||||
|
|
|
@ -37,8 +37,6 @@ static void shaft_callback(void *arg) {
|
|||
|
||||
// todo: support for 3rd trigger input channel
|
||||
// todo: start using real event time from HW event, not just software timer?
|
||||
if (hasFirmwareErrorFlag)
|
||||
return;
|
||||
|
||||
bool isPrimary = pal_line == primary_line;
|
||||
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
|
||||
|
|
|
@ -65,8 +65,7 @@ static void shaftRisingCallback(bool isPrimary) {
|
|||
}
|
||||
icuRisingCallbackCounter++;
|
||||
// todo: support for 3rd trigger input channel
|
||||
if (hasFirmwareErrorFlag)
|
||||
return;
|
||||
|
||||
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
|
||||
return;
|
||||
}
|
||||
|
@ -86,8 +85,6 @@ static void shaftFallingCallback(bool isPrimary) {
|
|||
|
||||
icuFallingCallbackCounter++;
|
||||
|
||||
if (hasFirmwareErrorFlag)
|
||||
return;
|
||||
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,6 @@
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
extern bool hasFirmwareErrorFlag;
|
||||
|
||||
#if HAL_USE_SPI
|
||||
extern bool isSpiInitialized[5];
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@ extern "C" void toggleLed(int led, int mode);
|
|||
#define BOARD_MOD1_PORT GPIOD
|
||||
#define BOARD_MOD1_PIN 5
|
||||
|
||||
|
||||
extern bool hasFirmwareErrorFlag;
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
static Logging *logger;
|
||||
|
@ -116,8 +113,6 @@ static void onTriggerChanged(efitick_t stamp, bool isPrimary, bool isRising) {
|
|||
#if 1
|
||||
// todo: support for 3rd trigger input channel
|
||||
// todo: start using real event time from HW event, not just software timer?
|
||||
if (hasFirmwareErrorFlag)
|
||||
return;
|
||||
|
||||
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
|
||||
return;
|
||||
|
|
Binary file not shown.
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.all.3327659370"
|
||||
signature = "rusEFI 2020.12.26.all.267210507"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.all.3327659370" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.all.267210507" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:04 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:38 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2954,10 +2954,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.frankenso_na6.1344846993"
|
||||
signature = "rusEFI 2020.12.26.frankenso_na6.2577268464"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.frankenso_na6.1344846993" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.frankenso_na6.2577268464" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:10 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:43 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2954,10 +2954,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.hellen_cypress.262777769"
|
||||
signature = "rusEFI 2020.12.26.hellen_cypress.3323783624"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.hellen_cypress.262777769" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.hellen_cypress.3323783624" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Sat Dec 26 18:43:31 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Sat Dec 26 21:18:00 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2954,10 +2954,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.kin.1588957523"
|
||||
signature = "rusEFI 2020.12.26.kin.2533413682"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.kin.1588957523" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.kin.2533413682" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Sat Dec 26 18:43:23 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Sat Dec 26 21:17:51 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2954,10 +2954,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.mre_f4.3515405075"
|
||||
signature = "rusEFI 2020.12.26.mre_f4.406688114"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.mre_f4.3515405075" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.mre_f4.406688114" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:08 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:41 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2950,10 +2950,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.mre_f7.3515405075"
|
||||
signature = "rusEFI 2020.12.26.mre_f7.406688114"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.mre_f7.3515405075" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.mre_f7.406688114" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:06 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:39 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2950,10 +2950,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.prometheus_405.2222983995"
|
||||
signature = "rusEFI 2020.12.26.prometheus_405.1295337818"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.prometheus_405.2222983995" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.prometheus_405.1295337818" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:15 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:46 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2950,10 +2950,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.prometheus_469.2222983995"
|
||||
signature = "rusEFI 2020.12.26.prometheus_469.1295337818"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.prometheus_469.2222983995" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.prometheus_469.1295337818" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:13 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:44 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2950,10 +2950,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.proteus_f4.267536308"
|
||||
signature = "rusEFI 2020.12.26.proteus_f4.3326543317"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.proteus_f4.267536308" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.proteus_f4.3326543317" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:20 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:49 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2946,10 +2946,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2020.12.26.proteus_f7.267536308"
|
||||
signature = "rusEFI 2020.12.26.proteus_f7.3326543317"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2020.12.26.proteus_f7.267536308" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2020.12.26.proteus_f7.3326543317" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 18:43:18 UTC 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sat Dec 26 21:17:48 UTC 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2946,10 +2946,6 @@ cmd_test_spk9 = "Z\x00\x12\x00\x09"
|
|||
cmd_test_spk10 = "Z\x00\x12\x00\x0a"
|
||||
cmd_test_spk11 = "Z\x00\x12\x00\x0b"
|
||||
cmd_test_spk12 = "Z\x00\x12\x00\x0c"
|
||||
cmd_test_spk13 = "Z\x00\x12\x00\x0d"
|
||||
cmd_test_spk14 = "Z\x00\x12\x00\x0e"
|
||||
cmd_test_spk15 = "Z\x00\x12\x00\x0f"
|
||||
cmd_test_spk16 = "Z\x00\x12\x00\x10"
|
||||
|
||||
cmd_test_fsio1 = "Z\x00\x21\x00\x01"
|
||||
cmd_test_fsio2 = "Z\x00\x21\x00\x02"
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.junit.Test;
|
|||
import static com.rusefi.IoUtil.getEnableCommand;
|
||||
import static com.rusefi.TestingUtils.*;
|
||||
import static com.rusefi.config.generated.Fields.*;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
/**
|
||||
* rusEfi firmware simulator functional test suite
|
||||
|
@ -93,6 +94,52 @@ public class FunctionalTest extends RusefiTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevLimiter() {
|
||||
String msg = "rev limiter";
|
||||
|
||||
ecu.setEngineType(ET_FORD_ASPIRE);
|
||||
ecu.changeRpm(2000);
|
||||
|
||||
// Alpha-N mode so that we actually inject some fuel (without mocking tons of sensors)
|
||||
ecu.sendCommand("set algorithm 5");
|
||||
// Set tps to 25% - make alpha-n happy
|
||||
ecu.sendCommand("set_sensor_mock 10 25");
|
||||
ecu.sendCommand("set rpm_hard_limit 2500");
|
||||
|
||||
{
|
||||
// Check that neither ignition nor injection is cut
|
||||
EngineChart chart = nextChart();
|
||||
|
||||
assertWaveNotNull(chart, EngineChart.SPARK_1);
|
||||
assertWaveNotNull(chart, EngineChart.INJECTOR_1);
|
||||
}
|
||||
|
||||
// Now go above the hard limiter
|
||||
ecu.changeRpm(3000);
|
||||
|
||||
{
|
||||
// Check that both ignition and injection are cut
|
||||
EngineChart chart = nextChart();
|
||||
|
||||
// These channels are allowed to have falling edges - aka closing injectors and firing coils
|
||||
// but not allowed to have rising edges - aka opening injectors and charging coils
|
||||
assertWaveNoRises(chart, EngineChart.SPARK_1);
|
||||
assertWaveNoRises(chart, EngineChart.INJECTOR_1);
|
||||
}
|
||||
|
||||
// Check that it recovers when we go back under the limit
|
||||
ecu.changeRpm(2000);
|
||||
|
||||
{
|
||||
// Check that neither ignition nor injection is cut
|
||||
EngineChart chart = nextChart();
|
||||
|
||||
assertWaveNotNull(chart, EngineChart.SPARK_1);
|
||||
assertWaveNotNull(chart, EngineChart.INJECTOR_1);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomEngine() {
|
||||
ecu.setEngineType(ET_DEFAULT_FRANKENSO);
|
||||
|
@ -421,6 +468,18 @@ public class FunctionalTest extends RusefiTestBase {
|
|||
assertTrue(chart.get(key) != null);
|
||||
}
|
||||
|
||||
private static void assertWaveNoRises(EngineChart chart, String key) {
|
||||
StringBuilder events = chart.get(key);
|
||||
|
||||
// if no events of this type at all, return since this passes the test
|
||||
if (events == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Assert that there are no up (rise) events in the channel's sequence
|
||||
assertFalse(events.toString().contains("u"));
|
||||
}
|
||||
|
||||
private EngineChart nextChart() {
|
||||
return TestingUtils.nextChart(ecu.commandQueue);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
#include "limp_manager.h"
|
||||
#include "engine_test_helper.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(limp, testFatalError) {
|
||||
LimpManager dut;
|
||||
|
||||
// Everything should work by default
|
||||
ASSERT_TRUE(dut.allowElectronicThrottle());
|
||||
ASSERT_TRUE(dut.allowIgnition());
|
||||
ASSERT_TRUE(dut.allowInjection());
|
||||
ASSERT_TRUE(dut.allowTriggerInput());
|
||||
|
||||
dut.fatalError();
|
||||
|
||||
// Fatal error should kill everything
|
||||
EXPECT_FALSE(dut.allowElectronicThrottle());
|
||||
EXPECT_FALSE(dut.allowIgnition());
|
||||
EXPECT_FALSE(dut.allowInjection());
|
||||
EXPECT_FALSE(dut.allowTriggerInput());
|
||||
}
|
||||
|
||||
TEST(limp, revLimit) {
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
engineConfiguration->rpmHardLimit = 2500;
|
||||
|
||||
LimpManager dut;
|
||||
INJECT_ENGINE_REFERENCE(&dut);
|
||||
|
||||
// Under rev limit, inj/ign allowed
|
||||
dut.updateState(2000);
|
||||
EXPECT_TRUE(dut.allowIgnition());
|
||||
EXPECT_TRUE(dut.allowInjection());
|
||||
|
||||
// Over rev limit, no injection
|
||||
dut.updateState(3000);
|
||||
EXPECT_FALSE(dut.allowIgnition());
|
||||
EXPECT_FALSE(dut.allowInjection());
|
||||
|
||||
// Now recover back to under limit
|
||||
dut.updateState(2000);
|
||||
EXPECT_TRUE(dut.allowIgnition());
|
||||
EXPECT_TRUE(dut.allowInjection());
|
||||
}
|
||||
|
||||
TEST(limp, boostCut) {
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
// Cut above 100kPa
|
||||
engineConfiguration->boostCutPressure = 100;
|
||||
|
||||
LimpManager dut;
|
||||
INJECT_ENGINE_REFERENCE(&dut);
|
||||
|
||||
// Below threshold, injection allowed
|
||||
engine->mockMapValue = 80;
|
||||
dut.updateState(1000);
|
||||
EXPECT_TRUE(dut.allowInjection());
|
||||
|
||||
// Above threshold, injection cut
|
||||
engine->mockMapValue = 120;
|
||||
dut.updateState(1000);
|
||||
EXPECT_FALSE(dut.allowInjection());
|
||||
|
||||
// Below threshold, should recover
|
||||
engine->mockMapValue = 80;
|
||||
dut.updateState(1000);
|
||||
EXPECT_TRUE(dut.allowInjection());
|
||||
|
||||
// SPECIAL CASE: threshold of 0 means never boost cut
|
||||
engineConfiguration->boostCutPressure = 0;
|
||||
engine->mockMapValue = 500;
|
||||
dut.updateState(1000);
|
||||
EXPECT_TRUE(dut.allowInjection());
|
||||
}
|
|
@ -64,4 +64,5 @@ TESTS_SRC_CPP = \
|
|||
tests/test_binary_log.cpp \
|
||||
tests/test_dynoview.cpp \
|
||||
tests/test_gpio.cpp \
|
||||
tests/test_limp.cpp \
|
||||
|
||||
|
|
Loading…
Reference in New Issue