X Tutup
Skip to content

Ensure that Motor/Sensor folders was created by EV3Dev #555

@jabrena

Description

@jabrena

After one user question:
#554

maybe it is the moment to fix this possible bad user experience in the proper way. Currently, the library wait 0.5 seconds (Fixed period of time) in order that Linux+EV3Dev process mount the folder about the motor/sensor with all information.

    public BaseRegulatedMotor(final Port motorPort, float moveP, float moveI, float moveD,
                              float holdP, float holdI, float holdD, int offset, int maxSpeed) {

        List<RegulatedMotorListener> list = new ArrayList<>();
        listenerList = Collections.synchronizedList(list);

        if(log.isInfoEnabled())
            log.info("Configuring motor connected on Port: {}", motorPort.getName());

        MAX_SPEED_AT_9V = maxSpeed;
        final EV3DevPlatforms ev3DevPlatforms = EV3DevPlatforms.getInstance();
        final String port = ev3DevPlatforms.getMotorPort(motorPort);

        if(log.isDebugEnabled())
            log.debug("Detecting motor on port: {}", port);
        this.detect(LEGO_PORT, port);
        if(log.isDebugEnabled())
            log.debug("Setting port in mode: {}", TACHO_MOTOR);
        this.setStringAttribute(MODE, TACHO_MOTOR);
        Delay.msDelay(500);
        this.detect(TACHO_MOTOR, port);
        Delay.msDelay(500);
        this.setStringAttribute(COMMAND, RESET);
        if(log.isDebugEnabled())
            log.debug("Motor ready to use on Port: {}",motorPort.getName());
    }

Maybe, it could be interesting to create a POC to see what is the best approach to do it.

Basically, we should introduce a asynchronous process to wait for the existency of a determinated number of folders.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup