34-2 3 cam Toyota wheel progress
This commit is contained in:
parent
b40d367dad
commit
d18bf76fb5
|
@ -557,6 +557,8 @@
|
||||||
#define ENGINE_MAKE_GM "GM"
|
#define ENGINE_MAKE_GM "GM"
|
||||||
#define ENGINE_MAKE_LADA "Lada"
|
#define ENGINE_MAKE_LADA "Lada"
|
||||||
#define ENGINE_MAKE_MAZDA "Mazda"
|
#define ENGINE_MAKE_MAZDA "Mazda"
|
||||||
|
#define ENGINE_MAKE_MERCEDES "Mercedes"
|
||||||
|
#define ENGINE_MAKE_TOYOTA "Toyota"
|
||||||
#define ENGINE_NOISE_CURVE_SIZE 8
|
#define ENGINE_NOISE_CURVE_SIZE 8
|
||||||
#define engineChartSize_offset 1480
|
#define engineChartSize_offset 1480
|
||||||
#define engineChartSize_offset_hex 5c8
|
#define engineChartSize_offset_hex 5c8
|
||||||
|
|
|
@ -429,7 +429,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
// engineConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
|
// engineConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
|
||||||
engineConfiguration->clutchUpPinMode = PI_PULLUP;
|
engineConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||||
|
|
||||||
engineConfiguration->activateAuxPid1 = 1;
|
engineConfiguration->activateAuxPid1 = true;
|
||||||
engineConfiguration->auxPidPins[0] = GPIOD_5; // playing with AUX PID for alternator
|
engineConfiguration->auxPidPins[0] = GPIOD_5; // playing with AUX PID for alternator
|
||||||
engineConfiguration->auxPidFrequency[0] = 300;
|
engineConfiguration->auxPidFrequency[0] = 300;
|
||||||
|
|
||||||
|
|
|
@ -64,11 +64,11 @@ static const float injectorLagCorrection[VBAT_INJECTOR_CURVE_SIZE] = {
|
||||||
1.5 , 1.35, 1.25 , 1.20
|
1.5 , 1.35, 1.25 , 1.20
|
||||||
};
|
};
|
||||||
|
|
||||||
static const float ve18fsioRpmBins[FSIO_TABLE_8] =
|
static const float vvt18fsioRpmBins[FSIO_TABLE_8] =
|
||||||
{700.0, 1000.0, 2000.0, 3000.0, 3500.0, 4500.0, 5500.0, 6500.0}
|
{700.0, 1000.0, 2000.0, 3000.0, 3500.0, 4500.0, 5500.0, 6500.0}
|
||||||
;
|
;
|
||||||
|
|
||||||
static const float ve18fsioLoadBins[FSIO_TABLE_8] =
|
static const float vvt18fsioLoadBins[FSIO_TABLE_8] =
|
||||||
{30.0, 40.0, 50.0, 60.0, 70.0, 75.0, 82.0, 85.0}
|
{30.0, 40.0, 50.0, 60.0, 70.0, 75.0, 82.0, 85.0}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -216,6 +216,29 @@ void setMazdaMiataNbInjectorLag(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
memcpy(engineConfiguration->injector.battLagCorrBins, injectorLagBins, sizeof(injectorLagBins));
|
memcpy(engineConfiguration->injector.battLagCorrBins, injectorLagBins, sizeof(injectorLagBins));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMazdaNB2VVTSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
|
memcpy(config->fsioTable1RpmBins, vvt18fsioRpmBins, sizeof(vvt18fsioRpmBins));
|
||||||
|
memcpy(config->fsioTable1LoadBins, vvt18fsioLoadBins, sizeof(vvt18fsioLoadBins));
|
||||||
|
// todo: there should be a better way?
|
||||||
|
for (int loadIndex = 0; loadIndex < FSIO_TABLE_8; loadIndex++) {
|
||||||
|
for (int rpmIndex = 0; rpmIndex < FSIO_TABLE_8; rpmIndex++) {
|
||||||
|
config->fsioTable1[loadIndex][rpmIndex] = fsio_table_vvt_target[loadIndex][rpmIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control
|
||||||
|
|
||||||
|
// VVT closed loop
|
||||||
|
engineConfiguration->auxPid[0].pFactor = 2;
|
||||||
|
engineConfiguration->auxPid[0].iFactor = 0.005;
|
||||||
|
engineConfiguration->auxPid[0].dFactor = 0;
|
||||||
|
engineConfiguration->auxPid[0].offset = 33;
|
||||||
|
engineConfiguration->auxPid[0].minValue = 24;
|
||||||
|
engineConfiguration->auxPid[0].maxValue = 44;
|
||||||
|
|
||||||
|
engineConfiguration->activateAuxPid1 = true; // todo: remove this field?
|
||||||
|
}
|
||||||
|
|
||||||
static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->displayLogicLevelsInEngineSniffer = true;
|
engineConfiguration->displayLogicLevelsInEngineSniffer = true;
|
||||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||||
|
@ -233,8 +256,6 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
setCommonNTCSensor(&engineConfiguration->iat, 2700);
|
setCommonNTCSensor(&engineConfiguration->iat, 2700);
|
||||||
setMAFTransferFunction(PASS_CONFIG_PARAMETER_SIGNATURE);
|
setMAFTransferFunction(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control
|
|
||||||
|
|
||||||
// set idle_position 35
|
// set idle_position 35
|
||||||
engineConfiguration->manIdlePosition = 35;
|
engineConfiguration->manIdlePosition = 35;
|
||||||
|
|
||||||
|
@ -270,14 +291,6 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->alternatorControl.dFactor = 0;
|
engineConfiguration->alternatorControl.dFactor = 0;
|
||||||
engineConfiguration->alternatorControl.periodMs = 10;
|
engineConfiguration->alternatorControl.periodMs = 10;
|
||||||
|
|
||||||
// VVT closed loop
|
|
||||||
engineConfiguration->auxPid[0].pFactor = 2;
|
|
||||||
engineConfiguration->auxPid[0].iFactor = 0.005;
|
|
||||||
engineConfiguration->auxPid[0].dFactor = 0;
|
|
||||||
engineConfiguration->auxPid[0].offset = 33;
|
|
||||||
engineConfiguration->auxPid[0].minValue = 24;
|
|
||||||
engineConfiguration->auxPid[0].maxValue = 44;
|
|
||||||
engineConfiguration->activateAuxPid1 = true; // todo: remove this field?
|
|
||||||
|
|
||||||
engineConfiguration->vvtCamSensorUseRise = true;
|
engineConfiguration->vvtCamSensorUseRise = true;
|
||||||
// set vvt_mode 3
|
// set vvt_mode 3
|
||||||
|
@ -294,14 +307,7 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
copyTimingTable(mapBased18vvtTimingTable, config->ignitionTable);
|
copyTimingTable(mapBased18vvtTimingTable, config->ignitionTable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(config->fsioTable1RpmBins, ve18fsioRpmBins, sizeof(ve18fsioRpmBins));
|
setMazdaNB2VVTSettings(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
memcpy(config->fsioTable1LoadBins, ve18fsioLoadBins, sizeof(ve18fsioLoadBins));
|
|
||||||
// todo: there should be a better way?
|
|
||||||
for (int loadIndex = 0; loadIndex < FSIO_TABLE_8; loadIndex++) {
|
|
||||||
for (int rpmIndex = 0; rpmIndex < FSIO_TABLE_8; rpmIndex++) {
|
|
||||||
config->fsioTable1[loadIndex][rpmIndex] = fsio_table_vvt_target[loadIndex][rpmIndex];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// enable cylinder_cleanup
|
// enable cylinder_cleanup
|
||||||
engineConfiguration->isCylinderCleanupEnabled = true;
|
engineConfiguration->isCylinderCleanupEnabled = true;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
void setMazdaMiataNbInjectorLag(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void setMazdaMiataNbInjectorLag(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
void setMazdaMiataNbTpsTps(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void setMazdaMiataNbTpsTps(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
void setMazdaNB2VVTSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary rusEfi test mule https://rusefi.com/forum/viewtopic.php?f=3&t=1095
|
* Primary rusEfi test mule https://rusefi.com/forum/viewtopic.php?f=3&t=1095
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "toyota_jzs147.h"
|
#include "toyota_jzs147.h"
|
||||||
#include "custom_engine.h"
|
#include "custom_engine.h"
|
||||||
#include "thermistors.h"
|
#include "thermistors.h"
|
||||||
|
#include "mazda_miata_vvt.h"
|
||||||
|
|
||||||
EXTERN_CONFIG;
|
EXTERN_CONFIG;
|
||||||
|
|
||||||
|
@ -121,8 +122,19 @@ void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->twoWireBatchIgnition = true;
|
engineConfiguration->twoWireBatchIgnition = true;
|
||||||
engineConfiguration->twoWireBatchInjection = true;
|
engineConfiguration->twoWireBatchInjection = true;
|
||||||
|
|
||||||
|
strcpy(CONFIG(engineMake), ENGINE_MAKE_TOYOTA);
|
||||||
|
strcpy(CONFIG(engineCode), "2JZ");
|
||||||
|
strcpy(CONFIG(vehicleName), "VVT example");
|
||||||
|
|
||||||
|
|
||||||
|
// todo: these magic values would be hardcoded once we find out proper magic values
|
||||||
|
engineConfiguration->fsio_setting[14] = -90;
|
||||||
|
engineConfiguration->fsio_setting[15] = +90;
|
||||||
|
|
||||||
|
engineConfiguration->auxPidPins[0] = GPIOE_3; // VVT solenoid control
|
||||||
|
|
||||||
|
// Mazda VVT settings have nothing to do wit Toyota 2JZ settings but those are a good starting point for settings
|
||||||
|
setMazdaNB2VVTSettings(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -557,6 +557,8 @@
|
||||||
#define ENGINE_MAKE_GM "GM"
|
#define ENGINE_MAKE_GM "GM"
|
||||||
#define ENGINE_MAKE_LADA "Lada"
|
#define ENGINE_MAKE_LADA "Lada"
|
||||||
#define ENGINE_MAKE_MAZDA "Mazda"
|
#define ENGINE_MAKE_MAZDA "Mazda"
|
||||||
|
#define ENGINE_MAKE_MERCEDES "Mercedes"
|
||||||
|
#define ENGINE_MAKE_TOYOTA "Toyota"
|
||||||
#define ENGINE_NOISE_CURVE_SIZE 8
|
#define ENGINE_NOISE_CURVE_SIZE 8
|
||||||
#define engineChartSize_offset 1480
|
#define engineChartSize_offset 1480
|
||||||
#define engineChartSize_offset_hex 5c8
|
#define engineChartSize_offset_hex 5c8
|
||||||
|
|
|
@ -181,7 +181,11 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
||||||
|
|
||||||
tc->vvtPosition = (engineConfiguration->vvtDisplayInverted ? -vvtPosition : vvtPosition) + engineConfiguration->vvtOffset;
|
tc->vvtPosition = (engineConfiguration->vvtDisplayInverted ? -vvtPosition : vvtPosition) + engineConfiguration->vvtOffset;
|
||||||
|
|
||||||
if (engineConfiguration->vvtMode == VVT_FIRST_HALF) {
|
switch (engineConfiguration->vvtMode) {
|
||||||
|
default:
|
||||||
|
case VVT_FIRST_HALF:
|
||||||
|
{
|
||||||
|
|
||||||
bool isEven = tc->triggerState.isEvenRevolution();
|
bool isEven = tc->triggerState.isEvenRevolution();
|
||||||
if (!isEven) {
|
if (!isEven) {
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +200,10 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (engineConfiguration->vvtMode == VVT_SECOND_HALF) {
|
}
|
||||||
|
break;
|
||||||
|
case VVT_SECOND_HALF:
|
||||||
|
{
|
||||||
bool isEven = tc->triggerState.isEvenRevolution();
|
bool isEven = tc->triggerState.isEvenRevolution();
|
||||||
if (isEven) {
|
if (isEven) {
|
||||||
// see above comment
|
// see above comment
|
||||||
|
@ -207,8 +214,9 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (engineConfiguration->vvtMode == MIATA_NB2) {
|
break;
|
||||||
|
case MIATA_NB2:
|
||||||
/**
|
/**
|
||||||
* NB2 is a symmetrical crank, there are four phases total
|
* NB2 is a symmetrical crank, there are four phases total
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue