Page 7 of 11

Re: Script Language

Posted: Fri Jan 26, 2018 8:30 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 3:10 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 3:32 pm
by jhsa
Perhaps a couple more "Custom Screens" could be a good idea?? ;) :)

Thanks

João

Re: Script Language

Posted: Sat Jan 27, 2018 8:53 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 9:10 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 9:29 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 9:49 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 10:58 pm
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

Re: Script Language

Posted: Sat Jan 27, 2018 11:57 pm
by MikeB
I've posted "g5" in a later post again, definitely got a few problems adding attachments currently.

Mike

Re: Script Language

Posted: Sun Jan 28, 2018 2:30 am
by jhsa
Thanks Mike.. I tried to contact Rob about it, but still got no answer about it..

João

Re: Script Language

Posted: Sun Jan 28, 2018 4:51 am
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?

Re: Script Language

Posted: Sun Jan 28, 2018 9:09 am
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

Re: Script Language

Posted: Sun Jan 28, 2018 12:13 pm
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

Re: Script Language

Posted: Sun Jan 28, 2018 12:19 pm
by MikeB
bnbarr wrote:
Sun Jan 28, 2018 4:51 am
forgive my ignorance but is there a guide on how to do this anywhere?
See: http://openrcforums.com/forum/viewtopic ... de#p112423.

Mike

Re: Script Language

Posted: Sun Jan 28, 2018 6:47 pm
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

Re: Script Language

Posted: Sun Jan 28, 2018 7:02 pm
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

Re: Script Language

Posted: Sun Jan 28, 2018 7:20 pm
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...

Re: Script Language

Posted: Sun Jan 28, 2018 7:35 pm
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

Re: Script Language

Posted: Sun Jan 28, 2018 8:00 pm
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

Re: Script Language

Posted: Sun Jan 28, 2018 9:00 pm
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

Re: Script Language

Posted: Sun Jan 28, 2018 9:18 pm
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

Re: Script Language

Posted: Mon Jan 29, 2018 12:51 am
by jhsa
Thanks Mike.. I think that er9x.com might be the best solution for now..

João

Re: Script Language

Posted: Mon Jan 29, 2018 9:01 pm
by planger
Mike, I've tested version g6 and everything seems to work fine from what I can see.
Thanks, Pascal

Re: Script Language

Posted: Tue Mar 27, 2018 5:22 pm
by rsilk49
I see some new functions were recently added to R222.
Where can we get the latest documentation for the scripting language?

Re: Script Language

Posted: Tue Mar 27, 2018 11:25 pm
by MikeB
I'll try to get round to updating the document.

Mike

Re: Script Language

Posted: Wed Mar 28, 2018 2:14 pm
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

Re: Script Language

Posted: Wed Mar 28, 2018 8:01 pm
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

Re: Script Language

Posted: Wed Mar 28, 2018 8:18 pm
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

Re: Script Language

Posted: Wed Mar 28, 2018 9:45 pm
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.

Re: Script Language

Posted: Thu Mar 29, 2018 10:59 pm
by MikeB
I've just posted a test version of ersky9x for the 'PRO with the "off grid inverse video" bug fix in.

Mike