-->
Page 6 of 9

Re: Load another Basic Program

PostPosted: Sun Feb 05, 2017 3:16 pm
by Oldbod
If you create a program using another editor - say notepad - and then save it on your pc, and then upload it using the file manager, you might end up with a file which contains some unexpected (and undisplayable ) characters.

If you always write your code using the edit part of espbasic, this shouldn't be an issue. But I do wonder if the way code goes from browser and whatever the browser is running on, to the esp8266, is partly responsible for some of these odd issues. If I recall correctly, mmiscool tests using chrome. But even if you run chrome, what the whole stack is who knows. That's part of the problem using a browser - it might be a standard, but there are many layers between screen and keyboard and esp8266...

Re: Load another Basic Program

PostPosted: Sun Feb 05, 2017 6:48 pm
by Electroguard
It appears that the 4Mb build of V66 has a bug preventing loading of files from script, but the 1Mb build seems ok.
The attached zip contains some demonstration test files for anyone who wishes to test out file loading from script for themselves.
After unzipping them, I suggest you upload file1.bas, file2.bas, file3.bas and file4.txt by going into File Manager and Browsing to each then clicking Upload for each (which puts them into the \uploads\ folder).
Still in File Manager I suggest you select \default.bas then click Edit, then paste and Save the contents of the supplied default.bas file (so it is saved into \). The attached pic shows what you should see in File Manager.
Image

I've also embedded default.bas and file1.bas (the others are similar to file1.bas but with an appropriate name change).

When you run the supplied default.bat file it does an initial memclear then allows selection and load of any of the test files.
Each time a file is 'loaded', a file counter is incremented, which shows that vars are being inherited by subsequently loaded files.
I repeat that this works fine on the 1Mb build, but causes the ESP to crash and reboot on the 4Mb build.

Notice that file4.txt also loads and runs ok, showing that basic scripts don't necessarilly require .bas extension.

http://www.electroguard.eu/workshop/LoadFiles.zip

Code: Select allmemclear
filen = "/default.bas"
html "Filename=" & filen & "<br>"
fileloads = 0
dropdown filen, "file1.bas,file2.bas,file3.bas,file4.txt"
button "Load filename",[LOADFILE]
wait

[LOADFILE]
filen = "/uploads/" & filen
load filen
print "This should not show because the selected file should load and run first"
wait


Code: Select allfilen = "file1.bas"
fileloads = fileloads + 1
html "<br>Filename=" & filen & ", file loads=" & fileloads & "<br>"
dropdown filen, "file1.bas,file2.bas,file3.bas,file4.txt"
button "Load filename", [LOADFILE]
wait

[LOADFILE]
filen = "/uploads/" & filen
load filen
print "This should not show because the selected file should load and run first"
wait

Re: Load another Basic Program

PostPosted: Mon Feb 06, 2017 5:48 pm
by Oldbod
Odder and odder. Will try this in a bit. At the moment I can't get any load to work... even the old rel2 version. Good spot....

Yep. 1M build 66 load works, 4M build 66 load fails for me too. I notice the loading . . . message displays whatever follows the load statement - eg load x$ displays loading . . . . .x$, not content of x$.

Re: Load another Basic Program

PostPosted: Mon Feb 06, 2017 9:00 pm
by Mmiscool
I just spent a few hours trying to track this one down.

I have a feeling that this might also be related to why it crashed on a second save from time to time.