• Hi,

    I can successfully upload the code via Espruino Web IDE. The port I have to select on Web IDE is:
    /dev/cu.wchusbserial1410

    However if I run espruino --list I can't see that port, instead I see (among others /dev/tty.*) /dev/tty.wchusbserial1410 - however there is any /dev/cu.*)

    Regardless the port I try to use cli upload doesn't work for me.
    At times I am getting an info that the port was not found (although its on the list).

    The full command I am running is:

    espruino -v --no-ble -b 11520 -p /dev/tty.wchusbserial1410 --board ESP8266_4MB app.js
    
    Manual board JSON load complete
    Connecting to '/dev/tty.wchusbserial1410'
    Noble: getPorts - disabled
    No navigator.bluetooth - Web Bluetooth not enabled
    Port "/dev/tty.wchusbserial1410" not found - checking ports again (2 attempts left)
    Noble: getPorts - disabled
    Port "/dev/tty.wchusbserial1410" not found - checking ports again (1 attempts left)
    Noble: getPorts - disabled
    Port "/dev/tty.wchusbserial1410" not found
    Unable to connect!
    

    and

    espruino --list
    
    Espruino Command-line Tool 0.1.27
    -----------------------------------
    
    PORTS:
      /dev/tty.usbserial-1420
      /dev/tty.wchusbserial1420
    

    Any ideas ? Thanks.

  • Hi!
    Possibly just a typo in the forum post, but may work checking:
    -b 11520 << Should be 115200, a 0 is missing
    You wrote wchusbserial1410, but the list shows wchusbserial1420 (10 vs 20 at the end)

  • Thanks @AkosLukacs
    with the updates you mentioned (I wonder how I didn't noticed it before ?!) and installing serialport I am one step further.

    Now the upload seems to load, but I am getting syntax error - probably because of my ES6 notation - do you know why I can't use ES6 if on web IDE it works fine ?

  • Don't know, can you post your code & the error you get?

  • // REQUIRE
    const D1 = NodeMCU.D1;
    const D2 = NodeMCU.D2;
    
    const wifi = require("Wifi");
    
    // CONSTS
    const MQTT_SERVER_IP = "";
    const SSID = "";
    const PASS = "";
    
    // FNS
    const connectWifi = () =>
      new Promise((resolve, reject) => {
        wifi.connect(SSID, { password: PASS }, function(e) {
          if (e) {
            console.log("error during connect:", e);
            wifi.disconnect();
            reject(e);
          } else {
            console.log("connected to", SSID);
            wifi.stopAP();
            resolve(wifi);
          }
        });
      });
    
    const connectDisplay = () =>
      new Promise((resolve, reject) => {
        console.log(1);
        I2C1.setup({ scl: D1, sda: D2 });
        console.log(2);
        // OLED driver and graphic library
        const g = require("SSD1306").connect(I2C1, () => {
          resolve(g);
        });
      });
    
    let g = null;
    const writeText = text => {
      g.clear();
      g.setRotation(2);
      g.setColor(1);
      g.setFontVector(15);
      g.drawString(text, 0, 10);
      g.flip();
    };
    
    const startApp = () => {
      connectDisplay()
        .then(newG => {
          g = newG;
          writeText("Init...");
        })
        .then(() => {
          return connectWifi();
        })
        .then(() => {
          writeText("Wifi - OK");
          const mqtt = require("MQTT").connect({
            host: MQTT_SERVER_IP
          });
    
          mqtt.on("disconnected", () => {
            writeText("Disconnected");
          });
    
          mqtt.on("connected", () => {
            writeText("MQTT - OK");
            mqtt.subscribe("wemos/#");
    
            const topic = "wemos/start";
            const message = "Demo!";
            mqtt.publish(topic, message);
    
            mqtt.on("publish", pub => {
               writeText(pub.message);
            });
          });
        })
        .catch(() => {
          writeText("Error!");
        });
    };
    
    //startApp();
    E.on("init", startApp);
    save();
    
  • Ok, got the error.

    const connectWifi = () =>
      new Promise((resolve, reject) => {
        wifi.connect(SSID, { password: PASS }, function(e) {
          if (e) {
            console.log("error during connect:", e);
            wifi.disconnect();
            reject(e);
          } else {
            console.log("connected to", SSID);
            wifi.stopAP();
            resolve(wifi);
          }
        });
      });
    

    has to be

    const connectWifi = () => {
      return new Promise((resolve, reject) => {
        wifi.connect(SSID, { password: PASS }, function(e) {
          if (e) {
            console.log("error during connect:", e);
            wifi.disconnect();
            reject(e);
          } else {
            console.log("connected to", SSID);
            wifi.stopAP();
            resolve(wifi);
          }
        });
      });
    };
    

    difficult to track, because both formats are valid, and text editor can't catch the issue :/

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

espruino-cli - it doesn't detect the same ports as espruino web IDE

Posted by Avatar for michalt @michalt

Actions