Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3aa6d497d7
|
@ -168,7 +168,7 @@ void turnInjectionPinLow(InjectionEvent *event) {
|
|||
ENGINE(injectionEvents.addFuelEventsForCylinder(event->ownIndex PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionEvent *event,
|
||||
void handleFuelInjectionEvent(int injEventIndex, InjectionEvent *event,
|
||||
int rpm, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
|
||||
/**
|
||||
|
@ -310,6 +310,11 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
|
|||
return;
|
||||
}
|
||||
|
||||
// If duty cycle is high, impose a fuel cut rev limiter.
|
||||
// This is safer than attempting to limp along with injectors or a pump that are out of flow.
|
||||
if (getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX) > 96.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignition events are defined by addFuelEvents() according to selected
|
||||
|
|
|
@ -24,3 +24,7 @@ void turnInjectionPinLow(InjectionEvent *event);
|
|||
|
||||
// reset injection switch counter if the engine started spinning
|
||||
void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
// Internal use only - exposed for tests
|
||||
void handleFuelInjectionEvent(int injEventIndex, InjectionEvent *event,
|
||||
int rpm, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
|
@ -89,7 +89,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.bat integration\rusefi_config.txt Tue May 12 14:30:02 EDT 2020
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed May 13 23:48:09 EDT 2020
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
@ -2663,6 +2663,7 @@ menuDialog = main
|
|||
subMenu = engineTypeDialog, "Popular vehicles"
|
||||
subMenu = std_separator
|
||||
|
||||
subMenu = spiFunction, "SPI"
|
||||
subMenu = monitoringSettings, "rusEfi console"
|
||||
subMenu = std_separator
|
||||
|
||||
|
@ -3168,6 +3169,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "Idle Stepper Step", idle_stepperStepPin
|
||||
field = "Idle Stepper Enable", stepperEnablePin
|
||||
field = "Fuel Pump Pin", fuelPumpPin
|
||||
field = "SD CS Pin", sdCardCsPin
|
||||
field = "MIL / Check Engine Pin", malfunctionIndicatorPin
|
||||
field = "test557pin", test557pin
|
||||
field = "Fan Pin", fanPin
|
||||
|
@ -3249,6 +3251,15 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "FSIO ADC #2", fsioAdc2
|
||||
field = "FSIO ADC #3", fsioAdc3
|
||||
field = "FSIO ADC #4", fsioAdc4
|
||||
field = "SPI1 MOSI", spi1mosiPin, {is_enabled_spi_1 == 1}
|
||||
field = "SPI1 MISO", spi1misoPin, {is_enabled_spi_1 == 1}
|
||||
field = "SPI1 SCK", spi1sckPin, {is_enabled_spi_1 == 1}
|
||||
field = "SPI2 MOSI", spi2mosiPin, {is_enabled_spi_2 == 1}
|
||||
field = "SPI2 MISO", spi2misoPin, {is_enabled_spi_2 == 1}
|
||||
field = "SPI2 SCK", spi2sckPin, {is_enabled_spi_2 == 1}
|
||||
field = "SPI3 MOSI", spi3mosiPin, {is_enabled_spi_3 == 1}
|
||||
field = "SPI3 MISO", spi3misoPin, {is_enabled_spi_3 == 1}
|
||||
field = "SPI3 SCK", spi3sckPin, {is_enabled_spi_3 == 1}
|
||||
field = "hip9011CsPin", hip9011CsPin
|
||||
field = "LIS302DLCsPin", LIS302DLCsPin
|
||||
field = "MIL / Check Engine", malfunctionIndicatorPin
|
||||
|
@ -3272,6 +3283,8 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "Aux Pin #4", auxPidPins4
|
||||
field = "Aux Valve #1", auxValves1
|
||||
field = "Aux Valve #2", auxValves2
|
||||
field = "TLE8888 Chip Select", tle8888_cs
|
||||
field = "TLE 8888 spi", tle8888spiDevice
|
||||
field = "AUX Serial TX", auxSerialTxPin
|
||||
field = "AUX Serial RX", auxSerialRxPin
|
||||
|
||||
|
@ -3786,6 +3799,8 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "D7 pin", HD44780_db7
|
||||
|
||||
dialog = tle8888, "TLE8888", yAxis
|
||||
field = "TLE8888 Chip Select", tle8888_cs
|
||||
field = "TLE8888 SPI", tle8888spiDevice
|
||||
field = "Mode", tle8888mode
|
||||
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
|
||||
commandButton = "Reinit", cmd_tle8888_init
|
||||
|
@ -3794,6 +3809,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "ADC vRef voltage", adcVcc
|
||||
panel = canBus
|
||||
panel = auxSerial
|
||||
panel = sdCard
|
||||
|
||||
|
||||
dialog = monitoringSettings, "rusEfi Console Settings"
|
||||
|
|
|
@ -14,6 +14,12 @@ void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, actio
|
|||
if (debugSignalExecutor) {
|
||||
printf("scheduleTask %d\r\n", delayUs);
|
||||
}
|
||||
|
||||
if (m_mockExecutor) {
|
||||
m_mockExecutor->scheduleForLater(scheduling, delayUs, action);
|
||||
return;
|
||||
}
|
||||
|
||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
||||
}
|
||||
|
||||
|
@ -37,9 +43,24 @@ void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t tim
|
|||
if (debugSignalExecutor) {
|
||||
printf("scheduleByTime %d\r\n", timeUs);
|
||||
}
|
||||
|
||||
if (m_mockExecutor) {
|
||||
m_mockExecutor->scheduleByTimestamp(scheduling, timeUs, action);
|
||||
return;
|
||||
}
|
||||
|
||||
schedulingQueue.insertTask(scheduling, timeUs, action);
|
||||
}
|
||||
|
||||
void TestExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||
if (m_mockExecutor) {
|
||||
m_mockExecutor->scheduleByTimestampNt(scheduling, timeNt, action);
|
||||
return;
|
||||
}
|
||||
|
||||
scheduleByTimestamp(scheduling, NT2US(timeNt), action);
|
||||
}
|
||||
|
||||
void TestExecutor::setMockExecutor(ExecutorInterface* exec) {
|
||||
m_mockExecutor = exec;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ public:
|
|||
int executeAll(efitime_t now);
|
||||
int size();
|
||||
scheduling_s* getForUnitTest(int index);
|
||||
|
||||
void setMockExecutor(ExecutorInterface* exec);
|
||||
private:
|
||||
EventQueue schedulingQueue;
|
||||
ExecutorInterface* m_mockExecutor = nullptr;
|
||||
};
|
||||
|
|
|
@ -40,3 +40,10 @@ class MockPwm : public SimplePwm {
|
|||
public:
|
||||
MOCK_METHOD(void, setSimplePwmDutyCycle, (float dutyCycle), (override));
|
||||
};
|
||||
|
||||
class MockExecutor : public TestExecutor {
|
||||
public:
|
||||
MOCK_METHOD(void, scheduleByTimestamp, (scheduling_s *scheduling, efitimeus_t timeUs, action_s action), (override));
|
||||
MOCK_METHOD(void, scheduleByTimestampNt, (scheduling_s *scheduling, efitime_t timeUs, action_s action), (override));
|
||||
MOCK_METHOD(void, scheduleForLater, (scheduling_s *scheduling, int delayUs, action_s action), (override));
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@ TESTS_SRC_CPP = \
|
|||
tests/trigger/test_trigger_multi_sync.cpp \
|
||||
tests/trigger/test_cam_vvt_input.cpp \
|
||||
tests/trigger/test_2jz_vvt.cpp \
|
||||
tests/trigger/test_injection_scheduling.cpp \
|
||||
tests/test_util.cpp \
|
||||
tests/test_ion.cpp \
|
||||
tests/test_aux_valves.cpp \
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#include "engine_test_helper.h"
|
||||
#include "main_trigger_callback.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include "mocks.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::StrictMock;
|
||||
using ::testing::InSequence;
|
||||
|
||||
TEST(injectionScheduling, NormalDutyCycle) {
|
||||
StrictMock<MockExecutor> mockExec;
|
||||
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
engine->executor.setMockExecutor(&mockExec);
|
||||
|
||||
efitick_t nowNt = 1000000;
|
||||
|
||||
InjectionEvent event;
|
||||
InjectorOutputPin pin;
|
||||
pin.injectorIndex = 0;
|
||||
event.outputs[0] = &pin;
|
||||
|
||||
// Injection duration of 20ms
|
||||
engine->injectionDuration = 20.0f;
|
||||
|
||||
{
|
||||
InSequence is;
|
||||
|
||||
// Should schedule one normal injection:
|
||||
// rising edge now
|
||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(&event.signalTimerUp, nowNt + 0, _));
|
||||
// falling edge 10ms later
|
||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(&event.endOfInjectionEvent, nowNt + MS2NT(20), _));
|
||||
}
|
||||
|
||||
engine->rpmCalculator.oneDegreeUs = 100;
|
||||
|
||||
handleFuelInjectionEvent(0, &event, 1000, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
Loading…
Reference in New Issue