2020-09-28 18:39:03 -07:00
|
|
|
#include "simple_tcu.h"
|
2020-10-09 20:34:45 -07:00
|
|
|
#include "efi_gpio.h"
|
2021-01-09 11:12:45 -08:00
|
|
|
#include "tunerstudio_outputs.h"
|
2020-10-09 20:34:45 -07:00
|
|
|
#include "engine_configuration.h"
|
2020-09-28 18:39:03 -07:00
|
|
|
|
2020-10-09 20:34:45 -07:00
|
|
|
void SimpleTransmissionController::init() {
|
2020-11-23 06:43:16 -08:00
|
|
|
for (size_t i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
|
2020-12-22 11:03:54 -08:00
|
|
|
enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", CONFIG(tcu_solenoid)[i], &CONFIG(tcu_solenoid_mode)[i]);
|
2020-09-28 18:39:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleTransmissionController::update(gear_e gear) {
|
2020-11-23 06:43:16 -08:00
|
|
|
for (size_t i = 0; i < efi::size(CONFIG(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);
|
|
|
|
postState();
|
2021-01-09 11:12:45 -08:00
|
|
|
|
|
|
|
#if EFI_TUNER_STUDIO
|
|
|
|
if (engineConfiguration->debugMode == DBG_TCU) {
|
|
|
|
tsOutputChannels.debugIntField1 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][0];
|
|
|
|
tsOutputChannels.debugIntField2 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][1];
|
|
|
|
tsOutputChannels.debugIntField3 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][2];
|
|
|
|
tsOutputChannels.debugIntField4 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][3];
|
|
|
|
tsOutputChannels.debugIntField5 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][4];
|
|
|
|
}
|
|
|
|
#endif
|
2020-09-28 18:39:03 -07:00
|
|
|
}
|