mirror of https://github.com/rusefi/rusefi-1.git
fix button shift inheritance (#2027)
* fix button shift inheritance * extra Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
2d9be1077b
commit
9238aa454e
|
@ -20,12 +20,12 @@ ButtonShiftController::ButtonShiftController() :
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonShiftController::init (DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void ButtonShiftController::init(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// 500 millisecond is maybe a little long?
|
// 500 millisecond is maybe a little long?
|
||||||
debounceUp.init(500, CONFIG(tcuUpshiftButtonPin), CONFIG(tcuUpshiftButtonPinMode));
|
debounceUp.init(500, CONFIG(tcuUpshiftButtonPin), CONFIG(tcuUpshiftButtonPinMode));
|
||||||
debounceDown.init(500, CONFIG(tcuDownshiftButtonPin), CONFIG(tcuDownshiftButtonPinMode));
|
debounceDown.init(500, CONFIG(tcuDownshiftButtonPin), CONFIG(tcuDownshiftButtonPinMode));
|
||||||
INJECT_ENGINE_REFERENCE(&transmissionController);
|
|
||||||
transmissionController.init();
|
GearControllerBase::init(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonShiftController::update() {
|
void ButtonShiftController::update() {
|
||||||
|
@ -77,11 +77,8 @@ void ButtonShiftController::update() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We are responsible for telling the transmission controller
|
|
||||||
// what gear we want.
|
GearControllerBase::update();
|
||||||
transmissionController.update(getDesiredGear());
|
|
||||||
// Post state to TS
|
|
||||||
postState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
class ButtonShiftController: public GearControllerBase {
|
class ButtonShiftController: public GearControllerBase {
|
||||||
public:
|
public:
|
||||||
ButtonShiftController();
|
ButtonShiftController();
|
||||||
DECLARE_ENGINE_PTR;
|
|
||||||
void update();
|
void update() override;
|
||||||
void init(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void init(DECLARE_ENGINE_PARAMETER_SIGNATURE) override;
|
||||||
private:
|
private:
|
||||||
ButtonDebounce debounceUp;
|
ButtonDebounce debounceUp;
|
||||||
ButtonDebounce debounceDown;
|
ButtonDebounce debounceDown;
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
#include "gear_controller.h"
|
#include "gear_controller.h"
|
||||||
#include "tunerstudio_outputs.h"
|
#include "tunerstudio_outputs.h"
|
||||||
|
|
||||||
void GearControllerBase::init() {
|
void GearControllerBase::init(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
INJECT_ENGINE_REFERENCE(&transmissionController);
|
INJECT_ENGINE_REFERENCE(&transmissionController);
|
||||||
transmissionController.init();
|
transmissionController.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GearControllerBase::update() {
|
void GearControllerBase::update() {
|
||||||
|
// We are responsible for telling the transmission controller
|
||||||
|
// what gear we want.
|
||||||
transmissionController.update(getDesiredGear());
|
transmissionController.update(getDesiredGear());
|
||||||
|
// Post state to TS
|
||||||
postState();
|
postState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,13 @@ public:
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
gear_e getDesiredGear() const;
|
gear_e getDesiredGear() const;
|
||||||
virtual void init();
|
virtual void init(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
private:
|
private:
|
||||||
gear_e desiredGear = NEUTRAL;
|
gear_e desiredGear = NEUTRAL;
|
||||||
protected:
|
protected:
|
||||||
gear_e setDesiredGear(gear_e);
|
gear_e setDesiredGear(gear_e);
|
||||||
|
|
||||||
|
private:
|
||||||
void postState();
|
void postState();
|
||||||
SimpleTransmissionController transmissionController;
|
SimpleTransmissionController transmissionController;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue