Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
271f7a373a
|
@ -595,7 +595,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
// 248
|
// 248
|
||||||
tsOutputChannels->vvtPosition = engine->triggerCentral.getVVTPosition();
|
tsOutputChannels->vvtPosition = engine->triggerCentral.getVVTPosition(0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 252
|
// 252
|
||||||
|
|
|
@ -27,9 +27,14 @@ static fsio8_Map3D_u8t vvtTable2("vvt#2");
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
|
|
||||||
void VvtController::init(int index, const ValueProvider3D* targetMap) {
|
void VvtController::init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap) {
|
||||||
this->index = index;
|
this->index = index;
|
||||||
m_pid.initPidClass(&CONFIG(auxPid[index]));
|
m_bank = bankIndex;
|
||||||
|
m_cam = camIndex;
|
||||||
|
|
||||||
|
// Use the same settings for the Nth cam in every bank (ie, all exhaust cams use the same PID)
|
||||||
|
m_pid.initPidClass(&CONFIG(auxPid[camIndex]));
|
||||||
|
|
||||||
m_targetMap = targetMap;
|
m_targetMap = targetMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +52,7 @@ void VvtController::PeriodicTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
expected<angle_t> VvtController::observePlant() const {
|
expected<angle_t> VvtController::observePlant() const {
|
||||||
return engine->triggerCentral.getVVTPosition();
|
return engine->triggerCentral.getVVTPosition(m_bank, m_cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
expected<angle_t> VvtController::getSetpoint() const {
|
expected<angle_t> VvtController::getSetpoint() const {
|
||||||
|
@ -138,10 +143,10 @@ void initAuxPid(Logging *sharedLogger) {
|
||||||
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
|
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
|
||||||
INJECT_ENGINE_REFERENCE(&instances[i]);
|
INJECT_ENGINE_REFERENCE(&instances[i]);
|
||||||
|
|
||||||
// TODO: this is wrong for cams 3/4
|
int camIndex = i % CAMS_PER_BANK;
|
||||||
int indexInBank = i % CAMS_PER_BANK;
|
int bankIndex = i / CAMS_PER_BANK;
|
||||||
auto targetMap = indexInBank == 0 ? &vvtTable1 : &vvtTable2;
|
auto targetMap = camIndex == 0 ? &vvtTable1 : &vvtTable2;
|
||||||
instances[i].init(i, targetMap);
|
instances[i].init(i, bankIndex, camIndex, targetMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
startVvtControlPins();
|
startVvtControlPins();
|
||||||
|
|
|
@ -24,7 +24,7 @@ class VvtController : public PeriodicTimerController, public ClosedLoopControlle
|
||||||
public:
|
public:
|
||||||
DECLARE_ENGINE_PTR;
|
DECLARE_ENGINE_PTR;
|
||||||
|
|
||||||
void init(int index, const ValueProvider3D* targetMap);
|
void init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap);
|
||||||
|
|
||||||
// PeriodicTimerController implementation
|
// PeriodicTimerController implementation
|
||||||
int getPeriodMs() override;
|
int getPeriodMs() override;
|
||||||
|
@ -43,6 +43,12 @@ private:
|
||||||
const ValueProvider3D* m_targetMap = nullptr;
|
const ValueProvider3D* m_targetMap = nullptr;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
// Bank index, 0 or 1
|
||||||
|
uint8_t m_bank = 0;
|
||||||
|
|
||||||
|
// Cam index, 0 = intake, 1 = exhaust
|
||||||
|
uint8_t m_cam = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// todo: encapsulate or inject these
|
// todo: encapsulate or inject these
|
||||||
SimplePwm m_pwm;
|
SimplePwm m_pwm;
|
||||||
|
|
|
@ -120,7 +120,7 @@ struct Sensors2 {
|
||||||
static void populateFrame(Sensors2& msg) {
|
static void populateFrame(Sensors2& msg) {
|
||||||
msg.afr = Sensor::get(SensorType::Lambda1).value_or(0) * 14.7f;
|
msg.afr = Sensor::get(SensorType::Lambda1).value_or(0) * 14.7f;
|
||||||
msg.oilPressure = Sensor::get(SensorType::OilPressure).value_or(-1);
|
msg.oilPressure = Sensor::get(SensorType::OilPressure).value_or(-1);
|
||||||
msg.vvtPos = engine->triggerCentral.getVVTPosition();
|
msg.vvtPos = engine->triggerCentral.getVVTPosition(0, 0);
|
||||||
msg.vbatt = Sensor::get(SensorType::BatteryVoltage).value_or(0);
|
msg.vbatt = Sensor::get(SensorType::BatteryVoltage).value_or(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,8 +138,9 @@ FsioResult getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
return Sensor::get(SensorType::Map).value_or(0);
|
return Sensor::get(SensorType::Map).value_or(0);
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
case LE_METHOD_INTAKE_VVT:
|
case LE_METHOD_INTAKE_VVT:
|
||||||
|
return engine->triggerCentral.getVVTPosition(0, 0);
|
||||||
case LE_METHOD_EXHAUST_VVT:
|
case LE_METHOD_EXHAUST_VVT:
|
||||||
return engine->triggerCentral.getVVTPosition();
|
return engine->triggerCentral.getVVTPosition(0, 1);
|
||||||
#endif
|
#endif
|
||||||
case LE_METHOD_TIME_SINCE_TRIGGER_EVENT:
|
case LE_METHOD_TIME_SINCE_TRIGGER_EVENT:
|
||||||
return engine->triggerCentral.getTimeSinceTriggerEvent(getTimeNowNt());
|
return engine->triggerCentral.getTimeSinceTriggerEvent(getTimeNowNt());
|
||||||
|
|
|
@ -79,8 +79,8 @@ EXTERN_ENGINE;
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
|
|
||||||
angle_t TriggerCentral::getVVTPosition() {
|
angle_t TriggerCentral::getVVTPosition(uint8_t bankIndex, uint8_t camIndex) {
|
||||||
return vvtPosition[0][0];
|
return vvtPosition[bankIndex][camIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define miataNbIndex (0)
|
#define miataNbIndex (0)
|
||||||
|
@ -89,7 +89,8 @@ static bool vvtWithRealDecoder(vvt_mode_e vvtMode) {
|
||||||
return vvtMode == VVT_MIATA_NB2
|
return vvtMode == VVT_MIATA_NB2
|
||||||
|| vvtMode == VVT_BOSCH_QUICK_START
|
|| vvtMode == VVT_BOSCH_QUICK_START
|
||||||
|| vvtMode == VVT_FORD_ST170
|
|| vvtMode == VVT_FORD_ST170
|
||||||
|| vvtMode == VVT_4_1;
|
|| vvtMode == VVT_4_1
|
||||||
|
|| vvtMode == VVT_BARRA_3_PLUS_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
TriggerNoiseFilter noiseFilter;
|
TriggerNoiseFilter noiseFilter;
|
||||||
|
|
||||||
trigger_type_e vvtTriggerType[CAMS_PER_BANK];
|
trigger_type_e vvtTriggerType[CAMS_PER_BANK];
|
||||||
angle_t getVVTPosition();
|
angle_t getVVTPosition(uint8_t bankIndex, uint8_t camIndex);
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
// latest VVT event position (could be not synchronization event)
|
// latest VVT event position (could be not synchronization event)
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "serial_hw.h"
|
#include "serial_hw.h"
|
||||||
|
|
||||||
#include "mpu_util.h"
|
#include "mpu_util.h"
|
||||||
//#include "usb_msd.h"
|
#include "mmc_card.h"
|
||||||
|
|
||||||
#include "AdcConfiguration.h"
|
#include "AdcConfiguration.h"
|
||||||
#include "idle_hardware.h"
|
#include "idle_hardware.h"
|
||||||
|
@ -463,16 +463,16 @@ void showBor(void) {
|
||||||
scheduleMsg(sharedLogger, "BOR=%d", (int)BOR_Get());
|
scheduleMsg(sharedLogger, "BOR=%d", (int)BOR_Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void initHardware(Logging *l) {
|
// This function initializes hardware that can do so before configuration is loaded
|
||||||
|
void initHardwareNoConfig(Logging *l) {
|
||||||
efiAssertVoid(CUSTOM_IH_STACK, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "init h");
|
efiAssertVoid(CUSTOM_IH_STACK, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "init h");
|
||||||
sharedLogger = l;
|
sharedLogger = l;
|
||||||
efiAssertVoid(CUSTOM_EC_NULL, engineConfiguration!=NULL, "engineConfiguration");
|
efiAssertVoid(CUSTOM_EC_NULL, engineConfiguration!=NULL, "engineConfiguration");
|
||||||
|
|
||||||
|
|
||||||
printMsg(sharedLogger, "initHardware()");
|
printMsg(sharedLogger, "initHardware()");
|
||||||
// todo: enable protection. it's disabled because it takes
|
|
||||||
// 10 extra seconds to re-flash the chip
|
initPinRepository();
|
||||||
//flashProtect();
|
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS
|
#if EFI_HISTOGRAMS
|
||||||
/**
|
/**
|
||||||
|
@ -486,12 +486,27 @@ void initHardware(Logging *l) {
|
||||||
*/
|
*/
|
||||||
initPrimaryPins(sharedLogger);
|
initPrimaryPins(sharedLogger);
|
||||||
|
|
||||||
if (hasFirmwareError()) {
|
// it's important to initialize this pretty early in the game before any scheduling usages
|
||||||
return;
|
initSingleTimerExecutorHardware();
|
||||||
}
|
|
||||||
|
initRtc();
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_INTERNAL_FLASH
|
||||||
|
initFlash(sharedLogger);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
// todo: figure out better startup logic
|
||||||
|
initTriggerCentral(sharedLogger);
|
||||||
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
|
|
||||||
|
#if EFI_FILE_LOGGING
|
||||||
|
initEarlyMmcCard();
|
||||||
|
#endif // EFI_FILE_LOGGING
|
||||||
|
}
|
||||||
|
|
||||||
|
void initHardware() {
|
||||||
|
#if EFI_INTERNAL_FLASH
|
||||||
#ifdef CONFIG_RESET_SWITCH_PORT
|
#ifdef CONFIG_RESET_SWITCH_PORT
|
||||||
// this pin is not configurable at runtime so that we have a reliable way to reset configuration
|
// this pin is not configurable at runtime so that we have a reliable way to reset configuration
|
||||||
#define SHOULD_IGNORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
|
#define SHOULD_IGNORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
|
||||||
|
@ -503,7 +518,6 @@ void initHardware(Logging *l) {
|
||||||
palSetPadMode(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
|
palSetPadMode(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
|
||||||
#endif /* CONFIG_RESET_SWITCH_PORT */
|
#endif /* CONFIG_RESET_SWITCH_PORT */
|
||||||
|
|
||||||
initFlash(sharedLogger);
|
|
||||||
/**
|
/**
|
||||||
* this call reads configuration from flash memory or sets default configuration
|
* this call reads configuration from flash memory or sets default configuration
|
||||||
* if flash state does not look right.
|
* if flash state does not look right.
|
||||||
|
@ -522,9 +536,6 @@ void initHardware(Logging *l) {
|
||||||
resetConfigurationExt(sharedLogger, engineConfiguration->engineType PASS_ENGINE_PARAMETER_SUFFIX);
|
resetConfigurationExt(sharedLogger, engineConfiguration->engineType PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_INTERNAL_FLASH */
|
||||||
|
|
||||||
// it's important to initialize this pretty early in the game before any scheduling usages
|
|
||||||
initSingleTimerExecutorHardware();
|
|
||||||
|
|
||||||
#if EFI_HD44780_LCD
|
#if EFI_HD44780_LCD
|
||||||
lcd_HD44780_init(sharedLogger);
|
lcd_HD44780_init(sharedLogger);
|
||||||
if (hasFirmwareError())
|
if (hasFirmwareError())
|
||||||
|
@ -549,8 +560,6 @@ void initHardware(Logging *l) {
|
||||||
initSoftwareKnock();
|
initSoftwareKnock();
|
||||||
#endif /* EFI_SOFTWARE_KNOCK */
|
#endif /* EFI_SOFTWARE_KNOCK */
|
||||||
|
|
||||||
initRtc();
|
|
||||||
|
|
||||||
#if HAL_USE_SPI
|
#if HAL_USE_SPI
|
||||||
initSpiModules(engineConfiguration);
|
initSpiModules(engineConfiguration);
|
||||||
#endif /* HAL_USE_SPI */
|
#endif /* HAL_USE_SPI */
|
||||||
|
@ -582,11 +591,6 @@ void initHardware(Logging *l) {
|
||||||
// init_adc_mcp3208(&adcState, &SPID2);
|
// init_adc_mcp3208(&adcState, &SPID2);
|
||||||
// requestAdcValue(&adcState, 0);
|
// requestAdcValue(&adcState, 0);
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
|
||||||
// todo: figure out better startup logic
|
|
||||||
initTriggerCentral(sharedLogger);
|
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
|
||||||
|
|
||||||
turnOnHardware(sharedLogger);
|
turnOnHardware(sharedLogger);
|
||||||
|
|
||||||
#if EFI_HIP_9011
|
#if EFI_HIP_9011
|
||||||
|
@ -596,15 +600,11 @@ void initHardware(Logging *l) {
|
||||||
#if EFI_MEMS
|
#if EFI_MEMS
|
||||||
initAccelerometer(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initAccelerometer(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
#endif
|
||||||
// initFixedLeds();
|
|
||||||
|
|
||||||
|
|
||||||
#if EFI_BOSCH_YAW
|
#if EFI_BOSCH_YAW
|
||||||
initBoschYawRateSensor();
|
initBoschYawRateSensor();
|
||||||
#endif /* EFI_BOSCH_YAW */
|
#endif /* EFI_BOSCH_YAW */
|
||||||
|
|
||||||
// initBooleanInputs();
|
|
||||||
|
|
||||||
#if EFI_UART_GPS
|
#if EFI_UART_GPS
|
||||||
initGps();
|
initGps();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,13 @@ brain_pin_e getSckPin(spi_device_e device);
|
||||||
#include "debounce.h"
|
#include "debounce.h"
|
||||||
|
|
||||||
void applyNewHardwareSettings(void);
|
void applyNewHardwareSettings(void);
|
||||||
void initHardware(Logging *logging);
|
|
||||||
|
// Initialize hardware that doesn't require configuration to be loaded
|
||||||
|
void initHardwareNoConfig(Logging *l);
|
||||||
|
|
||||||
|
// Initialize hardware with configuration loaded
|
||||||
|
void initHardware();
|
||||||
|
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
void showBor(void);
|
void showBor(void);
|
||||||
|
|
|
@ -534,19 +534,22 @@ bool isSdCardAlive(void) {
|
||||||
return fs_ready;
|
return fs_ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initMmcCard(void) {
|
// Pre-config load init
|
||||||
|
void initEarlyMmcCard() {
|
||||||
logName[0] = 0;
|
logName[0] = 0;
|
||||||
|
|
||||||
#if HAL_USE_USB_MSD
|
#if HAL_USE_USB_MSD
|
||||||
chBSemObjectInit(&usbConnectedSemaphore, true);
|
chBSemObjectInit(&usbConnectedSemaphore, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
|
|
||||||
|
|
||||||
addConsoleAction("sdinfo", sdStatistics);
|
addConsoleAction("sdinfo", sdStatistics);
|
||||||
addConsoleActionS("ls", listDirectory);
|
addConsoleActionS("ls", listDirectory);
|
||||||
addConsoleActionS("del", removeFile);
|
addConsoleActionS("del", removeFile);
|
||||||
addConsoleAction("incfilename", incLogFileName);
|
addConsoleAction("incfilename", incLogFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initMmcCard() {
|
||||||
|
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
#define DOT_MLG ".mlg"
|
#define DOT_MLG ".mlg"
|
||||||
|
|
||||||
bool isLogFile(const char *fileName);
|
bool isLogFile(const char *fileName);
|
||||||
void initMmcCard(void);
|
void initEarlyMmcCard();
|
||||||
|
void initMmcCard();
|
||||||
bool isSdCardAlive(void);
|
bool isSdCardAlive(void);
|
||||||
|
|
||||||
void readLogFileContent(char *buffer, short fileId, short offset, short length);
|
void readLogFileContent(char *buffer, short fileId, short offset, short length);
|
||||||
|
|
|
@ -192,10 +192,7 @@ void runRusEfi(void) {
|
||||||
*/
|
*/
|
||||||
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
/**
|
initHardwareNoConfig(&sharedLogger);
|
||||||
* First data structure keeps track of which hardware I/O pins are used by whom
|
|
||||||
*/
|
|
||||||
initPinRepository();
|
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_INTERNAL_FLASH
|
||||||
#if IGNORE_FLASH_CONFIGURATION
|
#if IGNORE_FLASH_CONFIGURATION
|
||||||
|
@ -234,7 +231,7 @@ void runRusEfi(void) {
|
||||||
/**
|
/**
|
||||||
* Initialize hardware drivers
|
* Initialize hardware drivers
|
||||||
*/
|
*/
|
||||||
initHardware(&sharedLogger);
|
initHardware();
|
||||||
|
|
||||||
#if HW_CHECK_ALWAYS_STIMULATE
|
#if HW_CHECK_ALWAYS_STIMULATE
|
||||||
// we need a special binary for final assembly check. We cannot afford to require too much software or too many steps
|
// we need a special binary for final assembly check. We cannot afford to require too much software or too many steps
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script will download and install all dependencies require to develop rusEFI on Linux.
|
||||||
|
# After running this script, executing `make` in the firmware folder is expected to produce a functional firmware binary.
|
||||||
|
|
||||||
|
# Update package lists
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
sudo apt-get install -y build-essential gcc make openjdk-8-jdk-headless ant mtools
|
||||||
|
|
||||||
|
# delete any old tools, create a new folder, and go there
|
||||||
|
rm -rf ~/.rusefi-tools
|
||||||
|
mkdir ~/.rusefi-tools
|
||||||
|
cd ~/.rusefi-tools
|
||||||
|
|
||||||
|
# Download and extract GCC compiler
|
||||||
|
curl -L -o arm-none-eabi-gcc.tar.bz2 https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
|
||||||
|
tar -xjvf arm-none-eabi-gcc.tar.bz2
|
||||||
|
|
||||||
|
# Delete downloaded image
|
||||||
|
rm arm-none-eabi-gcc.tar.bz2
|
||||||
|
|
||||||
|
# Add the compiler to your path
|
||||||
|
echo 'export PATH=$PATH:$HOME/.rusefi-tools/gcc-arm-none-eabi-9-2020-q2-update/bin' >> ~/.profile
|
|
@ -19,7 +19,7 @@ TEST(Vvt, setpoint) {
|
||||||
|
|
||||||
VvtController dut;
|
VvtController dut;
|
||||||
INJECT_ENGINE_REFERENCE(&dut);
|
INJECT_ENGINE_REFERENCE(&dut);
|
||||||
dut.init(0, &targetMap);
|
dut.init(0, 0, 0, &targetMap);
|
||||||
|
|
||||||
// Test dut
|
// Test dut
|
||||||
EXPECT_EQ(20, dut.getSetpoint().value_or(0));
|
EXPECT_EQ(20, dut.getSetpoint().value_or(0));
|
||||||
|
@ -32,7 +32,7 @@ TEST(Vvt, observePlant) {
|
||||||
|
|
||||||
VvtController dut;
|
VvtController dut;
|
||||||
INJECT_ENGINE_REFERENCE(&dut);
|
INJECT_ENGINE_REFERENCE(&dut);
|
||||||
dut.init(0, nullptr);
|
dut.init(0, 0, 0, nullptr);
|
||||||
|
|
||||||
EXPECT_EQ(23, dut.observePlant().value_or(0));
|
EXPECT_EQ(23, dut.observePlant().value_or(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ TEST(trigger, testCamInput) {
|
||||||
|
|
||||||
// asserting that error code has cleared
|
// asserting that error code has cleared
|
||||||
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
|
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
|
||||||
ASSERT_NEAR(720 - 181, engine->triggerCentral.getVVTPosition(), EPS3D);
|
ASSERT_NEAR(720 - 181, engine->triggerCentral.getVVTPosition(0, 0), EPS3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(sensors, testNB2CamInput) {
|
TEST(sensors, testNB2CamInput) {
|
||||||
|
@ -153,14 +153,14 @@ TEST(sensors, testNB2CamInput) {
|
||||||
// this second important front would give us first real VVT gap duration
|
// this second important front would give us first real VVT gap duration
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition());
|
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition(0, 0));
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(130));
|
eth.moveTimeForwardUs(MS2US(130));
|
||||||
// this third important front would give us first comparison between two real gaps
|
// this third important front would give us first comparison between two real gaps
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_NEAR(-67.6 - 720 - 720, engine->triggerCentral.getVVTPosition(), EPS3D);
|
ASSERT_NEAR(-67.6 - 720 - 720, engine->triggerCentral.getVVTPosition(0, 0), EPS3D);
|
||||||
// actually position based on VVT!
|
// actually position based on VVT!
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,14 @@ TEST(trigger, testQuadCam) {
|
||||||
// this second important front would give us first real VVT gap duration
|
// this second important front would give us first real VVT gap duration
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCam PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCam PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition());
|
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition(0, 0));
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(130 / d));
|
eth.moveTimeForwardUs(MS2US(130 / d));
|
||||||
// this third important front would give us first comparison between two real gaps
|
// this third important front would give us first comparison between two real gaps
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCam PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCam PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_NEAR(-67.6 - 720 - 720 + 160.2, engine->triggerCentral.vvtPosition[0][secondCam], EPS3D);
|
ASSERT_NEAR(-67.6 - 720 - 720 + 160.2, engine->triggerCentral.getVVTPosition(0, 1), EPS3D);
|
||||||
// actually position based on VVT!
|
// actually position based on VVT!
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@ TEST(trigger, testQuadCam) {
|
||||||
// this second important front would give us first real VVT gap duration
|
// this second important front would give us first real VVT gap duration
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition());
|
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition(0, 0));
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(130 / d));
|
eth.moveTimeForwardUs(MS2US(130 / d));
|
||||||
// this third important front would give us first comparison between two real gaps
|
// this third important front would give us first comparison between two real gaps
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_NEAR(-2571.4, engine->triggerCentral.vvtPosition[secondBank][secondCam], EPS3D);
|
ASSERT_NEAR(-2571.4, engine->triggerCentral.getVVTPosition(secondBank, secondCam), EPS3D);
|
||||||
// actually position based on VVT!
|
// actually position based on VVT!
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue