rename enum (#791)
This commit is contained in:
parent
0bb8ab2aef
commit
5a15b449c0
|
@ -121,7 +121,7 @@ public:
|
|||
brain_pin_e pinEnable,
|
||||
brain_pin_e pinDir1,
|
||||
brain_pin_e pinDir2) {
|
||||
dcMotor.SetType(useTwoWires ? TwoPinDcMotor::ControlType::TwoDirection : TwoPinDcMotor::ControlType::TwoDirectionAndEnable);
|
||||
dcMotor.SetType(useTwoWires ? TwoPinDcMotor::ControlType::PwmDirectionPins : TwoPinDcMotor::ControlType::PwmEnablePin);
|
||||
|
||||
m_pinEnable.initPin("ETB Enable", pinEnable);
|
||||
m_pinDir1.initPin("ETB Dir 1", pinDir1);
|
||||
|
|
|
@ -51,10 +51,10 @@ bool TwoPinDcMotor::Set(float duty)
|
|||
}
|
||||
|
||||
// If we're in two pin mode, force 100%, else use this pin to PWM
|
||||
float enableDuty = m_type == ControlType::TwoDirection ? 1 : duty;
|
||||
float enableDuty = m_type == ControlType::PwmEnablePin ? duty : 1;
|
||||
|
||||
// If we're in dir + en mode, force 100%, else use the dir pins for PMW
|
||||
float dirDuty = m_type == ControlType::TwoDirection ? duty : 1;
|
||||
// Direction pins get 100% duty unless we're in PwmDirectionPins mode
|
||||
float dirDuty = m_type == ControlType::PwmDirectionPins ? duty : 1;
|
||||
|
||||
m_enable->setSimplePwmDutyCycle(enableDuty);
|
||||
m_dir1->setSimplePwmDutyCycle(isPositive ? dirDuty : 0);
|
||||
|
|
|
@ -40,8 +40,8 @@ class TwoPinDcMotor : public DcMotor
|
|||
public:
|
||||
enum class ControlType
|
||||
{
|
||||
TwoDirection,
|
||||
TwoDirectionAndEnable,
|
||||
PwmDirectionPins,
|
||||
PwmEnablePin,
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue