Have you updated the firmware on you Puck.js? The original firmware didn't advertise that often, and could cause exactly this kind of problem. The new one is every 350ms or so, and is significantly more reliable to connect to.
But as you say, the command-line app could wait for longer. I'd actually prefer to shorten the timeout you mention, and to then change the connection logic (that calls Espruino.Core.Serial.getPorts) so that it calls getPorts multiple times until it finds the port that's been specified.
It'd make it a lot faster in the cases where Puck.js was advertising quickly, and also when connecting to USB devices where realistically it needn't scan at all.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Have you updated the firmware on you Puck.js? The original firmware didn't advertise that often, and could cause exactly this kind of problem. The new one is every 350ms or so, and is significantly more reliable to connect to.
But as you say, the command-line app could wait for longer. I'd actually prefer to shorten the timeout you mention, and to then change the connection logic (that calls
Espruino.Core.Serial.getPorts
) so that it calls getPorts multiple times until it finds the port that's been specified.It'd make it a lot faster in the cases where Puck.js was advertising quickly, and also when connecting to USB devices where realistically it needn't scan at all.