Skip to content

[6363] Don't need a parameter of void #22

Description

@y-matsuda
class Motor
{
public:

    static const S8 PWM_MAX = 100;
    static const S8 PWM_MIN = -100;
    explicit Motor(ePortM port, bool brake = true);
    ~Motor(void);

    inline void reset(void)
    {
        nxt_motor_set_speed(mPort, 0, 1); // need to set brake to stop the motor immidiately
        nxt_motor_set_count(mPort, 0);
    }

    inline S32 getCount(void) const { return nxt_motor_get_count(mPort); }
    inline void setCount(S32 count) { nxt_motor_set_count(mPort, count); }
    void setPWM(S8 pwm);
    void setBrake(bool brake);

protected:

    inline ePortM getPort(void) const { return mPort; }
    inline bool getBrake(void) const { return mBrake; }
    inline S8 getPWM(void) const { return mPWM; }

private:
   ePortM mPort;
    bool mBrake;
    S8 mPWM;
};

When the above is reversed, a parameter of void is made but isn't wonderful as follows.

image

The expectation value.

image

There is this source cord in the following.

Source cord above-mentioned
nxtOSEK_v218/nxtOSEK/ecrobot/c++/device/Motor.h

https://dev.change-vision.com/projects/jude/ticket/6363 (private URL)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions