2020-09-28 18:39:03 -07:00
|
|
|
#include "simple_tcu.h"
|
2020-10-09 20:34:45 -07:00
|
|
|
#include "efi_gpio.h"
|
|
|
|
#include "engine_configuration.h"
|
2020-09-28 18:39:03 -07:00
|
|
|
|
2020-10-09 20:34:45 -07:00
|
|
|
EXTERN_CONFIG;
|
2020-09-28 18:39:03 -07:00
|
|
|
|
2020-10-09 20:34:45 -07:00
|
|
|
OutputPin tcuSolenoids[TCU_SOLENOID_COUNT];
|
|
|
|
|
|
|
|
void SimpleTransmissionController::init() {
|
2020-11-23 06:43:16 -08:00
|
|
|
for (size_t i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
|
2020-10-09 20:34:45 -07:00
|
|
|
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-12 12:41:27 -08:00
|
|
|
tcuSolenoids[i].setValue(config->tcuSolenoidTable[i][static_cast<int>(gear) + 1]);
|
2020-10-09 20:34:45 -07:00
|
|
|
#endif
|
2020-09-28 18:39:03 -07:00
|
|
|
}
|
|
|
|
setCurrentGear(gear);
|
|
|
|
postState();
|
|
|
|
}
|