a1aw / ev3dev-lang-java

An ev3dev unified language binding for Java.
https://mob41.github.io/ev3dev-lang-java/
MIT License
0 stars 0 forks source link

Motor's inherits jumps InvalidMotorException if it is disconnected #2

Closed a1aw closed 8 years ago

a1aw commented 8 years ago

It is being fixed during the process of "Device Extending Project". Probably not a project...

This problem exists because of this dirty code:

public LargeMotor(LegoPort port) throws InvalidPortException, IOException, InvalidMotorException {
        super(port);
        String drivername = this.getDriverName();
        if (!drivername.equals(PropertyDefaults.LARGE_MOTOR_DRIVER_NAME)){
            throw new InvalidMotorException("It is not a LargeMotor (" + PropertyDefaults.LARGE_MOTOR_DRIVER_NAME + "): " + drivername);
        }
    }

This code simply get the driver name and determine is it a large motor driver name. But if the motor is removed, the driver name is NULL / undefined. So it jumps a error and annoys you.

a1aw commented 8 years ago

In the commit a4ce47d, the driver checking are disabled again.

a1aw commented 8 years ago

Though the last issue, exceptions from here are accepted. Driver checks are enabled again starting from the commit 0f29a55d419c8efa5afab6f8e520bea4ca6e35d6