Script Language
-
- Posts: 47
- Joined: Thu Aug 23, 2018 5:37 am
- Country: Russian Federation
- Contact:
Re: Script Language
Hello Mike. Is there any way to debug scripts? Mine just stops working right after start, it will be hard to find a problem.
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
What Tx are you using?
Is your script very large?
I'm (currently) allocating 12k bytes of RAM for scripts (except for the SKY board that only has 8k). I'm wondering if your script is too large to fit.
Mike
Is your script very large?
I'm (currently) allocating 12k bytes of RAM for scripts (except for the SKY board that only has 8k). I'm wondering if your script is too large to fit.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 47
- Joined: Thu Aug 23, 2018 5:37 am
- Country: Russian Federation
- Contact:
Re: Script Language
9XR-PRO. Yes, about 1k lines. 12 kB might be too few for it.
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
I will increase the space available on the 'PRO, although if the script is too large, you should get an error 10 reported.
I did originally have a test setup I used on my computer, running the script language within QTCreator. If you have QTCreator I could see about making this available.
Mike
I did originally have a test setup I used on my computer, running the script language within QTCreator. If you have QTCreator I could see about making this available.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
That test setup was really for me to test the code that handles the script, so doesn't have a script display output.
It may take a bit of time but I should be able to get a display output, I have some hooks in for it that seem to work. I've just got "drawtext" displaying something.
I'll probably need to add some buttons (Menu, Exit etc,) to the display.
How much of any script can be simulated, I'm not sure, things like getting telemetry values won't work.
What I also do have working is the same syntax check as the radio uses, so this should, at least, check the syntax. It does use the same source code file as the radio.
Give me a few days to see if I can knock this into shape.
Mike
It may take a bit of time but I should be able to get a display output, I have some hooks in for it that seem to work. I've just got "drawtext" displaying something.
I'll probably need to add some buttons (Menu, Exit etc,) to the display.
How much of any script can be simulated, I'm not sure, things like getting telemetry values won't work.
What I also do have working is the same syntax check as the radio uses, so this should, at least, check the syntax. It does use the same source code file as the radio.
Give me a few days to see if I can knock this into shape.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
what about if the scripts could be simulated in Eepskye?
João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
Later maybe, but much easier to develop the feature using a specific application.
Mike
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
I'm making good progress on a PC program to test scripts. I have it running with 6 buttons working and a simulated display (128x64).
I have text, numbers and graphics displaying, complete with the popup working.
I need to add a file select dialog, it is currently using a hard coded path to a script to run.
Mike
I have text, numbers and graphics displaying, complete with the popup working.
I need to add a file select dialog, it is currently using a hard coded path to a script to run.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
I've posted, on the first post of this thread, a first version of a PC (windows only so far) program that runs scripts.
Copy "interpreter.exe" into the directory in which you have installed eepe/eepskye (it needs the QT dll files), then run it.
Click on the "File" button to select your script file, then click on the "Run" button to run it. The Menu, Exit, Left, Right, Up and Down buttons should operate as though you are using them on the radio. The "Abort" button stops a running script.
Remember that this cannot simulate all the functions, although it should check the runtime operation without performing those functions.
Mike
Copy "interpreter.exe" into the directory in which you have installed eepe/eepskye (it needs the QT dll files), then run it.
Click on the "File" button to select your script file, then click on the "Run" button to run it. The Menu, Exit, Left, Right, Up and Down buttons should operate as though you are using them on the radio. The "Abort" button stops a running script.
Remember that this cannot simulate all the functions, although it should check the runtime operation without performing those functions.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
That‘s really cool . Thank you
Re: Script Language
Thanks Mike..
João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
Just adding a new BT function "Script", and two new functions to scripts "btsend" and "btreceive". This should allow scripts to send and receive data over bluetooth.
I have just tested a script that sends a single character 'A' once per second, and received that over bluetooth in a terminal emulator on my PC, so that much seems to work.
Mike
I have just tested a script that sends a single character 'A' once per second, and received that over bluetooth in a terminal emulator on my PC, so that much seems to work.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
Would it be for example possible to mimic the radio screen over bluetooth on an android device?
João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
Possibly if someone writes an "app" for android.
I have now tested serial data both ways, so this addition looks to be working.
Mike
I have now tested serial data both ways, so this addition looks to be working.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
That would be wonderful.. Anyone??
We could build our own radios without LCD and use the pins for something else
Our radio's display could be any size and even be kept in our pocket until we need it.
Make it wireless over wifi and the possibilities multiply
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Re: Script Language
jhsa wrote: ↑Wed Oct 24, 2018 8:28 pmThat would be wonderful.. Anyone??
We could build our own radios without LCD and use the pins for something else
Our radio's display could be any size and even be kept in our pocket until we need it.
Make it wireless over wifi and the possibilities multiply
João
please, for the love of god, NO.
Re: Script Language
Why not? You shouldn't even need the LCD when flying. We shouldn't take our eyes away from the model. That is why we have voice alarms, so we don't have to look at the screen when flying the models
I would like to have eepskye on android for example.. Very useful when at the field
João
I would like to have eepskye on android for example.. Very useful when at the field
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Re: Script Language
if all you are trying to do is get eepskye on a tablet at the field, android is not the way to do it... you can find 8" and 10" windows tablets for less than $200, get all the power of having a real OS, and you won't be stuck trying to answer your phone while connected to your transmitter...jhsa wrote: ↑Thu Oct 25, 2018 9:26 pm Why not? You shouldn't even need the LCD when flying. We shouldn't take our eyes away from the model. That is why we have voice alarms, so we don't have to look at the screen when flying the models
I would like to have eepskye on android for example.. Very useful when at the field
João
Re: Script Language
Android is much more widely spread as OS as far as I know.. And I don't like windows anyway.. It likes crashing too much
Also, my point is to not take a huge tablet to the field, but to be able to use my smartphone which is much smaller. If I wanted a bigger screen, I would just take my laptop or notebook anyway, which I don't.. But i always take my android phone with me, and so do most of the people probably
João
Also, my point is to not take a huge tablet to the field, but to be able to use my smartphone which is much smaller. If I wanted a bigger screen, I would just take my laptop or notebook anyway, which I don't.. But i always take my android phone with me, and so do most of the people probably
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
I've extended the COM2 function to include "Script" as well, and renamed the "btsend" and "btreceive" functions to "serialsend" and "serialreceive". This allows scripts to send and receive serial data over either bluetooth or COM2.
For "standalone" scripts, I'm also adding some file access. Using files needs some RAM for each file. Currently, I'm re-using the same file structure as that used to load scripts. This means you may only have a single file, and, to avoid conflicts, you may only access it from a standalone script as no other scripts are running or loading while a standalone script is running. Once this is all working, I may see if I can extend this to other script types, and/or allow more than one file open at a time (not sure what for though!).
I have most of this working, but it needs more testing.
Due to the way I handle selecting files, I'm providing the following functions:
directory( path, extension )
This sets up the list of files from the specified directory path with the given extension.
fileselect( filepath, size )
This allows you to select a file from the list created using the directory() function. If you select a file, then the size of the file is placed in the variable you supply (called size here).
fopen( filename, mode )
This opens the file with the (full path) of filename. mode is 0 for read and 1 for write. Opening a file for write will clear any existing data in an existing file.
fread( length, buffer, number_read )
Reads length bytes from the open file, storing them in buffer, and setting number_read to the number of bytes actually read.
fwrite( length, buffer, number_written )
Writes length bytes from buffer to the open file, and sets number_written to the number of bytes actually written.
fclose()
Closes an open file.
With these, I think it should be possible to transmfer a file from one radio to another either over bluetooth or a serial connection.
Mike
For "standalone" scripts, I'm also adding some file access. Using files needs some RAM for each file. Currently, I'm re-using the same file structure as that used to load scripts. This means you may only have a single file, and, to avoid conflicts, you may only access it from a standalone script as no other scripts are running or loading while a standalone script is running. Once this is all working, I may see if I can extend this to other script types, and/or allow more than one file open at a time (not sure what for though!).
I have most of this working, but it needs more testing.
Due to the way I handle selecting files, I'm providing the following functions:
directory( path, extension )
This sets up the list of files from the specified directory path with the given extension.
fileselect( filepath, size )
This allows you to select a file from the list created using the directory() function. If you select a file, then the size of the file is placed in the variable you supply (called size here).
fopen( filename, mode )
This opens the file with the (full path) of filename. mode is 0 for read and 1 for write. Opening a file for write will clear any existing data in an existing file.
fread( length, buffer, number_read )
Reads length bytes from the open file, storing them in buffer, and setting number_read to the number of bytes actually read.
fwrite( length, buffer, number_written )
Writes length bytes from buffer to the open file, and sets number_written to the number of bytes actually written.
fclose()
Closes an open file.
With these, I think it should be possible to transmfer a file from one radio to another either over bluetooth or a serial connection.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
wow, so we could have a script, or an app to transfer files? would we need this Script on both radios in order to send / receive it?
Also, would we have to write a new script with a new file path and name to send a different file? or could we just select it from a list? This would be wonderful.
Thanks
João
Also, would we have to write a new script with a new file path and name to send a different file? or could we just select it from a list? This would be wonderful.
Thanks
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
A script on both radios.
directory() and fileselect() let you choose a file from a list.
Mike
directory() and fileselect() let you choose a file from a list.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
Thanks Mike.. would love to try that
João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
I have just managed to send a (model) file from my SKY board radio to my QX7 over bluetooth.
It does, currently, take a relatively long time, and I can see some retries occuring where there are some transmission errors (e.g. lost bytes), but the file did get transferred correctly.
I need to clean up the scripts (e.g. removing debug from the display), and probably speed it up a bit, before I 'publish' the scripts. I will also need to post updates firmware files that support the required functions.
Mike
It does, currently, take a relatively long time, and I can see some retries occuring where there are some transmission errors (e.g. lost bytes), but the file did get transferred correctly.
I need to clean up the scripts (e.g. removing debug from the display), and probably speed it up a bit, before I 'publish' the scripts. I will also need to post updates firmware files that support the required functions.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
Thanks Mike.. How long was a long time??
João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
I have it sending about 240 bytes per second, so a 3600 byte file took 15 seconds. I'm not sure why it is this slow, I think it should be at least 5 time faster.
Mike
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
Do you have two HC-05?? Could it be the BT modules, or shouldn't it make a difference??
Thanks
João
Thanks
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- MikeB
- 9x Developer
- Posts: 17994
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Script Language
Currently sending from SKY board to QX7 with HC-05 and 'PRO with HC-06. The 'PRO/HC-06 was very bad. I've just raised the interrupt priority for the serial receive data from the BT module on the 'PRO and that is now working much better, the file transferred in 10 seconds, but still had some retries.
I need to investigate if I'm still missing serial data.
Raising the interrupt level on the SKY board has enabled sending the file, to the 'PRO, with no retries, so I can look into speeding this up more.
Mike
I need to investigate if I'm still missing serial data.
Raising the interrupt level on the SKY board has enabled sending the file, to the 'PRO, with no retries, so I can look into speeding this up more.
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Script Language
This is great Mike, thank you.. I wonder how faster it would be with wifi, now that you have found a way to turn the modules off when not in use, avoiding draining the battery
João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW