balena-io-hardware / autokit-interface-sw

Apache License 2.0
5 stars 2 forks source link

SDWire: only takes milliseconds to change #60

Open perezmeyer opened 1 year ago

perezmeyer commented 1 year ago

Currently the code reads:

    async toggleMux(state: string): Promise<void> {
        if(state === 'host'){
            console.log('Switching SD card to host');
            await execAsync('sd-mux-ctrl --ts -v 0');
            // it can take some time before the mux is toggled - so just to be sure, we can add some delay here
            await delay(5000);
        } else if(state === 'dut'){
            console.log('Switching SD card to DUT');
            await execAsync('sd-mux-ctrl --dut -v 0');
            // it can take some time before the mux is toggled - so just to be sure, we can add some delay here
            await delay(5000);
        }
    }

SDWire takes just a few milliseconds to switch. If the delay is expressed in milliseconds I would say reduce that to 500.

perezmeyer commented 1 year ago

@rcooke-warwick @vipulgupta2048 Seems I can not assign issues, so pinging you here.

rcooke-warwick commented 1 year ago

hey @vipulgupta2048 @perezmeyer , here's my opinion on this change:

perezmeyer commented 1 year ago

Well, that sounds like a bug in node code... but OK, I'll increase it to 1s