Avatar for fanThomas

fanThomas

Member since Oct 2018 • Last active Mar 2019
  • 7 conversations
  • 19 comments

Most recent activity

  • in ESP32
    Avatar for fanThomas

    I am running under 2v00

    • 6 comments
    • 532 views
  • in ESP32
    Avatar for fanThomas

    I tried this on a ESP8266 where it is working with a ip address. In the docs it states the parameter should be 'hostname', but when I try with a hostname I get an error:

    w.ping('google.com', (details) => { console.log(details) });
    Uncaught Error: Not a valid IP address.
    

    When I try this on a ESP32 I get:

    w=require('Wifi')
    =function () { [native code] }
    >w.ping('212.51.158.12', (details) => { console.log(details) });
    Uncaught Error: Function "ping" not found!
    

    Both ESP's are running espruino 2v00

    The ping method may work for me when it would be available on both platforms however it's somewhat tricky, because you can not decide how many pings are issued.

    Where could I find the source code of the 'net' Library?

  • in ESP32
    Avatar for fanThomas

    I am trying to make my things resistive to all sort of annoyances that can occour. Currently I am working on network disruptions, when the wireless router is still responsive but cannot connect to the internet. While I use websocket connections I saw that the websocket module wants to create a socket connection using net.connect(), but unfortunately I could not find any possibility to detect this condition in the documentation. I get just a message at the console:

    ERROR: Connect failed (err 113)
    Uncaught InternalError: Unable to create socket
    

    I don't know whether this is specific on the ESP32.

  • in ESP32
    Avatar for fanThomas

    That solved the problem. Thanks alot!

  • in ESP32
    Avatar for fanThomas

    I tried to use a watch on a esp32 where I got the following error:

    setWatch(function(st) { console.log(st.time) }, D4, {repeat: false, edge: 'falling', debounce: 10});
    WARNING: Unable to set watch. You may already have a watch on a pin with the same number (eg. A0 and B0),
    or this pin cannot be used with watch
    

    I also tried other pins which should work without luck. I am using esruino 2v00 on a esp32s chip. On espruino 2v01 i get the same message.

  • in General
    Avatar for fanThomas

    I want to call a method of the calling class within a module. This worked fine in Version 2v00 of espruino. After updating to 2v01 I get an error with the same code.

    This is the calling program:

    class a {
      constructor() {
        this.mB = null;
      }
      
      init() {
        this.mB = new (require('http://192.168.88.117:8081/b.j­s'))(this);
        this.mB.perform();
      }
    
      say(text) {
        console.log(text);
      }
    }
    
    var x = new a();
    x.init();
    

    And this is the module:

    class b {
      constructor(a) {
        this.a = a;
      }
      
      perform() {
        console.log('class b called');
        this.a.say("I'm in b");
      }
    }
    exports = b;
    

    The output shows as follows:

    Error: Line 8: Unexpected reserved word in http://192.168.88.117:8081/b.js
    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v00 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0xef chip 0x4016
    >class b called
    I'm in b
    Disconnected
    >
    Found ESP8266_4MB, 2v01
    >
    Connected to COM4
    Error: Line 8: Unexpected reserved word in http://192.168.88.117:8081/b.js
    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v01 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0xef chip 0x4016
    >class b called
    Uncaught Error: Cannot read property 'say' of undefined
     at line 2 col 11
        this.a.say("I'm in b");
              ^
    in function "perform" called from line 10 col 21
        this.mB.perform();
                        ^
    in function "init" called from line 19 col 8
    x.init();
           ^
    > 
    

    It seems that the parameter for the constructor is not passed anymore in 2v01

Actions