Run previously saved program loaded into editor

Here we can discuss about the problem found
Post Reply
nedudgi
Posts: 17
Joined: Tue Feb 09, 2021 7:01 pm
Location: Budapest, Hungary
Has thanked: 61 times
Been thanked: 2 times

Run previously saved program loaded into editor

Post by nedudgi »

When I load a program (saved a long-long time ago) into editor, I must re-save it before is can run, or debug it. Is this a concept, bug, or feature?
User avatar
Nighthawk
Posts: 7
Joined: Fri Feb 19, 2021 5:23 pm
Has thanked: 20 times
Been thanked: 2 times

Re: Run previously saved program loaded into editor

Post by Nighthawk »

Hi Nedudgi,
I think what you are experiencing is that your browsers cache is still holding the previous code in the editor window.
So when you connect to the module the browser is showing the cached version of the code NOT the actual code on the module.
You will definitely need to do one of two things...
1. (best choice to make sure you load the last version that was saved to the module) Do a file open and choose the file from what is saved in the module.
2. (could possibly cause you to overwrite the latest version on the module) just do a save and run from what is cached in your browser (you will have to hit SAVE not just RUN as the module actually does not receive the code from the browser cache until you do the SAVE.

this has tripped me up a few times.
It is also very important that you periodically copy and paste your code from the editor window to a text file (notepad or notepad++) and save copies and versions on your PC.
More than once I have lost a version of code because the module stopped working, was damaged, or some other unforeseen event.

Definitely start a library of programs you want to keep as text files on your PC, NOT just on the esp module.

I hope this helps.
cheers
Dwight
nedudgi
Posts: 17
Joined: Tue Feb 09, 2021 7:01 pm
Location: Budapest, Hungary
Has thanked: 61 times
Been thanked: 2 times

Re: Run previously saved program loaded into editor

Post by nedudgi »

Hi, I started with ESPasic, so learned, that I have to save every modification. :)
Maybe I was not enough clear.
I load a program from the editor, with the "Open" button. The browser has nothing in the cache, the program was loaded directly at flashing Annex.
Two clicks, the first is "Open" (not mentioning pointing a program), the second is "Run".
User avatar
Electroguard
Posts: 836
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 268 times
Been thanked: 317 times

Re: Run previously saved program loaded into editor

Post by Electroguard »

You won't go far wrong if you follow that advice from dwight.

To help understand what is happening...
CiccioCB has used his magic to squeeze so much astonishing performance and capability into eg: a 1Mb Sonoff... but there is not enough memory available to actually save the original script, nor its comments, nor any old script remnants which are no longer being referenced, nor retain the original possibly lengthy variable and branch names etc - so what gets saved to the device is a minimal highly optimised symbolic representation of the script functionality, therefore there is no way to re-constitute the original script from its symbolic representation on the device.

There is no real link between any remaining browser content of the original script and any symbolic representation of it on the device.
That's why you must 'Load' or 'Save' the script in the Editor to actually link it to that filename on the device... even though they may not correspond.

We've all been caught out by it, and have developed our own preferred ways to avoid being caught out again.
I usually increment the script filename after any significant changes and also include that filename as a comment at the top of the script... which makes it very simple to match browser content to device filename (eg: my Sentry alarm script says it is Sentry9d, which is the filename I load and run from the device).

It is also useful to save the name of the latest saved version as the autorun entry in the Config page even if you don't actually autorun the script, because it can act as a record of what version of script you were last working on.

But inevitably there will come a time when you switch tracks completely and start working on something entirely different - so the only way of returning back to the original at some later date is to load the most appropriate version of that script from your computer.
I have a projects folder containing subfolders of all the ongoing projects I've been working on, in which I periodically save an appropriate named copy of the incremented script name following any major changes... so I can (usually - cos I'm far from infallible) return to anything even when I cannot remember much about it. And if I regret my latest changes, it is handy to quickly revert back to the previous version if needed.
nedudgi
Posts: 17
Joined: Tue Feb 09, 2021 7:01 pm
Location: Budapest, Hungary
Has thanked: 61 times
Been thanked: 2 times

Re: Run previously saved program loaded into editor

Post by nedudgi »

Thank You, that is (and was) clear.
I asked this, as I have modified data-min.zip, to simplify integration into my home systems, met this thing. This situation is a correct concept, not a possible bug (is not).
Thank You again.
Post Reply