weird strings produced #7436
Replies: 1 comment
-
Posted at 2021-05-08 by @MaBecker
Espruino is super stable on original Espruino devices! ESP32 implementation is incomplete and not as reliable, so there is still room for improfement. If you like to share your code with the forum, members might give you some advise / hints. Do you have an idea why your device stops sending, like running out of vars, sockets or 3v3 power issues etc..... Posted at 2021-05-08 by gdanov so, I left it connected via tcp and this is what seems relevant:
I get some exceptions in the http put ("Uncaught InternalError: Unable to create socket" included) but it looks like both setInterval handlers are cancelled? the one reading temperature did not throw visible exceptions. Posted at 2021-05-08 by @MaBecker
might be your coding or a bug in ESP32 implementation. Posted at 2021-05-08 by gdanov every request is sent to fixed url. only the payload string varies. not sure where the bug could be Posted at 2021-05-08 by Robin Sat 2021.05.08
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 > '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.
As @MaBecker pointed out in post #2 it'll be much easier to assist with the actual code. Please post. Posted at 2021-05-08 by AkosLukacs Hi, you wrote you sample sensors every 300ms, unless the sensor is in some liquid or glued/bolted to something you measure, you create significant self heating (assuming it's a DS18B20 or similar). And IIRC unless you reduce the default resolution, sampling multiple sensors won't finish in 300ms. And since you got The probably too fast sampling rate can lead to a memory leak, because you try to start a new measurement cycle while the first is still in progress. If that's the case, simply measuring slower could solve your problem (and reduce errors due to sensor self heating). You can add some debug Posted at 2021-05-08 by gdanov Thanks a lot for the feedback. Posted at 2021-05-08 by gdanov Thanks for the debugging hints. I knew none of this. Where should I look for more debugging hints? setInterval is called once from the main context. These are my timers in normal situation:
this is memory (again under normal conditions)
I'll definitelly incorporate your and @AkosLukacs hints into the error handling and debugging when it crashes again. Posted at 2021-05-08 by Robin re: 'Where should I look for more debugging hints?' 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.
or
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.
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 . . . . Posted at 2021-05-08 by Robin
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! Posted at 2021-05-10 by gdanov Thanks, once again! I had two major problems:
It's big progress because now the probe works for hours without any issues. Posted at 2021-05-11 by Robin Mon 2021.05.10
Here on day three now, it is discovered that it was coding to start with, and not the false assumption:
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. @MaBecker 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 @gfwilliams 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.
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 Posted at 2021-05-11 by gdanov Hi, Uploading my messy experimental code without explaining my workflow would've wasted other ppl's time. You and the community missed nothing, I guarantee you that. I'm sorry but I don't really understand what's your request to me. As for my question re stability — It's fair question, in some respects the esp32 port is not complete so I had to know what to expect. I am also very suspicious of the heltec board. As a good citizen I always like to help when I can. This is why after asking a question I do my best to follow up, as you can see above. So, one more follow-up: the biggest challenge and source of grief for me was the combination of how save() works and how the web ide works. Let me elaborate:
Posted at 2021-05-16 by Robin Sun 2021.05.16 I waited a few days to see what the others might comment, especially regarding the ESP32 port, but it appears their interest was more to get you up and running as their requests were waiting for uploaded code in order to respond, and mine was more to understand in order to improve on the documentation process in addition.
Had you seen this invaluable companion link: Quick Start - Proper way to call init() on start up Posted at 2021-05-17 by @allObjects I'm not surprised about your experience with Espruino and even more with Espruino on board not supported by @gfwilliams. Espruino is different from most of the IoT environment, as JS interpreter different from common implementations, as a system it is different, and also from memory management. Esprino as an integrated system of software AND hardware, it comes from its structure closest to a Commodore PET... There is no separation or layering like found in the simplest PCs where there is a BIOS, usually in an (EP)ROM, OS, usually loaded, some monitor and command / system application to system-talk to the OS, and make it load and run applications - applications that are written in a what-ever language and then transformed - compiled - for the particular OS / platform, NOR is is like all the other IoT that have usually only a boot loader - if at all - that allows to upload and store ready-made, all libs included, application into some EPROM, and then fire the load and run of the application. With Espruino, it is like it was with the Commodore PET, which is characterized as a BASIC stand-alone system, where the installed language interpreter comes up on power on, and the language includes the monitoring and basic system operation, such as receive a program into memory, save it on a device, load and run if from a storage device, etc. For some back filling you may look at this post simple explanation how to save code that Espruino run on start? and also the conversation it is part of. I do this Espruino thing for a while now, and can tell you that Esprino works extremely reliable on the supported platforms... and if there is something, @gfwilliams is on top of it. In the past, @gfwilliams was also looking at the other HW - non-Espruino board - but the number of supported Espruino environment has grown as well as the unsupported ones, so that @gorden had to focus on and give priority to the environments that provide, because - after all - Espruino is open and free. As a side note: as much as great experience is helpful, it can make blind or at least biased. Posted at 2021-05-17 by @fanoush
There can be different opinions about Posted at 2021-05-17 by AkosLukacs +1 Posted at 2021-05-17 by gdanov Thanks. I've been re-thinking how to structure the code I intend to do (modules included) and am moving in the direction where very little state will be persisted via save(), if any. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-08 by gdanov
Hi,
I'm using my heltec esp32 as simple temperature monitoring device:
What's weird is that every 10-15 minutes I get error from influx because I'm sending corrupt strings. The errors are small — here & there one character is wrong.
Also, the device works for few hours and then stops sending data. Haven't been able to catch this moment and see tho logs yet.
How stable/dependable is espruino? Can I rely on it to control heaters and pumps (planned next step)?
Beta Was this translation helpful? Give feedback.
All reactions