Auto Run

If doesn't fit into any other category ....
Post Reply
Marv
Posts: 6
Joined: Mon Feb 08, 2021 6:09 pm

Auto Run

Post by Marv »

When I go to config and name a file for auto run this is the result I get when reset esp.
Connecting.......
Connected to lab
IP address: 192.168.0.193
File open failed: io1.bas
Program not loaded
I need to run a program when power is applied and not thru the website
do I have a problem with auto run or is this not possible.
User avatar
Electroguard
Posts: 276
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 55 times
Been thanked: 129 times

Re: Auto Run

Post by Electroguard »

Make sure to prefix the Autorun filename with a root-relative path, ie:/program/filename.bas
Marv
Posts: 6
Joined: Mon Feb 08, 2021 6:09 pm

Re: Auto Run

Post by Marv »

Electroguard:
my program resides in c:/annex My Program/io1.bas so I entered this in cofig
and got this results
File open failed: c;/annex my Programs/io1.bas
guess I am not sure how to get root directory
User avatar
PeterN
Posts: 142
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 56 times
Been thanked: 75 times
Contact:

Re: Auto Run

Post by PeterN »

Good morning Marv

The naming suggests that you want to start a program that is on the PC and not in local storage (?)

- Avoid spaces in the local names

- Programs can be created in the ANNEX web editor (also with copying and pasting the text).

-The program is then stored locally (also in a subfolder) from the ANNEX editor; for example /io.bas or /program/io.bas

-The program is entered in the autostart starting with "/"; here /io.bas or /program/io.bas

The online help (accessible with the F2 key in the editor) gives important information about the file system, etc.


Good luck
User avatar
Electroguard
Posts: 276
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 55 times
Been thanked: 129 times

Re: Auto Run

Post by Electroguard »

Just to clarify...

In use, the ESP device may not even have a computer connected, so Autorun runs a file which is on the ESP device (and may not even exist on computer).

autorun.jpg

Let's assume that the required file is already loaded in the Editor (and prefixed with its path from root /) , and you know that it RUNs ok.
Simply highlight the contents of the Editors File to Run window, and paste them into the Config Autorun File window (and don't forget to Save)
You do not have the required permissions to view the files attached to this post.
Marv
Posts: 6
Joined: Mon Feb 08, 2021 6:09 pm

Re: Auto Run

Post by Marv »

I have uploaded the file in file manager went to editor and went to save As saved the file runs fine in editor with the save button then run.
I took the file that was loaded and copied the file to config autorun. The program runs fine as long as I call up the web page and save then run.
It just gives me file auto upload error when I try to run it without the web page. The file is saved on the esp-32 because I can go to web page and go to open and the file is there and will run within the webpage.I thing I am rambling gratefull for the help.
this is copy of config file
Autorun File
/io1.bas
Menu bar Disable
Fast boot on
This is in the editor: file to run /io1.bas

This is my file manager
Annex WiFi 1.43 ---- Flash free : 2947995
Directory
/
No file chosen Choose files… Upload
Delete View Rename Repair Disk
/io1.bas
config.ini
User avatar
PeterN
Posts: 142
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 56 times
Been thanked: 75 times
Contact:

Re: Auto Run

Post by PeterN »

That ist confusing . I would again make sure that there is no space behind the name
User avatar
Electroguard
Posts: 276
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 55 times
Been thanked: 129 times

Re: Auto Run

Post by Electroguard »

We'll sort this problem one way or another, Marv.

Sometimes you can look at something so long and so hard that you don't really see it any more - then it's time to look at things differently.
Lastly... the most enduring memory of microsoft windows is that the system can become so screwed that the only way to fix it is by a reboot.
So if all else fails with Annex, try re-flashing the device with the latest firmware using the Green Button (keeping your original scripts) ... unlike re-installing windows, Annex just takes a minute or two.

First though, lets avoid using the File Manager for the moment, just in case the file which you can see in the list is not actually where you think it is.
In fact let's start over so we know exactly where we are.

Make sure the script in the Editor Runs correctly, then Stop it (to prevent the interpreter being too busy running it)
Change the filename in the Editor File to Run window to something completely different, perhaps /pleasebehave.bas
Save it
Now copy the new filename from the File to Run window and paste it into Config Autorun field, then SAVE Config.

To check if it the Autorun mechanism is running as expected, return to the Editor, then add a couple of new lines towards the top of the script, before anything that could reference any resources...
WLOG "Autorun"
END

Save the script, reboot the device, and check for the Autorun message in the wlog window.
If ok, then remove END, Save, reboot the device again.
You should still see another Autorun msg in wlog, but if something has now gone wrong (the error you mentioned) then the problem is obviously something in the script rather than the autorun mechanism.

If you don't get the Autorun message in the wlog window after a reboot, then now is the time to swear and reflash the device.
Marv
Posts: 6
Joined: Mon Feb 08, 2021 6:09 pm

Re: Auto Run

Post by Marv »

boy thanks again for the help!! I compleatly deleted the file from my web page and retyped it back in and the darn thing started working, i am wondering if it did not recognize the / any way I have learned alot and appreciate you Electroguard and also PeterN. Maybee I should use the forum more instead of beating my head against the wall. anyhow appreciate the response.
Post Reply