Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
39708dcf60
|
@ -30,5 +30,10 @@ ifeq ($(LED_CRITICAL_ERROR_BRAIN_PIN),)
|
|||
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
|
||||
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
|
||||
// R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.232f
|
||||
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->adcVcc = 3.29f;
|
||||
|
@ -198,6 +199,14 @@ void setBoardConfigurationOverrides(void) {
|
|||
// GPIOE_8: "35 - GP Out 1"
|
||||
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
|
||||
// GPIOE_10: "3 - Lowside 2"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
#define ts_show_analog_divider false
|
||||
#define ts_show_spi false
|
||||
#define ts_show_sd_card false
|
||||
#define ts_show_spi true
|
||||
#define ts_show_sd_card true
|
||||
#define ts_show_can_pins false
|
||||
#define ts_show_tunerstudio_port false
|
||||
|
|
|
@ -609,6 +609,11 @@ typedef enum __attribute__ ((__packed__)) {
|
|||
_150KHz
|
||||
} spi_speed_e;
|
||||
|
||||
|
||||
/**
|
||||
* See spi3mosiPin
|
||||
* See spi2MisoMode
|
||||
*/
|
||||
typedef enum __attribute__ ((__packed__)) {
|
||||
SPI_NONE = 0,
|
||||
SPI_DEVICE_1 = 1,
|
||||
|
|
|
@ -161,7 +161,6 @@ typedef enum __attribute__ ((__packed__)) {
|
|||
GPIOH_15 = 129,
|
||||
|
||||
/* 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_2 = 131,
|
||||
TLE6240_PIN_3 = 132,
|
||||
|
@ -180,7 +179,6 @@ typedef enum __attribute__ ((__packed__)) {
|
|||
TLE6240_PIN_16 = 145,
|
||||
|
||||
/* 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_21 = 166,
|
||||
MC33972_PIN_22 = 167,
|
||||
|
|
|
@ -696,7 +696,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
|||
* UNUSED_SIZE contants.
|
||||
*/
|
||||
#ifndef RAM_UNUSED_SIZE
|
||||
#define RAM_UNUSED_SIZE 12200
|
||||
#define RAM_UNUSED_SIZE 10900
|
||||
#endif
|
||||
#ifndef CCM_UNUSED_SIZE
|
||||
#define CCM_UNUSED_SIZE 2900
|
||||
|
@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
|
|||
if (initBootloader() != 0)
|
||||
return 123;
|
||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||
return 20200512;
|
||||
return 20200513;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
|
||||
#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 startSmartCsPins(void);
|
||||
void stopSmartCsPins(void);
|
||||
|
|
|
@ -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