34-2 3 cam Toyota wheel progress

This commit is contained in:
rusefi 2020-05-10 18:03:11 -04:00
parent 3b774976e4
commit 1f692c4a9b
4 changed files with 23 additions and 1 deletions

View File

@ -125,6 +125,8 @@ void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
strcpy(CONFIG(vehicleName), "VVT example");
engineConfiguration->debugMode = DBG_VVT;
// todo: these magic values would be hardcoded once we find out proper magic values
engineConfiguration->fsio_setting[14] = -90;
engineConfiguration->fsio_setting[15] = +90;

View File

@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20200509;
return 20200510;
}
#endif /* EFI_UNIT_TEST */

View File

@ -151,13 +151,30 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
currentPosition -= tdcPosition();
fixAngle(currentPosition, "currentPosition", CUSTOM_ERR_6558);
tc->currentVVTEventPosition = currentPosition;
if (engineConfiguration->debugMode == DBG_VVT) {
#if EFI_TUNER_STUDIO
tsOutputChannels.debugFloatField1 = currentPosition;
#endif /* EFI_TUNER_STUDIO */
}
switch(engineConfiguration->vvtMode) {
case VVT_2JZ:
if (currentPosition < engineConfiguration->fsio_setting[14] || currentPosition > engineConfiguration->fsio_setting[15]) {
// outside of the expected range
return;
}
case MIATA_NB2:
{
uint32_t currentDuration = nowNt - tc->previousVvtCamTime;
float ratio = ((float) currentDuration) / tc->previousVvtCamDuration;
if (engineConfiguration->debugMode == DBG_VVT) {
#if EFI_TUNER_STUDIO
tsOutputChannels.debugFloatField2 = ratio;
#endif /* EFI_TUNER_STUDIO */
}
tc->previousVvtCamDuration = currentDuration;
tc->previousVvtCamTime = nowNt;

View File

@ -29,5 +29,8 @@ TEST(sensors, test2jz) {
eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few angles
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
// currentPosition
ASSERT_NEAR(608.2, engine->triggerCentral.currentVVTEventPosition, EPS3D);
}