Script Language

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
Post Reply
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

Thanks Mike!
I'm nearly done with my script. It's quite cool :D

If there could be a way for a background script to take control of the screen that would be awesome. Something like you flick a switch the screen appears (like if it was launched from the menu) or you go to a special page or...
Today I'm duplicating my script to be launched at the model selection and via the menu so I can have the display.

Next (when I'll have time) I'm thinking to build a script using multi to scan frequencies with asscoiated RSSI. Transmitting data should be ok using Gvarx for the start frequency, zoom, scale and other parameters. But receiving raw telemetry frames (in a table) containing the data for the different frequencies is a must have... I don't think this is implemented (yet?).

Pascal

User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

For "Go to a special page", you could just use a telemetry script on a custom telemetry display screen. These do run all the time (except when a standalone script is running), but only display anything when custom screen is displayed.

Receiving raw telemetry - since it sounds like you are doing something special with Multi, couldn't you just get Multi to send some ordinary telemetry data, perhaps some user SPort data where you can put in your own information in.
A Sport packet with an application ID of 0x5000 to 0x50FF is passed to the script handler.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Script Language

Post by jhsa »

Perhaps a couple more "Custom Screens" could be a good idea?? ;) :)

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
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

I've got an update to the voice queue flushing. Now, when the flush switch becomes active, the voice queue is flagged with where the last item in the queue is, and the flushing operation only flushes up to that point.
This means that even if you use the same switch to flush the queue, and add something to the end of the queue, the added item will NOT be flushed.
This will be in r221g5.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

Sounds good.

Have you been able to include in g5 the trim switches fix?

The custom telemetry page is exactly what I was looking for. But the only thing is that it does not react like the other pages. Only left and right do something but up/down/menu/exit do not work. I think you've done that to enable the script to use these keys but I would prefer it to behave like any other pages... Is there a way to do this? It's quite annoying to have to do left or right to be able to access the menu for example...

Pascal

User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

Yes, g5 will include the trim switches fix.

Yes, that is why only the left and right keys work. I'll need to engineer some other solution to allow other keys to work.
Currently, it is the main display code that handles key navigation, and if a script is running on a telemetry screen, then the main display code doesn't get to run.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

I would say that not having access to the menu from the custom script telemetry page is really what would make me not using this method. If you are only visiting this page time to time then it might be fine, but if you want it to be your main landing page then to do anything on the radio you need to 1st exit it, do what you want and then go back to it. I find it easier to have the script running in background and launching it manually to get the display...
It might be only my special application but...

Pascal
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

OK, I can get the main popup menu to appear over the Telemetry script display, if you press either MENU LONG or the encoder button LONG. It will mean these two button presses can't really then be used within the telemetry script.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

I've posted "g5" in a later post again, definitely got a few problems adding attachments currently.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Script Language

Post by jhsa »

Thanks Mike.. I tried to contact Rob about it, but still got no answer about it..

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
bnbarr
Posts: 3
Joined: Sun Jan 28, 2018 4:49 am
Country: -

Re: Script Language

Post by bnbarr »

MikeB wrote: Thu Dec 21, 2017 9:53 pm The AR9X board, as standard, doesn't support the Smart Port in bi-directional mode needed to send data to the Rx.
You need to add a diode to the inverted COM1 connections for this to work. Have you done this?

Mike.
forgive my ignorance but is there a guide on how to do this anywhere?
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

MikeB wrote: Sat Jan 27, 2018 10:58 pm OK, I can get the main popup menu to appear over the Telemetry script display, if you press either MENU LONG or the encoder button LONG. It will mean these two button presses can't really then be used within the telemetry script.
Is there a solution to do something like this: the telemetry script tests Event, if this an event which is interresting for the script then it calls killevents(Event) to suppress this event from the queue. Once the script is done (stop) you look at the event queue and act on whatever is left there. So basically this way if the script does not want to interract with the users all events will flow as usual and the custom script page won't be different but if the script want to capture left/right/up/down/menu/exit to do an interactive page it can do it.

Pascal
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

The main problem with that is the script could block ALL events, then you would never be able to leave the script's screen.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

bnbarr wrote: Sun Jan 28, 2018 4:51 amforgive my ignorance but is there a guide on how to do this anywhere?
See: http://openrcforums.com/forum/viewtopic ... de#p112423.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

MikeB wrote: Sun Jan 28, 2018 12:13 pm The main problem with that is the script could block ALL events, then you would never be able to leave the script's screen.
Just intercept before launching the script the exit press long event and kill the script if it's the case. This way you can get out if really needed. That's what you are already doing for the standalone script, isn't it? (on my standalone if I long press the exit button it always exit with an error).

Pascal
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

A LONG EXIT should terminate a standalone script, but without any error.
It seems you get an error if a telemetry script is also running. In practice, running a standalone script stops all other scripts running, and when it terminates, other scripts are re-loaded.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

Hummm, I will retry in which case it exit indicating a "false" error in the code.
For sure I always add either a model script or a telemetry script running in background. Usually the same script since I just wanted to get a display...
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

OK, I've found out why there is an error report, and got a fix. When the script stops, the "RunTime" control structure can become overwritten by a loading telemetry or background script, so the "Error" report location becomes set to something other than 0, so tan error is reported. Now, when the standalone script stops, I stop using it's "RunTime" control structure, which is dynamically placed at the end of any loaded script.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

Cool.

Are you thinking about implementing the telemetry script as I described using killevents(Event) to suppress the event from the queue that the radio fw should not interpret?
The LONG EXIT press could also be an event that you could not supress from the queue (ie killevents can't suppress it) so there is always a way out. In the case of the telemetry script it could set the page back to the main default page.
This woud be really flexible and allow to do whatever you want in the script.

Pascal
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

Part way there! When a telemetry script screen is visible, you may press MENU LONG to get the main popup menu, but in this case the "Help" option is replaced by a "Main Display" option, which takes you out of the telemetry screen.
I'm still thinking how to handle all the navigation, since there are two possible telemetry script screens, and it may be you can't get to the second screen. An added complication is the FrSky X9E and X7 radios that don't have left and right buttons.

I'm wondering if the main popup, when called from a telemetry script screen, drops "Last Menu" and "Notes" as well and has "Left" and "Right" instead.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

These changes are now in r221g6. Until a problem on the forum is fixed, you will find "g5" and "g6" on www.er9x.com

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Script Language

Post by jhsa »

Thanks Mike.. I think that er9x.com might be the best solution for now..

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
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

Mike, I've tested version g6 and everything seems to work fine from what I can see.
Thanks, Pascal
rsilk49
Posts: 140
Joined: Wed Oct 26, 2016 10:33 am
Country: United Kingdom

Re: Script Language

Post by rsilk49 »

I see some new functions were recently added to R222.
Where can we get the latest documentation for the scripting language?
S500 + Pixhawk 1 clone + Mauch PM + C&T Telemetry adapter + 9XR-Pro (Taranis gimbals)/XJT/X8R
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

I'll try to get round to updating the document.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

Mike, Is there a way to improve the rendering of "Blink" and "Invers"?
When you use these features each letter is inverted indepently meaning that there is a space inbetween the caracters not inverted. It makes the text readibility quite hard.

Pascal
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

I'm not sure what you are seeing then. They use the standard display code for this and that doesn't normally leave a space between the characters that is not inverted. Could you post some of you script where this is happening?

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
planger
Posts: 90
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger »

My script is attached and also a picture of the screen.
If you load it, you should see T-CUT blinking at the top if the throttle cut switch is by default. If you push some other switches(AIL,ELE,...), you'll see other texts going blinking or not depending on the switch position. I'm using the screen basically as an helper/reminder of which functions are associated to which switches, pots and trims (used as switches).
I had to make the text blink instead of invert otherwise on my 9XR Pro I just can't read it anymore. With Blink you can at least read while not inverted...
Pascal
Attachments
20180328_222116.jpg
samson.zip
(1.43 KiB) Downloaded 245 times
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

I see what is happening. Your text is "off grid", that is the vertical position is not a multiple of 8. The LCD image maps to vertical bytes in memory. Originally I only allowed "off grid" text to be able to create the "keyboard" used for editing text.
I'll look at what is done for inverse when "off grid".

Mike

Edit: Got the fix.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB »

I've just posted a test version of ersky9x for the 'PRO with the "off grid inverse video" bug fix in.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “erskyTx (was ersky9x)”