2021-07-25 22:05:17 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2020-10-09 20:34:45 -07:00
|
|
|
#include "gear_controller.h"
|
|
|
|
|
2022-04-23 04:34:39 -07:00
|
|
|
#if EFI_TCU
|
2021-11-16 01:15:29 -08:00
|
|
|
void GearControllerBase::init() {
|
2022-04-06 14:37:30 -07:00
|
|
|
initTransmissionController();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GearControllerBase::initTransmissionController() {
|
|
|
|
switch (engineConfiguration->transmissionControllerMode) {
|
|
|
|
case TransmissionControllerMode::SimpleTransmissionController :
|
|
|
|
transmissionController = getSimpleTransmissionController();
|
|
|
|
break;
|
|
|
|
case TransmissionControllerMode::Gm4l6x :
|
|
|
|
transmissionController = getGm4l6xTransmissionController();
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
transmissionController = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
transmissionController->init();
|
2020-10-09 20:34:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void GearControllerBase::update() {
|
2022-04-06 14:37:30 -07:00
|
|
|
if (transmissionController == NULL) {
|
|
|
|
initTransmissionController();
|
2022-04-18 17:09:27 -07:00
|
|
|
} else if (transmissionController->getMode() != engineConfiguration->transmissionControllerMode) {
|
2022-04-06 14:37:30 -07:00
|
|
|
initTransmissionController();
|
|
|
|
}
|
|
|
|
// We are responsible for telling the transmission controller
|
|
|
|
// what gear we want.
|
|
|
|
transmissionController->update(getDesiredGear());
|
|
|
|
// Post state to TS
|
|
|
|
postState();
|
2020-10-09 20:34:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
gear_e GearControllerBase::getDesiredGear() const {
|
|
|
|
return desiredGear;
|
|
|
|
}
|
|
|
|
|
|
|
|
gear_e GearControllerBase::setDesiredGear(gear_e gear) {
|
|
|
|
desiredGear = gear;
|
|
|
|
return getDesiredGear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GearControllerBase::postState() {
|
|
|
|
#if EFI_TUNER_STUDIO
|
2021-12-07 17:18:47 -08:00
|
|
|
engine->outputChannels.tcuDesiredGear = getDesiredGear();
|
2020-10-09 20:34:45 -07:00
|
|
|
#endif
|
|
|
|
}
|
2022-04-06 14:37:30 -07:00
|
|
|
|
|
|
|
void initGearController() {
|
|
|
|
switch (engineConfiguration->gearControllerMode) {
|
|
|
|
case GearControllerMode::ButtonShift :
|
|
|
|
engine->gearController = getButtonShiftController();
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
engine->gearController = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
engine->gearController->init();
|
|
|
|
}
|
2022-04-23 04:34:39 -07:00
|
|
|
#endif // EFI_TCU
|