Some untested TCC control (#4066)
* rebase * save changes * save changes * fix whitespace * try enum class * change field name * Add TCC pin fields * add TCC tables * add a bit of TCC control logic
This commit is contained in:
parent
cc1456bac4
commit
fe39f58022
|
@ -213,6 +213,8 @@ public:
|
|||
IgnitionOutputPin trailingCoils[MAX_CYLINDER_COUNT];
|
||||
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
|
||||
OutputPin tcuSolenoids[TCU_SOLENOID_COUNT];
|
||||
OutputPin tcuTccOnoffSolenoid;
|
||||
OutputPin tcuTccPwmSolenoid;
|
||||
|
||||
private:
|
||||
void startInjectionPins();
|
||||
|
|
|
@ -8,28 +8,59 @@ void Gm4l6xTransmissionController::init() {
|
|||
for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) {
|
||||
enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", engineConfiguration->tcu_solenoid[i], &engineConfiguration->tcu_solenoid_mode[i]);
|
||||
}
|
||||
enginePins.tcuTccOnoffSolenoid.initPin("TCC On/Off Solenoid", engineConfiguration->tcu_tcc_onoff_solenoid, &engineConfiguration->tcu_tcc_onoff_solenoid_mode);
|
||||
enginePins.tcuTccPwmSolenoid.initPin("TCC PWM Solenoid", engineConfiguration->tcu_tcc_pwm_solenoid, &engineConfiguration->tcu_tcc_pwm_solenoid_mode);
|
||||
}
|
||||
|
||||
void Gm4l6xTransmissionController::update(gear_e gear) {
|
||||
for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) {
|
||||
#if ! EFI_UNIT_TEST
|
||||
enginePins.tcuSolenoids[i].setValue(config->tcuSolenoidTable[static_cast<int>(gear) + 1][i]);
|
||||
#endif
|
||||
}
|
||||
setCurrentGear(gear);
|
||||
postState();
|
||||
setCurrentGear(gear);
|
||||
setTccState();
|
||||
postState();
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
if (engineConfiguration->debugMode == DBG_TCU) {
|
||||
engine->outputChannels.debugIntField1 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][0];
|
||||
engine->outputChannels.debugIntField2 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][1];
|
||||
engine->outputChannels.debugIntField3 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][2];
|
||||
engine->outputChannels.debugIntField4 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][3];
|
||||
engine->outputChannels.debugIntField5 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][4];
|
||||
}
|
||||
if (engineConfiguration->debugMode == DBG_TCU) {
|
||||
engine->outputChannels.debugIntField1 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][0];
|
||||
engine->outputChannels.debugIntField2 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][1];
|
||||
engine->outputChannels.debugIntField3 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][2];
|
||||
engine->outputChannels.debugIntField4 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][3];
|
||||
engine->outputChannels.debugIntField5 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][4];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
gear_e Gm4l6xTransmissionController::setCurrentGear(gear_e gear) {
|
||||
if (gear == getCurrentGear()) {
|
||||
return getCurrentGear();
|
||||
}
|
||||
currentGear = gear;
|
||||
enginePins.tcuTccOnoffSolenoid.setValue(0);
|
||||
for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) {
|
||||
#if ! EFI_UNIT_TEST
|
||||
enginePins.tcuSolenoids[i].setValue(config->tcuSolenoidTable[static_cast<int>(gear) + 1][i]);
|
||||
#endif
|
||||
}
|
||||
return getCurrentGear();
|
||||
}
|
||||
|
||||
void Gm4l6xTransmissionController::setTccState() {
|
||||
auto tps = Sensor::get(SensorType::DriverThrottleIntent);
|
||||
auto vss = Sensor::get(SensorType::VehicleSpeed);
|
||||
if (!tps.Valid || !vss.Valid) {
|
||||
return;
|
||||
}
|
||||
if (getCurrentGear() == GEAR_4) {
|
||||
int lockSpeed = interpolate2d(tps.Value, engineConfiguration->tcu_tccTpsBins, engineConfiguration->tcu_tccLockSpeed);
|
||||
int unlockSpeed = interpolate2d(tps.Value, engineConfiguration->tcu_tccTpsBins, engineConfiguration->tcu_tccUnlockSpeed);
|
||||
if (vss.Value > lockSpeed) {
|
||||
enginePins.tcuTccOnoffSolenoid.setValue(1);
|
||||
} else if (vss.Value < lockSpeed) {
|
||||
enginePins.tcuTccOnoffSolenoid.setValue(1);
|
||||
}
|
||||
} else {
|
||||
enginePins.tcuTccOnoffSolenoid.setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
Gm4l6xTransmissionController* getGm4l6xTransmissionController() {
|
||||
return &gm4l6xTransmissionController;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ public:
|
|||
void update(gear_e);
|
||||
void init();
|
||||
TransmissionControllerMode mode = TransmissionControllerMode::Gm4l6x;
|
||||
private:
|
||||
gear_e setCurrentGear(gear_e gear);
|
||||
void setTccState();
|
||||
};
|
||||
|
||||
Gm4l6xTransmissionController* getGm4l6xTransmissionController();
|
||||
|
|
|
@ -19,9 +19,8 @@ public:
|
|||
void init();
|
||||
gear_e getCurrentGear() const;
|
||||
TransmissionControllerMode mode = TransmissionControllerMode::None;
|
||||
private:
|
||||
gear_e currentGear = NEUTRAL;
|
||||
protected:
|
||||
gear_e currentGear = NEUTRAL;
|
||||
gear_e setCurrentGear(gear_e);
|
||||
void postState();
|
||||
};
|
||||
|
|
|
@ -1515,8 +1515,9 @@ int8_t[MAX_CYLINDER_COUNT iterate] fuelTrim;;"Percent", @@PERCENT_TRIM_BYTE_PACK
|
|||
uint16_t[HPFP_COMPENSATION_SIZE] autoscale hpfpCompensationLoadBins;;"cc/lobe", 0.001, 0, 0, 65, 3
|
||||
uint8_t[HPFP_COMPENSATION_SIZE] autoscale hpfpCompensationRpmBins;;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 12500, 0
|
||||
|
||||
uint8_t[8] unusedSSValues;;"Nm", 10, 0, 0, 255, 0
|
||||
uint16_t[8] unusedRpmBins;;"RPM", 1, 0, 0, 65000, 0
|
||||
uint8_t[8] tcu_tccTpsBins;;"TPS", 1, 0, 0, 255, 0
|
||||
uint8_t[8] tcu_tccLockSpeed;;"MPH", 1, 0, 0, 255, 0
|
||||
uint8_t[8] tcu_tccUnlockSpeed;;"MPH", 1, 0, 0, 255, 0
|
||||
|
||||
output_pin_e[4 iterate] stepper_raw_output;
|
||||
|
||||
|
@ -1550,7 +1551,12 @@ uint8_t[TORQUE_CURVE_SIZE x TORQUE_CURVE_SIZE] autoscale torqueTable;;"Nm", 10,
|
|||
linear_sensor_s auxLinear1
|
||||
linear_sensor_s auxLinear2
|
||||
|
||||
uint8_t[228] mainUnusedEnd;;"units", 1, 0, 0, 1, 0
|
||||
output_pin_e tcu_tcc_onoff_solenoid
|
||||
pin_output_mode_e tcu_tcc_onoff_solenoid_mode
|
||||
output_pin_e tcu_tcc_pwm_solenoid
|
||||
pin_output_mode_e tcu_tcc_pwm_solenoid_mode
|
||||
|
||||
uint8_t[224] mainUnusedEnd;;"units", 1, 0, 0, 1, 0
|
||||
|
||||
! end of engine_configuration_s
|
||||
end_struct
|
||||
|
|
|
@ -652,6 +652,22 @@ enable2ndByteCanID = false
|
|||
yBins = tchargeValues
|
||||
gauge = tChargeGauge
|
||||
|
||||
curve = tccLockCurve, "TCC Lock Curve"
|
||||
columnLabel = "TPS", "Lockup Speed"
|
||||
xAxis = 0, 100, 10
|
||||
yAxis = 0, 100, 10
|
||||
xBins = tcu_tccTpsBins, TPSValue
|
||||
yBins = tcu_tccLockSpeed
|
||||
gauge = TPSGauge
|
||||
|
||||
curve = tccUnlockCurve, "TCC Unlock Curve"
|
||||
columnLabel = "TPS", "Unlock Speed"
|
||||
xAxis = 0, 100, 10
|
||||
yAxis = 0, 100, 10
|
||||
xBins = tcu_tccTpsBins, TPSValue
|
||||
yBins = tcu_tccUnlockSpeed
|
||||
gauge = TPSGauge
|
||||
|
||||
[TableEditor]
|
||||
; table_id, map3d_id, "title", page
|
||||
|
||||
|
@ -1509,6 +1525,7 @@ menuDialog = main
|
|||
subMenu = std_separator
|
||||
subMenu = tcuControls, "Transmission Settings"
|
||||
subMenu = tcuSolenoidTableTbl, "TCU Solenoids"
|
||||
subMenu = tccCurves, "TCC Lock/Unlock Speed"
|
||||
|
||||
menu = "&Sensors"
|
||||
# Base analog input settings
|
||||
|
@ -3404,22 +3421,32 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
|
||||
dialog = transmissionPanel
|
||||
field = "TCU Enabled" tcuEnabled
|
||||
field = "Gear Controller" gearControllerMode
|
||||
field = "Transmission Controller" transmissionControllerMode
|
||||
field = "Gear Controller" gearControllerMode, { tcuEnabled }
|
||||
field = "Transmission Controller" transmissionControllerMode, {tcuEnabled}
|
||||
|
||||
dialog = solenoidPanel, "Shift Solenoids"
|
||||
field = "Solenoid 1 Pin" tcu_solenoid1, { tcuEnabled }
|
||||
field = "Solenoid 2 Pin" tcu_solenoid2, { tcuEnabled }
|
||||
field = "Solenoid 3 Pin" tcu_solenoid3, { tcuEnabled }
|
||||
field = "Solenoid 4 Pin" tcu_solenoid4, { tcuEnabled }
|
||||
field = "Solenoid 5 Pin" tcu_solenoid5, { tcuEnabled }
|
||||
field = "Solenoid 6 Pin" tcu_solenoid6, { tcuEnabled }
|
||||
field = "Solenoid 1 Pin Mode" tcu_solenoid_mode1, { tcuEnabled }
|
||||
field = "Solenoid 2 Pin" tcu_solenoid2, { tcuEnabled }
|
||||
field = "Solenoid 2 Pin Mode" tcu_solenoid_mode2, { tcuEnabled }
|
||||
field = "Solenoid 3 Pin" tcu_solenoid3, { tcuEnabled }
|
||||
field = "Solenoid 3 Pin Mode" tcu_solenoid_mode3, { tcuEnabled }
|
||||
field = "Solenoid 4 Pin" tcu_solenoid4, { tcuEnabled }
|
||||
field = "Solenoid 4 Pin Mode" tcu_solenoid_mode4, { tcuEnabled }
|
||||
field = "Solenoid 5 Pin" tcu_solenoid5, { tcuEnabled }
|
||||
field = "Solenoid 5 Pin Mode" tcu_solenoid_mode5, { tcuEnabled }
|
||||
field = "Solenoid 6 Pin" tcu_solenoid6, { tcuEnabled }
|
||||
field = "Solenoid 6 Pin Mode" tcu_solenoid_mode6, { tcuEnabled }
|
||||
field = "TCC On/Off Solenoid Pin" tcu_tcc_onoff_solenoid, { tcuEnabled }
|
||||
field = "TCC On/Off Solenoid Pin Mode" tcu_tcc_onoff_solenoid_mode, { tcuEnabled }
|
||||
field = "TCC PWM Solenoid Pin" tcu_tcc_pwm_solenoid, { tcuEnabled }
|
||||
field = "TCC PWM Solenoid Pin Mode" tcu_tcc_pwm_solenoid_mode, { tcuEnabled }
|
||||
|
||||
dialog = buttonShiftInputPanel, "Switch/Button Shift"
|
||||
field = "Upshift Pin" tcuUpshiftButtonPin, { tcuEnabled }
|
||||
field = "Upshift Pin Mode" tcuUpshiftButtonPinMode, { tcuEnabled }
|
||||
field = "Downshift Pin" tcuDownshiftButtonPin, { tcuEnabled }
|
||||
field = "Downshift Pin Mode" tcuDownshiftButtonPinMode, { tcuEnabled }
|
||||
|
||||
dialog = buttonShiftInputPanel, "Switch/Button Shift"
|
||||
field = "Upshift Pin" tcuUpshiftButtonPin, { tcuEnabled }
|
||||
|
@ -3432,6 +3459,10 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
panel = solenoidPanel
|
||||
panel = buttonShiftInputPanel
|
||||
|
||||
dialog = tccCurves, "TCC Lock/Unlock Speed"
|
||||
panel = tccLockCurve
|
||||
panel = tccUnlockCurve
|
||||
|
||||
;Boost Open Loop
|
||||
|
||||
dialog = boostDialog, ""
|
||||
|
|
Loading…
Reference in New Issue