You are reading a single comment by @rj and its replies. Click here to read the full conversation.
  • 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

About

Avatar for rj @rj started