Jump to content
Sign in to follow this  
huha001

Debug help for params in RPN scripts

Recommended Posts

I really like the params in RPN scripts as they make it a lot more efficient.
The only thing I am missing here is the automatic checking of the script with the green and red LED in the RPN script window, which does not work if the script contains params.

Would it be possible to add a scriptcommand DEBUGPARAMS like
DEBUGPARAMS;L:COM1_TOGGLE;K:COM1_RADIO_SWAP

which replaces then param1 with L:COM1_TOGGLE and param2 with K:COM1_RADIO_SWAP for internal testing with the green and red LED in the edit RPN script window?

Another great efficiency improvement for debugging would be a script command like
DEBUGVARIABLE L:COM1_TOGGLE
which would automatically add the variable to the "Observe Variables in Simulator" window if it is open and the script is executed.

 

P.S.:

A big thanks for all your other recent enhancements to axes & ohs. Those created a lot of value for me and i can use it now on a laptop on the desk while the Fs2020 computer is  now running just the simulator. Also the new Web Pages for html instruments are just great.

 

Share this post


Link to post
Share on other sites

Arrgh. I forgot about the params. Sorry about that. I will add some code in the 2.28 so the RPN Editor can parse them correctly, including the numbering (so you can't get that wrong at least). IMHO that is simpler and safer to do than forcing the user to enter debug information? The gerenal idea being, that you first create the script with the "final" code anyway, and only when that works, you replace the relevant parts of it with "param1" etc.? But I will think some more about how to debug cascading scripts, there must be another way.

As for the other thing - these dialogs are running on their own, in separate threads. It is easier said than done to exchange data between them. I will look at the effort involved, but I am not sure that I want to go there.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

So I've added a proper debug screen to AAO instead of the timed message boxes. That one should also show the code of the cascading scripts.

Would you mind sending me an email with your proof of purchase? Then you can try it. Address is on the last page of the manual.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Thanks a lot for your fast response and help. I will send you an email to wildfiretrainingsolutions.ca with proof of purchase.
On the debug of variables it may be easier just to read from an ascii file with a special name at a special location if it exists (e.g.  variables.txt). The names of the variables could then be just listed line by line e.g:
L:COM1_TOGGLE
L:COM2_TOGGLE

The idea would be that after closing axes and ohs and starting later in another session you do not have to input again all the names.

But this is only a minor item for me.

Share this post


Link to post
Share on other sites

Please ignore my comments on the variable debugging.

I just realized how the (EXPORTVARS:xxxx)  and the (REPLACEVARS:xxxx,yyyy) work in scripts and this is better and was exactly what i was looking for. Sorry for confusing here. I was so far only using the variable window for debugging, but this is much better.

Share this post


Link to post
Share on other sites


So it all existed already in AAO (thanks a lot to Oliver for his help). Attached I am showing an example for other newbies:

Below is a simple script to swap the COM or NAV frequency defined by param1 and flash the xtouch mini LED encoder ring (param2) for 100ms.

-----------------------------------------------------------------------------------------------------
//Swap Active and standby frequency for a long click and flash all LEDs on xtouch mini

//param1 event to swap frequencies e.g. K:COM1_RADIO_SWAP
//param2 Encoder led ring e.g. MIDI:3:CC:1:9

//flash encoder LED ring on xtouch mini
27 (>param2)

1 (>param1)
(WAIT:100)

//turn off encoder LED ring on xtouch mini
0 (>param2)
-----------------------------------------------------------------------------------------------------

This script can now be called from a test script in C:\Users\your_user_name\Documents\LorbyAxisAndOhs Files\Scripts\DebugParams.txt
by starting it from the AAO window: Scripting -> Run Script Files
It replaces the params by the actual values.
The "select scripts to run" window allows to choose a line number to start the script which I am using for the different combinations of params.
Before starting the script I export all variables. This exports all variables from the AAO cache with the value into a file myvariables.tsv.
After the :END label I am waiting 300ms as scripts are always executed in a separate task and then I am
writing the changes of variables (AAO will save two columns of numbers) into another file changes.tsv.

Before starting from different line numbers, you need to make sure that all the replaced variables are in the AAO cache and have been written to myvariables.tsv once.


In the future this export will no more be needed as Oliver is doing great work on better debug support right now.

Testscript for params:
-----------------------------------------------------------------------------------------------------
// Debug script for params which can be started from the menu item: Scripting -> Run Script Files
// It will replace the 2 params in huha-test-COM_NAV_SWAP

// Export before frequency swap variables from AAO cache into a file with values at C:\Users\your_user_name\Documents\LorbyAxisAndOhs Files\Scripts\myvariables.tsv
(EXPORTVARS:myvariables.tsv)
(WAIT:300)

// now call param script with all different variables to test one by one
// swap frequencies and flash encoder LED ring with MIDI command

1 (>K:huha-test-COM_NAV_SWAP;K:COM1_RADIO_SWAP;MIDI:3:CC:1:9)
(GOTO:End)
1 (>K:huha-test-COM_NAV_SWAP;K:COM2_RADIO_SWAP;MIDI:3:CC:1:10)
(GOTO:End)
1 (>K:huha-test-COM_NAV_SWAP;K:NAV1_RADIO_SWAP;MIDI:3:CC:1:11)
(GOTO:End)
1 (>K:huha-test-COM_NAV_SWAP;K:NAV2_RADIO_SWAP;MIDI:3:CC:1:12)
(GOTO:End)

:End

// AAO is starting scripts in as a separate task and is not waiting for its execution, so use WAIT to wait for the script execution
(WAIT:300)

// Export changes into file C:\Users\your_user_name\Documents\LorbyAxisAndOhs Files\Scripts\changes.tsv
(REPLACEVARS:myvariables.tsv, changes.tsv)

 

Edited by huha001

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...