• Saving - One can not learn of this precious factoid link as there is no entry point to that page

    It's there - a (more information) link after You can save the state of Espruino so this doesn't happen using the save() command on http://www.espruino.com/Quick+Start+CodeĀ­ (which is where you'd go after you followed the USB/BLE Quick Start to get connected). It's also linked from the FAQ and Troubleshooting.

    I'll add a keyword for 'upload/uploading'. I'm open to suggestions for extra places to link it, although there's a huge amount of information on the Espruino site, and it's a constant struggle to provide users with enough information to get started without overloading them to the point where 90% of them don't read anything.

    @allObjects I know what you mean about Saving perhaps not properly explaining everything - again, I'm open to contributions.

    When I flash a Pico on a Win10 PC via the native IDE Settings >> Flasher >> Flash Firmware... dump() ... Javascript statements appear

    Could you post up the code that appears?

    Your question about flashing to format all saved code is a little more involved than 'yes' on some devices, but on the Pico&WiFi it's not. If you reflash the Pico using the IDE and it completes successfully, it will erase all code. I can guarantee that.

    So if it isn't erased then either the flashing hasn't worked, or code got uploaded since you did the flashing.

    On Espruino 1v99 and later, just type reset(true) and it'll remove all saved code though - it's quicker and easier :)

    level 0

    As @Wilberforce says - global scope is probably a more general term here.

    I think JavaScript in a webpage is a good example here - If you write:

    Some text
    <script>
    for (var i=0;i<100000000000000;i++);
    </script>
    Some more text
    

    On a webpage, that's going to make the webpage take a very long time to load enough to show Some more text, and probably the browser will report an error after a while. That's running in what we're calling level 0 or the global scope here.

    If you upload:

    <script>
    function iWillTakeALongTime() {
      for (var i=0;i<100000000000000;i++);
    }
    </script>
    

    Then that's merely defining a function containing the code. The for loop isn't in the global scope, but function iWillTakeALongTime() { ... } is. The statement function iWillTakeALongTime() { ... } is still being executed, but the result of executing that statement is that a function called iWillTakeALongTime is loaded into memory, not that the for loop gets executed.

  • Mon 2018.08.20

    @Gordon, there is still a bit of apparent confusion here. Although I have a better grasp on these issues, I feel that anyone new to this environment would have a heck of a time understanding what is going on. As did @allObjects also pointed out in #8. I only mention the following as it is likely that they might go down the same path.

    re: 'it's a constant struggle to provide users with enough information to get started without overloading them'

    Yes, agree totally. It is a very complex topic to handle all situations for each possible type of users development environment. No complaints
    from me. The documentation is rather complete and easy to understand.

    re: 'You can save the state of Espruino so this doesn't happen using the save() command'

    From #6 I originally asked:

    'In general why would code execute during a upload/copy process?'

    The response was the http://www.espruino.com/Saving link. On that page,

    'it's easy to save your code to flash memory and make it permanent'

    So, as I read that, those concepts are on how to 'save' and use of the 'save'()' command. But the thought process is on the 'uploading' task.
    And, I'm stuck in that task at the moment. This is not the act of saving which is a task that is done to preserve commands once working. I was in the process of attempting to get code sent to the Pico to get it running, not commands to save code that hadn't yet been written. Big difference.

    Incidentally adding will help

    'I'll add a keyword for 'upload/uploading'

    When the response from #6 was received, it didn't make sense to read on with the second sentence indicating to save code.

    'it's easy to save your code to flash memory and make it permanent'

    Even after reading the 'Saving' page, still haven't found what I need to know about the original question posed:

    'In general why would code execute during a upload/copy process?'

    This is why @allObjects also agreed and posted his observations in #8

    'Why' has been explained in #6 and #8 no need to re-hash.

About

Avatar for Robin @Robin started