Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fab941010e
|
@ -122,7 +122,6 @@ typedef enum __attribute__ ((__packed__)) {
|
||||||
GPIOE_17 = 91,
|
GPIOE_17 = 91,
|
||||||
|
|
||||||
// TLE6240 pins go right after on chips
|
// TLE6240 pins go right after on chips
|
||||||
//#define TLE6240_PIN(n) ((brain_pin_e)((int)BRAIN_PIN_LAST_ONCHIP + 1 + (n)))
|
|
||||||
TLE6240_PIN_1 = 130,
|
TLE6240_PIN_1 = 130,
|
||||||
TLE6240_PIN_2 = 131,
|
TLE6240_PIN_2 = 131,
|
||||||
TLE6240_PIN_3 = 132,
|
TLE6240_PIN_3 = 132,
|
||||||
|
|
|
@ -30,5 +30,10 @@ ifeq ($(LED_CRITICAL_ERROR_BRAIN_PIN),)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# breaking TTL thus breaking Bluetooth for microRusEFI in order to enable SPI3 for SD card
|
||||||
|
EFI_CONSOLE_TTL_PINS = -DEFI_CONSOLE_TX_BRAIN_PIN=GPIOE_15 -DEFI_CONSOLE_RX_BRAIN_PIN=GPIOE_14
|
||||||
|
|
||||||
|
|
||||||
# Add them all together
|
# Add them all together
|
||||||
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN)
|
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(EFI_CONSOLE_TTL_PINS)
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ static void setupVbatt() {
|
||||||
// set vbatt_divider 8.23
|
// set vbatt_divider 8.23
|
||||||
// R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.232f
|
// R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.232f
|
||||||
engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
|
engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
|
||||||
|
// PC1, pin #1 input +12 from Main Relay. Main Relay controlled by TLE8888
|
||||||
engineConfiguration->vbattAdcChannel = EFI_ADC_11;
|
engineConfiguration->vbattAdcChannel = EFI_ADC_11;
|
||||||
|
|
||||||
engineConfiguration->adcVcc = 3.29f;
|
engineConfiguration->adcVcc = 3.29f;
|
||||||
|
@ -198,6 +199,14 @@ void setBoardConfigurationOverrides(void) {
|
||||||
// GPIOE_8: "35 - GP Out 1"
|
// GPIOE_8: "35 - GP Out 1"
|
||||||
engineConfiguration->fuelPumpPin = GPIOE_8;
|
engineConfiguration->fuelPumpPin = GPIOE_8;
|
||||||
|
|
||||||
|
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_3;
|
||||||
|
engineConfiguration->spi3mosiPin = GPIOC_12;
|
||||||
|
engineConfiguration->spi3misoPin = GPIOC_11;
|
||||||
|
engineConfiguration->spi3sckPin = GPIOC_10;
|
||||||
|
engineConfiguration->sdCardCsPin = GPIOB_9;
|
||||||
|
CONFIG(is_enabled_spi_3) = true;
|
||||||
|
// engineConfiguration->isSdCardEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
// TLE8888 high current low side: VVT2 IN9 / OUT5
|
// TLE8888 high current low side: VVT2 IN9 / OUT5
|
||||||
// GPIOE_10: "3 - Lowside 2"
|
// GPIOE_10: "3 - Lowside 2"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define ts_show_gps false
|
#define ts_show_gps false
|
||||||
#define ts_show_etb_pins false
|
#define ts_show_etb_pins false
|
||||||
#define ts_show_analog_divider false
|
#define ts_show_analog_divider false
|
||||||
#define ts_show_spi false
|
#define ts_show_spi true
|
||||||
#define ts_show_sd_card false
|
#define ts_show_sd_card true
|
||||||
#define ts_show_can_pins false
|
#define ts_show_can_pins false
|
||||||
#define ts_show_tunerstudio_port false
|
#define ts_show_tunerstudio_port false
|
||||||
|
|
|
@ -609,6 +609,11 @@ typedef enum __attribute__ ((__packed__)) {
|
||||||
_150KHz
|
_150KHz
|
||||||
} spi_speed_e;
|
} spi_speed_e;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See spi3mosiPin
|
||||||
|
* See spi2MisoMode
|
||||||
|
*/
|
||||||
typedef enum __attribute__ ((__packed__)) {
|
typedef enum __attribute__ ((__packed__)) {
|
||||||
SPI_NONE = 0,
|
SPI_NONE = 0,
|
||||||
SPI_DEVICE_1 = 1,
|
SPI_DEVICE_1 = 1,
|
||||||
|
|
|
@ -161,7 +161,6 @@ typedef enum __attribute__ ((__packed__)) {
|
||||||
GPIOH_15 = 129,
|
GPIOH_15 = 129,
|
||||||
|
|
||||||
/* TLE6240 pins go right after on chips */
|
/* TLE6240 pins go right after on chips */
|
||||||
//#define TLE6240_PIN(n) ((brain_pin_e)((int)BRAIN_PIN_LAST_ONCHIP + 1 + (n)))
|
|
||||||
TLE6240_PIN_1 = 130,
|
TLE6240_PIN_1 = 130,
|
||||||
TLE6240_PIN_2 = 131,
|
TLE6240_PIN_2 = 131,
|
||||||
TLE6240_PIN_3 = 132,
|
TLE6240_PIN_3 = 132,
|
||||||
|
@ -180,7 +179,6 @@ typedef enum __attribute__ ((__packed__)) {
|
||||||
TLE6240_PIN_16 = 145,
|
TLE6240_PIN_16 = 145,
|
||||||
|
|
||||||
/* MC33972 pins go right after TLE6240 */
|
/* MC33972 pins go right after TLE6240 */
|
||||||
//#define MC33972_PIN(n) ((brain_pin_e)((int)BRAIN_PIN_LAST_ONCHIP + 1 + 16 + (n)))
|
|
||||||
MC33972_PIN_1 = 146,
|
MC33972_PIN_1 = 146,
|
||||||
MC33972_PIN_21 = 166,
|
MC33972_PIN_21 = 166,
|
||||||
MC33972_PIN_22 = 167,
|
MC33972_PIN_22 = 167,
|
||||||
|
|
|
@ -696,7 +696,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
* UNUSED_SIZE contants.
|
* UNUSED_SIZE contants.
|
||||||
*/
|
*/
|
||||||
#ifndef RAM_UNUSED_SIZE
|
#ifndef RAM_UNUSED_SIZE
|
||||||
#define RAM_UNUSED_SIZE 12200
|
#define RAM_UNUSED_SIZE 10900
|
||||||
#endif
|
#endif
|
||||||
#ifndef CCM_UNUSED_SIZE
|
#ifndef CCM_UNUSED_SIZE
|
||||||
#define CCM_UNUSED_SIZE 2900
|
#define CCM_UNUSED_SIZE 2900
|
||||||
|
@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
return 20200512;
|
return 20200513;
|
||||||
}
|
}
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
|
@ -168,7 +168,7 @@ void turnInjectionPinLow(InjectionEvent *event) {
|
||||||
ENGINE(injectionEvents.addFuelEventsForCylinder(event->ownIndex PASS_ENGINE_PARAMETER_SUFFIX));
|
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) {
|
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;
|
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
|
* 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
|
// reset injection switch counter if the engine started spinning
|
||||||
void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
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);
|
||||||
|
|
|
@ -24,11 +24,6 @@
|
||||||
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
|
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TLE6240 pins go right after on chips */
|
|
||||||
#define TLE6240_PIN(n) ((brain_pin_e)((int)BRAIN_PIN_LAST_ONCHIP + 1 + (n)))
|
|
||||||
/* MC33972 pins go right after TLE6240 */
|
|
||||||
#define MC33972_PIN(n) ((brain_pin_e)((int)BRAIN_PIN_LAST_ONCHIP + 1 + 16 + (n)))
|
|
||||||
|
|
||||||
void initSmartGpio(void);
|
void initSmartGpio(void);
|
||||||
void startSmartCsPins(void);
|
void startSmartCsPins(void);
|
||||||
void stopSmartCsPins(void);
|
void stopSmartCsPins(void);
|
||||||
|
|
|
@ -89,7 +89,7 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
; see PAGE_0_SIZE in C source code
|
; see PAGE_0_SIZE in C source code
|
||||||
; CONFIG_DEFINITION_START
|
; 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
|
pageSize = 20000
|
||||||
page = 1
|
page = 1
|
||||||
|
@ -2663,6 +2663,7 @@ menuDialog = main
|
||||||
subMenu = engineTypeDialog, "Popular vehicles"
|
subMenu = engineTypeDialog, "Popular vehicles"
|
||||||
subMenu = std_separator
|
subMenu = std_separator
|
||||||
|
|
||||||
|
subMenu = spiFunction, "SPI"
|
||||||
subMenu = monitoringSettings, "rusEfi console"
|
subMenu = monitoringSettings, "rusEfi console"
|
||||||
subMenu = std_separator
|
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 Step", idle_stepperStepPin
|
||||||
field = "Idle Stepper Enable", stepperEnablePin
|
field = "Idle Stepper Enable", stepperEnablePin
|
||||||
field = "Fuel Pump Pin", fuelPumpPin
|
field = "Fuel Pump Pin", fuelPumpPin
|
||||||
|
field = "SD CS Pin", sdCardCsPin
|
||||||
field = "MIL / Check Engine Pin", malfunctionIndicatorPin
|
field = "MIL / Check Engine Pin", malfunctionIndicatorPin
|
||||||
field = "test557pin", test557pin
|
field = "test557pin", test557pin
|
||||||
field = "Fan Pin", fanPin
|
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 #2", fsioAdc2
|
||||||
field = "FSIO ADC #3", fsioAdc3
|
field = "FSIO ADC #3", fsioAdc3
|
||||||
field = "FSIO ADC #4", fsioAdc4
|
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 = "hip9011CsPin", hip9011CsPin
|
||||||
field = "LIS302DLCsPin", LIS302DLCsPin
|
field = "LIS302DLCsPin", LIS302DLCsPin
|
||||||
field = "MIL / Check Engine", malfunctionIndicatorPin
|
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 Pin #4", auxPidPins4
|
||||||
field = "Aux Valve #1", auxValves1
|
field = "Aux Valve #1", auxValves1
|
||||||
field = "Aux Valve #2", auxValves2
|
field = "Aux Valve #2", auxValves2
|
||||||
|
field = "TLE8888 Chip Select", tle8888_cs
|
||||||
|
field = "TLE 8888 spi", tle8888spiDevice
|
||||||
field = "AUX Serial TX", auxSerialTxPin
|
field = "AUX Serial TX", auxSerialTxPin
|
||||||
field = "AUX Serial RX", auxSerialRxPin
|
field = "AUX Serial RX", auxSerialRxPin
|
||||||
|
|
||||||
|
@ -3786,6 +3799,8 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
||||||
field = "D7 pin", HD44780_db7
|
field = "D7 pin", HD44780_db7
|
||||||
|
|
||||||
dialog = tle8888, "TLE8888", yAxis
|
dialog = tle8888, "TLE8888", yAxis
|
||||||
|
field = "TLE8888 Chip Select", tle8888_cs
|
||||||
|
field = "TLE8888 SPI", tle8888spiDevice
|
||||||
field = "Mode", tle8888mode
|
field = "Mode", tle8888mode
|
||||||
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
|
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
|
||||||
commandButton = "Reinit", cmd_tle8888_init
|
commandButton = "Reinit", cmd_tle8888_init
|
||||||
|
@ -3794,6 +3809,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
||||||
field = "ADC vRef voltage", adcVcc
|
field = "ADC vRef voltage", adcVcc
|
||||||
panel = canBus
|
panel = canBus
|
||||||
panel = auxSerial
|
panel = auxSerial
|
||||||
|
panel = sdCard
|
||||||
|
|
||||||
|
|
||||||
dialog = monitoringSettings, "rusEfi Console Settings"
|
dialog = monitoringSettings, "rusEfi Console Settings"
|
||||||
|
|
|
@ -3,3 +3,5 @@ Brain board stm 100 pin
|
||||||
[Forum post](https://rusefi.com/forum/viewtopic.php?f=4&t=381)
|
[Forum post](https://rusefi.com/forum/viewtopic.php?f=4&t=381)
|
||||||
|
|
||||||
[Known issues](known_issues.txt)
|
[Known issues](known_issues.txt)
|
||||||
|
|
||||||
|

|
|
@ -14,6 +14,12 @@ void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, actio
|
||||||
if (debugSignalExecutor) {
|
if (debugSignalExecutor) {
|
||||||
printf("scheduleTask %d\r\n", delayUs);
|
printf("scheduleTask %d\r\n", delayUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_mockExecutor) {
|
||||||
|
m_mockExecutor->scheduleForLater(scheduling, delayUs, action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +43,24 @@ void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t tim
|
||||||
if (debugSignalExecutor) {
|
if (debugSignalExecutor) {
|
||||||
printf("scheduleByTime %d\r\n", timeUs);
|
printf("scheduleByTime %d\r\n", timeUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_mockExecutor) {
|
||||||
|
m_mockExecutor->scheduleByTimestamp(scheduling, timeUs, action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
schedulingQueue.insertTask(scheduling, timeUs, action);
|
schedulingQueue.insertTask(scheduling, timeUs, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitick_t timeNt, action_s 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);
|
scheduleByTimestamp(scheduling, NT2US(timeNt), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestExecutor::setMockExecutor(ExecutorInterface* exec) {
|
||||||
|
m_mockExecutor = exec;
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@ public:
|
||||||
int executeAll(efitime_t now);
|
int executeAll(efitime_t now);
|
||||||
int size();
|
int size();
|
||||||
scheduling_s* getForUnitTest(int index);
|
scheduling_s* getForUnitTest(int index);
|
||||||
|
|
||||||
|
void setMockExecutor(ExecutorInterface* exec);
|
||||||
private:
|
private:
|
||||||
EventQueue schedulingQueue;
|
EventQueue schedulingQueue;
|
||||||
|
ExecutorInterface* m_mockExecutor = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,3 +40,10 @@ class MockPwm : public SimplePwm {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD(void, setSimplePwmDutyCycle, (float dutyCycle), (override));
|
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_trigger_multi_sync.cpp \
|
||||||
tests/trigger/test_cam_vvt_input.cpp \
|
tests/trigger/test_cam_vvt_input.cpp \
|
||||||
tests/trigger/test_2jz_vvt.cpp \
|
tests/trigger/test_2jz_vvt.cpp \
|
||||||
|
tests/trigger/test_injection_scheduling.cpp \
|
||||||
tests/test_util.cpp \
|
tests/test_util.cpp \
|
||||||
tests/test_ion.cpp \
|
tests/test_ion.cpp \
|
||||||
tests/test_aux_valves.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