Script Language

ersky9x is a port of er9x for use on the sky9x board.
User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Script Language

Post by MikeB » Fri Mar 30, 2018 11:17 am

r222A4 now posted for all radios. This fixes the "off grid inverse video" bug, and also fixes a bug in the bitfield function.
I've updated the "Script.pdf" document on the first post to show recently added functions.

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

lshems
Posts: 13
Joined: Tue Sep 15, 2015 5:36 pm
Country: -

Re: RE: Re: Script Language

Post by lshems » Fri Mar 30, 2018 12:26 pm

MikeB wrote:r222A4 now posted for all radios. This fixes the "off grid inverse video" bug, and also fixes a bug in the bitfield function.
I've updated the "Script.pdf" document on the first post to show recently added functions.

Mike
It's getting interesting.

planger
Posts: 69
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger » Fri Mar 30, 2018 3:16 pm

I confirm at least that r222a3 is solving the off grid inverse issue on my 9XR Pro.
I haven't tried r222a4...
Pascal

planger
Posts: 69
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger » Fri Mar 30, 2018 4:55 pm

...

planger
Posts: 69
Joined: Mon May 04, 2015 10:50 am
Country: France

Re: Script Language

Post by planger » Tue Apr 03, 2018 8:21 pm

Mike,
I can't display within the script a correct value of A1.
I can get the radio to display the correct value in Config->Telemetry -> A1 channel 13.5v 7.6 <= 7.6V is my 2S lipo voltage. This value is displayed correctly on the telemetry screen A1=7.6,RX=.., TX=... But within the script if I do:
tmp = getvalue("A1= ")
drawnumber(84, 0, tmp, PREC1)
I'm getting a displayed value of 1.4 .
Any clue of what I'm doing wrong?
Notes:
- I've tried "A1= ", "A1=","A1" and I always end up with 1.4 .
- I have no issues with "Batt" for which I get the correct value.
Pascal


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

Re: Script Language

Post by MikeB » Wed Apr 04, 2018 10:34 am

I can reproduce this result, I'll look into it later today (I get 0.8 when the A1 value is 4.9).

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

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

Re: Script Language

Post by MikeB » Wed Apr 04, 2018 4:18 pm

OK, problem(s) fixed in "A5", just posted. I had a "boundary condition" that included A1 in some scaling when it should not have been included, and also A1 and A2 were not being scaled by their set ratio, so you got the raw A2D value.

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

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

Re: Script Language

Post by MikeB » Mon Apr 30, 2018 10:58 am

The most recent test version (ersky9xProvR222a6.zip), includes an option to display a popup menu. Here is a description (being added to the "manual" of how to use it.

popup
syntax: popup( option_list, mask, width )
Returns 0 while nothing selected, 1 to 16 if an item selected and 99 if EXIT is pressed to cancel the popup.
The option_list is a string with each option separated by a null ('\0') character, e.g."Opt 1\0Opt 2\0Opt 3\0Opt 4"
The mask is a bitfield of 16 bits that indicates which of the options are to be displayed in the popup, with the least significant bit indicating the first option e.g. a mask of 13 (0x0D, 0b00001101), would cause the above list to display Opt1, Opt3 and Opt4. Note the return value always returns the exact position in the list of a selected item, so with a mask of 13, only values 1, 3 or 4 will be returned.

Code: Select all

if init = 0
 init = 1
end
drawclear()
drawtext(20, 16, "Hello", 0)
rem Pressing MENU starts the popup
if Event = EVT_MENU_BREAK
rem But only if it isn't already running
 if pop = 0
  pop = 1
  rxres = 0
rem Setting Event to 0 removes the EVT_MENU_BREAK event so the popup doesn't “see” it
  Event = 0
 end
end
rem Test if the popup is running
if pop
 result = popup( "Opt 1\0Opt 2\0Opt 3\0Opt 4", 0x0D, 6)
rem If anything non-zero is returned, terminate the popup
 if result
  rxres = result
  pop = 0
 end
end
I'm also adding in detection of a label if it starts at the first character on a line and has no characters after it on the line. This will help should you forget to put the ':' at the end!

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

bnbarr
Posts: 3
Joined: Sun Jan 28, 2018 4:49 am
Country: -

Re: Script Language

Post by bnbarr » Fri Jun 22, 2018 6:51 am

Has something has changed between r221 and r222a6 or betaflight 3.2 to 3.3 and now 3.4?.
The BF_basic.bas pid script no longer returns any values.... the only changes since it was working have been firmware upgrades.

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

Re: Script Language

Post by MikeB » Fri Jun 22, 2018 8:46 am

No intentional changes to the script operation in ersky9x. You could try backing up your EEPROM (just to be sure), then put r221 back on to see if the problem is with ersky9x or betaflight. Then, could you try reverting the betaflight firmware? I don't have betaflight so I can't do any testing.

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

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

Re: Script Language

Post by MikeB » Sun Jul 15, 2018 9:22 pm

Some updates to the script language.
crossfiresend() included.
const added to allow defining numeric values by name.
drawrectangle now takes an optional fifth parameter (percent from 0 to 100). If present then the rectangle will be filled for that percentage from the left.
drawline now takes an optional fifth parameter (colour), 0 for XOR, 1 for BLACK, 2 for WHITE.

I've posted an updated pdf file on the first post.

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

Post Reply

Return to “ersky9x”