mDNS is working with Bonjour

Posted on
Page
of 3
Prev
/ 3
Next
  • Hey 🙂!

    I'm trying to "patch" the wifi-module with indianajones's example in my root file after importing the wifi-module, but I'm getting this error:
    Uncaught Error: Cannot read property 'cmd' of undefined. I understand the problem with the this reference and it makes perfect sense, but can someone give me a pointer on how to fix it?

    As I understand it, I can't get my hands on the module source code because it's a "built-in" module (?), thats why I'm trying to extend it externally.

  • Sat 2020.09.19

    Hi @user114366, I may not be of any direct assistance here, but just answered how to locate source in a different topic post:

    From:

    http://www.espruino.com/Reference#Wifi
    selected connect() function
    http://www.espruino.com/Reference#t_l_Wi­fi_connect

    Locate the Right Facing arrow adjacent to the heading, which takes one to:

    https://github.com/espruino/Espruino/blo­b/master/libs/network/jswrap_wifi.c#L207­

    Hope that might give some temporary insight, oh and did you catch in this thread #19 post that has a possible solution?

    http://forum.espruino.com/comments/14953­541/

  • Hi Robin 🙂.

    Thanks for your suggestion! Sorry, I don't see what information I'm supposed to be getting from https://github.com/espruino/Espruino/blo­b/master/libs/network/jswrap_wifi.c#L207­ 😥. How does this provide me with the source code of the wifi-module 🙂?

    About post #19: yes, indianaJones ends up suggesting some code based on #19, in post #23, and this is the code I'm trying to use.
    http://forum.espruino.com/comments/14957­853/

  • You might need to show us the rest of your code. this is a tricky problem in javascript so it's best to get the complete picture.

    If I'm to hazard a guess, this.at.cmd means this.at contains the object that is the wifi library, which you then call the cmd function of. So that means you'll need to replace this.at with Wifi.at

  • Sure, here it is 😊:

    // ****************************************­********************
    // *** IMPORTS
    // ****************************************­********************
    const wifi = require("Wifi");
    
    wifi.enableMDNS = function (hostname, serviceType, port, callback) {
        let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n";
        this.at.cmd(mdns, 500, function (d) {
            callback(d);
        });
    };
    
    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    
    /*
     * Called on boot
     */
    function onInit() {
    
        wifi.startAP("EspruinoAP", { password: "0123456789", authMode: "wpa2" }, function (err) {
            if (err) throw err;
    
            console.log("AP created!");
            wifi.enableMDNS("abcd", "iot", 80, function (result) {
                console.log("enableMDNS result: " + result);
            });
    
        });
    
    }
    
    

    That was my guess as well, but replacing this with wifi gives me exactly the same error 🤔.

    ```
    2v06 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate

    WARNING: Scan stop failed
    WARNING: set rssi scan not implemeted yet
    Running onInit()...
    AP created!
    Uncaught Error: Cannot read property 'cmd' of undefined
    at line 2 col 12

    wifi.at.cmd(mdns, 500, function (d) {
           ^
    

    in function "enableMDNS" called from line 6 col 10

        });
         ^
    

    in function called from system```

  • In the original post:

    console.log("Start connection process");
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al, function(err) {
      if (err)return 1;// throw err;
      Wifi=wifi;
    

    Wifi is set to the result of the connect() function. In your case, wifi is set to the actual library.

  • Sat 2020.09.19

    'I can't get my hands on the module source code'

    Clarification re: 'How does this provide me with the source code of the wifi-module?'

    An external Javascript module may be accessed, such as for GPS

    http://www.espruino.com/modules/GPS.js
    full list:
    http://www.espruino.com/modules/

    Whereas an internal module is made up of 'C' source that is built into the compiled firmware, as in the WiFi example

    Walk up the folder tree
    these may help

    https://github.com/espruino/Espruino/iss­ues/1358
    wifi.startAP()
    https://github.com/espruino/Espruino/blo­b/9ffc5162047e93200e1356c3334b05f5ab67db­53/libs/network/esp32/jswrap_esp32_netwo­rk.c#L817



    See @parasquid #31 example explanation

    Use of wifi and dump() at the WebIDE command line in the L-Hand panel may provide additional debug feedback

  • Ah, I see 🙂. I used the access point feature only, so never really had to call connect, I updated the example, still getting the same error I'm afraid 🤔.

    // ****************************************­********************
    // *** IMPORTS / CONSTANTS
    // ****************************************­********************
    const ssid = "<ACCESS_POINT_SSID>";
    const password = "<PASSWORD>";
    
    const wifi = require("Wifi");
    let Wifi;
    
    wifi.enableMDNS = function (hostname, serviceType, port, callback) {   // <-- Also tried fat-arrow syntax
        let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n";
        Wifi.at.cmd(mdns, 500, function (d) {
            callback(d);
        });
    };
    
    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    
    /*
     * Called on boot
     */
    function onInit() {
    
        const w = wifi.connect(ssid, { password: password }, function () {
            console.log("Connected");
            Wifi = w;
            
            wifi.enableMDNS("abcd", "iot", 80, function (result) {
                console.log("enableMDNS result: " + result);
            });
        });
    
    }
    
  • Oh, that makes perfect sense, thanks 🙂! Unfortunately it means that I can't easily take the wifi-module source code and add the extra functionaly in there directly--so I have to stick with the current approach.

    Great suggestion with using dump 👍. It does seem a little strange. It's as if some stuff (eg. the onInit) is defined twice. I guess the pinMode is stuff generated by default. This is what I get:

    var ssid = "EDITED OUT";
    var password = "EDITED OUT";
    var Wifi = undefined;
    function onInit() {
      const w = wifi.connect(ssid, { password: password }, () => {
            console.log("Connected");
            Wifi = w;
     
            wifi.enableMDNS("abcd", "iot", 80, function (result) {
                console.log("enableMDNS result: " + result);
            });
        });
    }
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    // ****************************************­********************
    // *** IMPORTS
    // ****************************************­********************
    const ssid = "EDITED OUT";
    const password = "EDITED OUT";
    // ****************************************­********************
    // *** IMPORTS / CONSTANTS
    // ****************************************­********************
    //const ssid = "<ACCESS_POINT_SSID>";
    // const password = "<PASSWORD>";
    const wifi = require("Wifi");
    let Wifi = null;
    wifi.enableMDNS = (hostname, serviceType, port, callback) => {
        let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n";
        Wifi.at.cmd(mdns, 500, function (d) {
            callback(d);
        });
    };
    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    /*
     * Called on boot
     */
    function onInit() {
        const w = wifi.connect(ssid, { password: password }, () => {
            console.log("Connected");
            Wifi = w;
     
            wifi.enableMDNS("abcd", "iot", 80, function (result) {
                console.log("enableMDNS result: " + result);
            });
        });
    }
    
  • Sat 2020.09.19

    Hey @user114366 I agree with you that duplicate functions would not be normal. Has the clear screen button in the WebIDE upper left been depressed, before performing the dump?

    Are you able to duplicate this anomaly? I only ask as several months ago, I uncovered nearly the same observation using this very exact module, but was chastised as my observation couldn't be duplicated. I now find it interesting that someone else, using a similar environment has Now come across what I pointed out then. In my case I could duplicate the non-overwriting of an existing object in memory, and it appears that is what you have discovered also. Mine was on a Windows10 laptop. Yours? Had you been uploading code files from the R-Hand editor side along with cut-n-paste snippets into the L-Hand console side?

    Along with dump() has trace() been tried to see if there is a duplicate?

    I also realize that more testing may take you down a time consuming rabbit hole, but should your instance also point to the same similar anomaly, it will help to pin point what is going on.

  • Can you get just the AT commands working at least? Better start from a simpler one without the fancy mdns. The goal is to get the at command object working for you: https://www.espruino.com/modules/ESP8266­WiFi_0v25.js

    This is (again) from the original post

    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al, function(err) {
    

    But you're requiring Wifi so I'm not sure if you should be expecting AT commands there as that's a completely different module. http://www.espruino.com/Reference#Wifi

  • Sat 2020.09.19

    Good point @parasquid as I've made the assumption we are dealing with a supported board
    post #34 const wifi = require("Wifi"); and as I've pointed out in the bulleted list:

    Writing an effective forum post

    Please post the results of process.env so that we are all working/thinking with the same environment.

  • Oof, I've been blindly trying out code snippets and fixating on this being a variable scoping-issue, without thinking 🤦♂️.

    I'm using an Ai-Thinker ESP32-S board, and without knowing the inner workings it makes perfect sense that the internal setup would not be done using AT-commands--as opposed to how a WiFi-board + μC setup would have to.

    Thanks for helping out this far 🙂!

  • Yeah, it looked exactly like a variable scoping issue, so I just jumped to a conclusion--sorry.

    Thanks for helping out 🙂.

  • Interesting!

    Yes, what I posted was all the output after the "dump()" command was executed 🙂. Right-hand editor only (except from when using dump()/reset()/trace()). The output of trace does not make sense to me 😏.

    Me:
    Windows 10 desktop
    Espruino IDE 0.73.7
    Upload destination: Flash
    Hardware: Ai-Thinker ESP32-S
    process.env: {
    VERSION: "2v06",
    GIT_COMMIT: "21168a2b",
    BOARD: "ESP32",
    FLASH: 0, STORAGE: 262144, RAM: 524288,
    SERIAL: "8caab5a2-89e8",
    CONSOLE: "Serial1",
    MODULES: "Flash,Storage,hea" ... "r,crypto,neopixel",
    EXPTR: 1073484860 }

    Did you post about the issue back then? Maybe we can continue there then.

    I tried some simpler code (function onInit() { let a = 0; }), but I'm not sure how dump is supposed to work, but if I go to "Device Storage" and inspect the content of "RAM" it seems to hold exactly the same content as dump() outputs (dual onInit() function + pinMode's). If I inspect the .bootcde-file, I see the actual code that I uploaded (single function only, and no pinMode's).

    Just to expand on what I said by RAM before; if I click flash with a = 0, and inspect the RAM, I see two onInit functions there with a = 0. If I set a = 1 and inspect the RAM, I then see two functions with a = 1 (this proving that the data is updated--I temporarily had the idea that the first onInit held some data from an old upload).

    Something else, which might be interesting. If I have let b; outside of a function, the first occurence becomes var b = undefined; (the next still being let b;), but anything inside functions does not seem to be touched. So I guess the first "copy" (before all the pinMode's) is pre-parsed code, but I wonder why the original is still present though.

  • I'm using an Ai-Thinker ESP32-S board

  • Thanks for chiming in 🙂. This all started with me playing around with setHostname but didn't get the results I was hoping for.

    On http://www.espruino.com/ESP32, theres a note saying "Not currently implemented.", but on https://www.espruino.com/Reference#t_l_W­ifi_setHostname it says "Note: This is only available in ESP8266 boards running Espruino and Espruino WiFi boards and ESP32 boards". Do you know which one is correct? It would explaing some of my earlier issues if it was not supported 🙂.

  • Awesome--thanks for confirming that 👌.

  • Sun 2020.09.20

    edit insert
    From #34 post, is that code block exactly what is being uploaded, or is that the result of the dump() ? (I ask as the comments between the functions seem to be added for forum post editing) I see a potential gotcha. If #33 post is the entire code block which is uploaded, then disregard.



    orig

    Thank you for post #40 @user114366 and those instructions are possibly starting to show some duplication between our environments.


    Commonalities

    • Windows10
    • WebIDE online Web App, v0.73.7
    • WiFi module
    • Single character vars - (this is where understanding debug/trace revealed to me the culprit)
    • Overwriting existing vars/functions [ actually not occurring - duplicates ]
    • Uploading from R-Hand side then continuing with edit inserts from L-Hand side



    Differences

    • Different boards - mine both Espruino WiFi and MDBT42Q
    • Different versions - mine 2V04 - yours 2V06
    • My code file used a massive amount of memory [ but isn't the cause ]
    • I didn't use arrow functions

    Yours from #40 post above

    VERSION: "2v06",
    GIT_COMMIT: "21168a2b",
    BOARD: "ESP32",
    

    Mine from 'Sanity check' link below

      VERSION: "2v04",
      GIT_COMMIT: "3956264e",
      BOARD: "ESPRUINOWIFI",
    



    'Did you post about the issue back then?'

    Yes - and I'm starting to realize that troubleshooting this will take a great deal of time, which I am prepared to do, but just am unable to do so today, at least for the next ten hours.

    From the multi link list below, you'll see I was battling/wrestling with a lot. Are you willing/prepared to invest the time also? It is extremely time consuming, but discovering this anomaly did teach me a bunch about what is going on under the hood. Also learned a ton of forum formatting tricks, So for me, very beneficial.



    This issue was discovered while attempting several 'How do I solve' type issues, and all simultaneous. If this tid-bit hadn't been discovered, one can reveal what a user is working on by R-Clicking on their forum name in upper right corner, and traversing the 'Coversations' list. But here are the four that come to mind. Initial attempt with PPI uncovered anomalies.

    Tutorial example output anomaly using low level access PPI
    Sanity check for Wifi and http
    Help needed on trace() to locate
    Multiple occurances during a trace()

    As the Bangle KickStarter was going on during the same time, it made sense to back burner the lot, and the post in the last link was where everything came to a grinding halt. But now maybe time to re-visit.

    It might make sense to create a unique new thread with combined ideas, rather than pollute this and old threads. Might confuse others trying to solve similar issues, and we would be ping-pong'ing between multiple threads with links/references. Lets not start anything just yet until we have an agreed on moderator and direction.



    I may have time during the day to check in, but for now this is about as much dedicated time I am able to commit right now.

  • Yes-ish, I uploaded #33, got #34, I only edited out password and SSID. The comments where there in the uploaded code, and in the dump. (edit: if your'e refering to the comment saying "// Code saved with E.setBootCode", I think it's generated--I did'nt put it there or anywhere else 🙂)

    I could do it once more without my password in there in the first place, so I don't need to edit at all 😉. But what do you say we change our base test code from the rather verbose above to what I mentioned in #40? I think I can reproduce exactly the same behavior with:

    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    let b;
    function onInit() { let a = 0; }
    

    (The large comment block is not necessary, but included since it seemed of interest to you in your previous question--and I'm curious about the variables defined outside of onInit, hence the let b)

    To make sure I have the cleanest possible starting point, I followed the steps below:

    1. Going to "DEVICE STORAGE" (from the menu items in the center toolbar of the IDE) and deleted .bootcde file
    2. Running reset(true) (writing directly in L-hand side)

    RAM now contains:

    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    

    Dump()'ing (L-hand side) provides:

    ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v06 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >
    >
    >dump()
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    =undefined
    > 
    
    1. Copy / pasted the following into the R-hand side:

      // ****************************************­********************
      // *** MAIN
      // ****************************************­********************
      let b;
      function onInit() { let a = 0; }
      
    2. Uploaded code to Flash using the button in the center toolbar. I waited for the upload to finish, and my console now looks like this:

      ____                 _
      |  __|___ ___ ___ _ _|_|___ ___
      |  __|_ -| . |  _| | | |   | . |
      |____|___|  _|_| |___|_|_|_|___|
           |_| espruino.com
      2v06 (c) 2019 G.Williams
      Espruino is Open Source. Our work is supported
      only by sales of official boards and donations:
      http://espruino.com/Donate
      >
      WARNING: Scan stop failed
      WARNING: set rssi scan not implemeted yet
      Running onInit()...
      

    Dump'ing (from L-hand side):

    >dump()
    var b = undefined;
    function onInit() {let a = 0;}
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    let b;
    function onInit() { let a = 0; }=undefined
    > 
    

    RAM:

    var b = undefined;
    function onInit() {let a = 0;}
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    let b;
    function onInit() { let a = 0; }
    

    .bootcde-file (accessed from the center toolbar under "DEVICE STORAGE"):

    // ****************************************­********************
    // *** MAIN
    // ****************************************­********************
    let b;
    function onInit() { let a = 0; }
    

    And I agree, this discussion is probably becoming better suited for somewhere else 😊.

  • Sun 2020.09.20

    Thank you @user114366 for taking the time to think that through, setup, test, and post the results. I know that is time consuming and I'm sure we all can learn and appreciate what you have discovered.

    Although I don't have time to setup and determine if I can duplicate, I now do notice that the variable is declared with both a 'let' and a 'var'

    This may indeed be the key. Are you defining this differently, or as I read your proceedure verbatim, it appears to be duplicated after the edit, that way perhaps?

    Just guessing as a way to prove/disprove the scoping issue you mentioned previously, or is the 'let' getting overwritten with 'var'?

    MDN 'let'

    https://developer.mozilla.org/en-US/docs­/Web/JavaScript/Reference/Statements/let­

  • No problem, I'm interested in figuring out if this is in fact an issue (or if I just don't understand what dump() is supposed to do) and getting it solved, as much as anybody 😊.

    Although I don't have time to setup and determine if I can duplicate, I now do notice that the
    variable is declared with both a 'let' and a 'var'

    This may indeed be the key. Are you defining this differently, or as I read your proceedure
    verbatim, it appears to be duplicated after the edit, that way perhaps?

    Yes, it seems to be duplicated. I haven't used var--thats why I guessed on the first code block (above the "pinMode"s) being a copy of my code after some kind of parsing 🙂.

    About the original issue: the real issue was me expecting the wifi-module to use at-commands for configuration (like the ESP8266WiFi_0v25 module). It was a mental lapse on my part.

  • After reading MDN, I don't believe two instances should exist as they are in the same block (Global) scope.

    ref #47: https://developer.mozilla.org/en-US/docs­/Web/JavaScript/Reference/Statements/let­

    and thanks for clarifying it wasn't a task performed by your actions.

    This issue probably crept in when ECMA6 statements started to get added in, circa 2019.

    http://www.espruino.com/Features

    https://stackoverflow.com/questions/3791­6940/why-was-the-name-let-chosen-for-blo­ck-scoped-variable-declarations-in-javas­cri



    Should you have some time/desire it would be interesting to do some tests (which you did at least one) setting 'b' to some value, perform the dump() along with just typing b at the command line and see if susequent updates can/can-not corrupt it's value. I'm pretty sure it will, as there can be only one instance by definition. This was one of several observations I made and documented (see #45 post for links) six months ago. Interesting that no one else observed this anomaly until now.


    EDIT:
    I re-read and just identified that the suggestion I just made was in fact observed by you @user114366 back in last pp. #40 post. I missed that, or subconsciously recreated it!

  • (**edit: ** oh, I think I misunderstood your last suggestion about setting b, never mind 😊)

    Sure, I'll try that 🙂.

    I've updated the test code to:

    let b;
    function onInit() {
        setTimeout(() => {
            b = 1;
        }, 5000);
    }
    

    The dump now first produces:

    >dump()
    var b = undefined;
    function onInit() {
      setTimeout(() => {
            b = 1;
        }, 5000);
    }
    setTimeout(function (undefined) {b = 1;}, 1840.55); // 1
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    let b;
    function onInit() {
        setTimeout(() => {
            b = 1;
        }, 5000);
    }=undefined
    

    And after > 5 s

    >dump()
    var b = 1;
    function onInit() {
      setTimeout(() => {
            b = 1;
        }, 5000);
    }
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    let b;
    function onInit() {
        setTimeout(() => {
            b = 1;
        }, 5000);
    }=undefined
    

    I think I'm at a point where I really need to now what dump() is supposed to do exactly 🤔. Because if its description is something like "Will return your code transformed to es2015, your default pin configuration, and a copy of your original code", the output makes sense.
    I've read https://www.espruino.com/Reference#l__gl­obal_dump of course, but I don't know what is meant by "current interpreter state", or more specifically what the interpreter is supposed to hold exactly 🙂.

    I think I need @Gordon, just to see if we're on to something, or if the dump() output is as expected.

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

mDNS is working with Bonjour

Posted by Avatar for ClearMemory041063 @ClearMemory041063

Actions