2021-07-25 22:05:17 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2020-09-28 18:39:03 -07:00
|
|
|
#include "simple_tcu.h"
|
|
|
|
|
2022-04-23 04:34:39 -07:00
|
|
|
#if EFI_TCU
|
2022-04-06 14:37:30 -07:00
|
|
|
SimpleTransmissionController simpleTransmissionController;
|
|
|
|
|
2020-10-09 20:34:45 -07:00
|
|
|
void SimpleTransmissionController::init() {
|
2021-11-17 00:54:21 -08:00
|
|
|
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]);
|
2020-09-28 18:39:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleTransmissionController::update(gear_e gear) {
|
2021-11-17 00:54:21 -08:00
|
|
|
for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) {
|
2020-12-16 19:00:42 -08:00
|
|
|
#if ! EFI_UNIT_TEST
|
2020-12-22 19:35:29 -08:00
|
|
|
enginePins.tcuSolenoids[i].setValue(config->tcuSolenoidTable[static_cast<int>(gear) + 1][i]);
|
2020-10-09 20:34:45 -07:00
|
|
|
#endif
|
2020-09-28 18:39:03 -07:00
|
|
|
}
|
|
|
|
setCurrentGear(gear);
|
2021-01-09 11:12:45 -08:00
|
|
|
|
|
|
|
#if EFI_TUNER_STUDIO
|
|
|
|
if (engineConfiguration->debugMode == DBG_TCU) {
|
2021-12-07 17:18:47 -08:00
|
|
|
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];
|
2021-01-09 11:12:45 -08:00
|
|
|
}
|
|
|
|
#endif
|
2022-04-23 04:34:39 -07:00
|
|
|
|
|
|
|
TransmissionControllerBase::update(gear);
|
2020-09-28 18:39:03 -07:00
|
|
|
}
|
2022-04-06 14:37:30 -07:00
|
|
|
|
|
|
|
SimpleTransmissionController* getSimpleTransmissionController() {
|
|
|
|
return &simpleTransmissionController;
|
|
|
|
}
|
2022-04-23 04:34:39 -07:00
|
|
|
#endif // EFI_TCU
|