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) {
|
||||
// 500 millisecond is maybe a little long?
|
||||
debounceUp.init(500, CONFIG(tcuUpshiftButtonPin), CONFIG(tcuUpshiftButtonPinMode));
|
||||
debounceDown.init(500, CONFIG(tcuDownshiftButtonPin), CONFIG(tcuDownshiftButtonPinMode));
|
||||
INJECT_ENGINE_REFERENCE(&transmissionController);
|
||||
transmissionController.init();
|
||||
void ButtonShiftController::init(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
// 500 millisecond is maybe a little long?
|
||||
debounceUp.init(500, CONFIG(tcuUpshiftButtonPin), CONFIG(tcuUpshiftButtonPinMode));
|
||||
debounceDown.init(500, CONFIG(tcuDownshiftButtonPin), CONFIG(tcuDownshiftButtonPinMode));
|
||||
|
||||
GearControllerBase::init(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
void ButtonShiftController::update() {
|
||||
|
@ -77,11 +77,8 @@ void ButtonShiftController::update() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// We are responsible for telling the transmission controller
|
||||
// what gear we want.
|
||||
transmissionController.update(getDesiredGear());
|
||||
// Post state to TS
|
||||
postState();
|
||||
|
||||
GearControllerBase::update();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
class ButtonShiftController: public GearControllerBase {
|
||||
public:
|
||||
ButtonShiftController();
|
||||
DECLARE_ENGINE_PTR;
|
||||
void update();
|
||||
void init(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
void update() override;
|
||||
void init(DECLARE_ENGINE_PARAMETER_SIGNATURE) override;
|
||||
private:
|
||||
ButtonDebounce debounceUp;
|
||||
ButtonDebounce debounceDown;
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
#include "gear_controller.h"
|
||||
#include "tunerstudio_outputs.h"
|
||||
|
||||
void GearControllerBase::init() {
|
||||
void GearControllerBase::init(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
INJECT_ENGINE_REFERENCE(&transmissionController);
|
||||
transmissionController.init();
|
||||
}
|
||||
|
||||
void GearControllerBase::update() {
|
||||
// We are responsible for telling the transmission controller
|
||||
// what gear we want.
|
||||
transmissionController.update(getDesiredGear());
|
||||
// Post state to TS
|
||||
postState();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,13 @@ public:
|
|||
|
||||
virtual void update();
|
||||
gear_e getDesiredGear() const;
|
||||
virtual void init();
|
||||
virtual void init(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
private:
|
||||
gear_e desiredGear = NEUTRAL;
|
||||
protected:
|
||||
gear_e setDesiredGear(gear_e);
|
||||
|
||||
private:
|
||||
void postState();
|
||||
SimpleTransmissionController transmissionController;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue