transmission solenoid control (#1833)

* simple trans controller

* don't need check

* we can loop!

* use efi::size

* pin mode configuration

* set pin mode

* switch to RegisteredOutputPin

* size
This commit is contained in:
David Holdeman 2020-09-28 20:39:03 -05:00 committed by GitHub
parent fb2fa9aa62
commit d6bc2a70e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,17 @@
#include "simple_tcu.h"
RegisteredOutputPin tcuSolenoids[efi::size(tcu_solenoid)];
void SimpleTransmissionController::SimpleTransmissionController() {
for (int i = 0; i < efi::size(tcu_solenoid); i++) {
tcuSolenoids[i].initPin("Transmission Solenoid", CONFIG(tcu_solenoid[i]), CONFIG{tcu_solenoid_mode[i]});
}
}
void SimpleTransmissionController::update(gear_e gear) {
for (int i = 0; i < efi::size(tcu_solenoid); i++) {
tcuSolenoids[i].setValue(CONFIG(tcuSolenoidTable)[i][static_cast<int>(gear)])
}
setCurrentGear(gear);
postState();
}

View File

@ -0,0 +1,9 @@
#pragma once
#include "tcu.h"
class SimpleTransmissionController {
public:
void update(gear_e);
SimpleTransmissionController();
}

View File

@ -1399,8 +1399,10 @@ uint8_t[4] unusedsw;;"units", 1, 0, -20, 100, 0
pin_input_mode_e acSwitchMode
pin_output_mode_e[TCU_SOLENOID_COUNT iterate] tcu_solenoid_mode;
! just a reminder that 'int' and 'float' are 4 bytes each
int[370] mainUnusedEnd;;"units", 1, 0, -20, 100, 0
int[369] mainUnusedEnd;;"units", 1, 0, -20, 100, 0
! end of engine_configuration_s
end_struct

View File

@ -2951,6 +2951,12 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
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 Mode" tcu_solenoid_mode2, { tcuEnabled }
field = "Solenoid 3 Pin Mode" tcu_solenoid_mode3, { tcuEnabled }
field = "Solenoid 4 Pin Mode" tcu_solenoid_mode4, { tcuEnabled }
field = "Solenoid 5 Pin Mode" tcu_solenoid_mode5, { tcuEnabled }
field = "Solenoid 6 Pin Mode" tcu_solenoid_mode6, { tcuEnabled }
dialog = buttonShiftInputPanel
field = "Upshift Pin" tcuUpshiftButtonPin, { tcuEnabled }