You are reading a single comment by @CriscoCrusader and its replies. Click here to read the full conversation.
  • Tonight I got as far as loading the build result on the board using the espruino npm module. I spent a few hours trying to get it to drop me into the espruino REPL right after the code is loaded, like what happens when I connect from the command line, espruino -p /dev/cu.usbmodem1421, but I haven't been able to get it working.

    I copied the terminal() function from espruino-cli.js, but when Espruino.Core.Serial.open() is called, this error is thrown:

    COM:  /dev/cu.usbmodem1421
    Connected Ok
    undefined:92
        connection.write(a, callback);
                  ^
    
    TypeError: Cannot read property 'write' of undefined
        at Object.writeSerial [as write] (eval at loadJS (/Users/rob/projects/espruino2/node_modu­les/espruino/index.js:10:15), <anonymous>:92:15)
        at writeSerialWorker (eval at loadJS (/Users/rob/projects/espruino2/node_modu­les/espruino/index.js:10:15), <anonymous>:228:19)
        at Object.writeSerial [as write] (eval at loadJS (/Users/rob/projects/espruino2/node_modu­les/espruino/index.js:10:15), <anonymous>:245:5)
        at Object.getEspruinoPrompt (eval at loadJS (/Users/rob/projects/espruino2/node_modu­les/espruino/index.js:10:15), <anonymous>:206:26)
        at Object.executeExpression (eval at loadJS (/Users/rob/projects/espruino2/node_modu­les/espruino/index.js:10:15), <anonymous>:270:27)
        at Timeout.queryBoardProcess [as _onTimeout] (eval at loadJS (/Users/rob/projects/espruino2/node_modu­les/espruino/index.js:10:15), <anonymous>:39:25)
        at ontimeout (timers.js:372:18)
        at tryOnTimeout (timers.js:237:5)
        at Timer.listOnTimeout (timers.js:207:5)
    

    I can see that it's invoking open() on the device (openSerial, serial_nodeserial.js), but I haven't figured out what's happening there and why connection is undefined in my use case.

    FWIW, calling Espruino.Core.Serial.isConnected() before Espruino.Core.Serial.open() returns false.

About