Avatar for Robin

Robin

Member since Jan 2017 • Last active May 2021

Most recent activity

  • in ESP32
    Avatar for Robin

    Mon 2021.05.10

    from post #12
    'Spent good deal of time'
    'but still not 100% confident I'm doing it right'
    'had hot mess of setInterval handlers'

    Here on day three now, it is discovered that it was coding to start with, and not the false assumption:

    from post #1 'How stable/dependable is espruino? Can I rely on it'



    Heck, when I first posted here, I couldn't even spell 'Espruino' let alone write a code block. That was five years ago. Myself and even the others that posted here to assist your endevour, also suggested posting that code to speed things up. @MaBe helped me four years ago, staying with me to the wee hours solving a WiFi mystery in 'sta' mode, and @AkosLukacs having a different take on a rounding issue assisted in finding the suitable solution to that issue. Even @Gordon has spent countless hours assisting us all, creating well laid out tutorial examples, along with excellent resolution explanations. But to get to that point, was the need to upload my code.

    But for some reason, several still find getting going, or navigating the site somewhat of a struggle. This is where I'm asking if you could help us with a few words.

    'Thanks, once again!'

    I'm glad that detail assisted to resolve your issue, as the forum here does generously assist grattis those within the Espruino community.

    And for that @gdanov , I am personally asking for some 'quid pro quo' content to assist us in providing better documentation. As a fair offset, would you please explain the reluctance to have just uploaded some code from the beginning?

    Maybe it's as simple as you are working on the next Elon Musk SpaceX project and want to keep it under wraps, or maybe you are creating a full tutorial to demo your results here to the Espruino community. Although I shouldn't speak for the others, I'm sure from their contribution efforts here, that as do I, would like to learn this simple response.

    Thank you gdanov for an explanation,

    Robin

  • in ESP32
    Avatar for Robin

    'setInterval is called once from the main context'

    What method is being used to end or remove each defined interval?

    From that statement, I'd only expect one timer to show active, but two(five) are shown in the response in post #9


    'this is memory (again under normal conditions)'

    There appears to be plenty available. re: free



    Again, as the others and I have requested, best to post some code, so as not to guess here!

  • in ESP32
    Avatar for Robin

    re: 'Where should I look for more debugging hints?'
    re: 'I knew none of this. '

    Hi @gdanov As an enduser like yourself, I've watched the Espruino site grow over the last five years. I started with absolutely no experience with microcontrollers, and gained my knowledge by just helping others through the forum, demonstrating how to 'turn over the rocks' to learn the idiosyncrasies. Surprisingly, all the info is there and well laid out. With the wealth of tutorials and user examples, the site is expansive and complete.

    The easiest and most obvious is to start with any Espruino page and from the menu find the 'Quick Start' info pages.

    Espruino.com >> Menu >> Documentation >> Quick Start
    

    or

    Espruino.com >> Menu >> Support >> Getting Started
    

    Traversing the forum section is another place to pick up all these hints. A few years back, I created a summary page with the best links in it, and can be found at the top of the 'Tutorials' forum section.

    Tutorials:   http://forum.espruino.com/microcosms/130­/

    Open the cream colored pinned top-most 'Writing an effective forum post' and find the heading: 'in addition have these excellent pages been reviewed' found a third the way down the page.

    As a suggestion, keep asking questions, then search out the solution. As I mentioned, most can be found with a small amount of digging.

    Keep turning those rocks over . . . .

  • in ESP32
    Avatar for Robin

    Sat 2021.05.08

    re 'again via setInterval I push the collected strings'
    re 'Also, the device works for few hours and then stops sending data'

    New interpreter error: CALLBACK,MEMORY
    



    Hi @gdanov , what techniques are being used to check memory? There really isn't enough here to make a definitve response. The above however, leads me to believe that memory is being gobbled up. It is quite possible that a setInterval is buried inside a repetative loop, or something of the sort, from which then, Espruino is being blocked from perfofming the necessary garbage collection.

    Has process.memory() been viewed to determine usage as time moves along? Please post before, during and after.


    'but it looks like both setInterval handlers are cancelled?'

    Is the trailing question mark indicating a guess here, was a check actually done?

    If it hasn't been discovered yet, these commands entered into L-Hand WebIDE console will reveal the state of memory.

    console.log(global["\xFF"].timers); //nice, less info
    
    trace(global["\xFF"].timers); //full info
    

    As @MaBe pointed out in post #2 it'll be much easier to assist with the actual code. Please post.

  • in Projects
    Avatar for Robin

    Wed 2021.05.05

    Well, you have out done yourself this time @benjaminbenben  !!

    The video clip demos the extensive pass-through web page commands to actual device task requested.

    My vote for the project of the year here. Nicely done, indeed!

  • in Pico / Wifi / Original Espruino
    Avatar for Robin

    Sun 2021.05.02

    'I'm surprised I didn't get some sort of confirmation when the PICO was upgraded correctly from the Web interface?'

    On Dis-Connect, Re-Connect, did the 'Epsruino' banner and version display?

    Results of process.env ?


    It is also possible to view the log messages from within the WebIDE.

    From the upper right hand corner

    WebIDE >> Settings >> Console

  • in JavaScript
    Avatar for Robin

    Sun 2021.05.02

    Hi @MaBe several years ago, I had similar questions and several chimed in to solve with snippets and links regarding 'Flat Strings'. Here was Gordon's well described response:

    ref post #2 http://forum.espruino.com/comments/14455­141/
    entire thread Definition of a flat string and example

    Some sample snippets:

    Flat String creation failing


    'Q: How to pass a buffer and use the Graphics inside a module?'

    Is the question on how to process the image creation within the developer designed module, and access that ('pass a buffer') content inside the module, back at the console side of the WebIDE?

    Use the array buffer to access the flat string, similar when using a pointer in 'C' perhaps?
    (See last pp in Gordon's response in the first link - ref post #2)

    Nicely done, if I might add! . . .

  • in JavaScript
    Avatar for Robin

    Thr 2021.04.29

    'While developing, my website will reload upon code changes'
    'Is there a solution that avoids "re-pairing" my Puck.js on every page load'

    Although I haven't tried this, what about using the Html < iframe >element?
    Embed the page that will reload as the iFrame itself, retaining the PuckJs code called from the outer container. In that way, when the inner iframe page is reloaded, the outer calling page doesn't perform the Puck re-initialization.

    https://www.w3schools.com/tags/tag_ifram­e.asp

    passing data back-n-forth

    https://stackoverflow.com/questions/6271­313/pass-a-javascript-variable-from-an-i­frame-to-the-parent-frame



    or possibly using the onload() event, set a variable within the page Global scope that bypasses the Html section that loads the PuckJs code.

    https://www.w3schools.com/jsref/event_on­load.asp
    https://stackoverflow.com/questions/5880­40/window-onload-vs-document-onload
    https://www.plus2net.com/javascript_tuto­rial/window-onload.php
    https://www.codegrepper.com/code-example­s/javascript/windows+onload+javascript+w­3schools

  • in General
    Avatar for Robin

    Mon 2021.04.26

    ref #32: 'so i can write my code beautifulized . . . no needed to minimize manually . . . is it correct?'

    I had this same question over four years ago and several provided responses to clear things up.

    Originally, I had mistaken an observation (noobie incorrect interpretation) for changes that had just occured with the new WebIDE ver ?? around Nov 2016 circa 1V88 Espruino, and was attempting to resolve.

    Just released (then) the WebIDE does a bit of housekeeping before upload along with additional cleanup once Espruino takes over. See @Gordon 's comments:

    'and also strips out whitespace and comments between commands, which would have been ignored by Espruino anyway.'

    http://forum.espruino.com/conversations/­295641/

    'if something happens and data is re-arranged in memory then even that can effect the compression'

    http://forum.espruino.com/comments/13488­204/

    A quick test would be to upload some heavily commented code both inside and outside functions, then upload. Use dump() to see how comments are removed. Then use process.memory() to determine the amount of free JsVars to compare with the source.

    Another useful tool: Many helpful ideas on using trace() to view actual memory contents.

    http://forum.espruino.com/comments/15227­580/

  • in General
    Avatar for Robin

    Sun 2021.04.25

    'what is the maximum length of storable/runnable javascript code in Espruino wifi?'

    Use process.memory() to determine the amount of free JsVars

    http://www.espruino.com/Reference#l_proc­ess_memory
    JsVars:    https://www.espruino.com/Internals

    Although it may be possible to use some fancy techinques to utilize flash in addition to available ROM, typically, Espruino needs as much memory as the code file size being uploaded, in order to unpack and reorganize in memory.

    Really rough approximation; take the number of free JsVars and divide by two to account for the need to reorganize during the upload process, then multiply by 16 bytes per JsVar.

    I don't have a WiFi handy, but if memory serves, an authentic Espruino Wifi provides around 2200 JsVars.

    2200 / 2 * 16 = 17,600 chars rough approximation

Actions