Scripts for ersky9x

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

Re: Scripts for ersky9x

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

I've posted r222b4, which has some updates for the script language operation, script language thread for more details and an updated pdf.

One change is to drawrectangle. This takes an optional fifth parameter which fills part or all of the rectangle from the left. This means the subroutine "hbar" is no longer needed as drawrectangle now does this.
Another change is to drawline. This now also takes a fifth parameter that allows the line colour to be specified. This helps avoid pixels missing when two lines meet, if required. It looks like drawline may need a bit more checking to improve how it works.

I've attached an updated inav.bas (zipped). This uses these new features. You should also see "Fix:" and text for it, and the heading "arrow" should look better (you will need to change "SC5" to whatever you need, I'm using a scaler for testing).
I've also added a transmitter battery display. You will need to adjust the scaling for your battery. This is done on the first 2 lines:
const BATT_MIN 80
const BATT_MAX 104
where 80 is 8.0V and 104 is 10.4V, these are suitable for my NiMh battery. You probably need 97 and 126.

I wrote the script initially to be used as a "standalone" script, run from the main popup. This is why it accepts the EXIT button to terminate it. If running as a telemetry script, then it should not be terminated using EXIT. I've added some code to prevent this since the function sysflags() indicates how the script is running.

Mike
Inav.zip
(1.43 KiB) Downloaded 45 times
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 18124
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Scripts for ersky9x

Post by jhsa » Mon Jul 16, 2018 5:45 am

Thank you..

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

mrozilla
Posts: 60
Joined: Sat Nov 14, 2015 9:59 pm
Country: -

Re: Scripts for ersky9x

Post by mrozilla » Mon Jul 16, 2018 3:14 pm

Thank you, changelog promises to be sensational. Only in a few days I will be able to check, I will definitely test everything and write on what stage we are :)
Tell me please do I understand correctly, the script can be run in LONG MENU and then it must be in the scripts folder, but it can also be run from the telemetry screen and then the file must be in scripts / telemetry? Is it enough that it will be in one dolder and it will be possible to start it from the telemetry screen and from LONG MENU?

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

Re: Scripts for ersky9x

Post by MikeB » Tue Jul 17, 2018 1:17 pm

To run from the "LONG MENU" popup then the script must be in the "scripts" folder.
To run in a telemetry screen then the script must be in the "scripts/telemetry" folder.

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

zipray
Posts: 24
Joined: Sun Sep 04, 2016 9:05 am
Country: -

Re: Scripts for ersky9x

Post by zipray » Thu Jul 19, 2018 2:36 pm

But the telemetry panel will disappear after the restart.Must the script be reloaded every time?


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

Re: Scripts for ersky9x

Post by MikeB » Thu Jul 19, 2018 4:03 pm

From the "script.pdf" file in the first post:
"A telemetry script is selected in the custom telemetry configuration. It is loaded when the model loads and always runs unless a standalone script is run. Use the sysflags() function to detect if the custom telemetry screen is currently visible.

A standalone script is run from the main popup"

A telemetry script will be stopped while a standalone script is running, but will be reloaded when the standalone script terminates.

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

mrozilla
Posts: 60
Joined: Sat Nov 14, 2015 9:59 pm
Country: -

Re: Scripts for ersky9x

Post by mrozilla » Fri Jul 20, 2018 6:13 pm

I checked R222b4 and the latest version of the script and I can write a little:
- something is mixed with the FIX sign, at 0 it shows No (OK), with 2D shows 3D (wrong), with 3D shows DGPS (wrong), with DGPS showing 2D (wrong),

I changed a piece of code to:

gps_fix = getvalue("T2=")
drawtext(80, 16, "Fix:")
if gps_fix = 4
drawtext(104, 16, "DGPS")
elseif gps_fix = 2
drawtext(116, 16, "2D")
elseif gps_fix = 3
drawtext(116, 16, "3D")
else
drawtext(116, 16, "No")
end

And it seems that No, 2D, 3D works well, and DGPS I do not have to check, because I can not catch Fix 4.

- sometimes the arrow has too many pixels on the top by 1-2 pixels and looks like a split one, otherwise it looks good,
- with Lat and Lon there are no markings N, E, etc., you can add them, it would look better and dot after example 000.000000, additionally at Lon is shown minus (-) so instead it is better to add N, E etc.,
- sometimes on the battery bar (Batt) shows a white vertical line and I do not know if something means or is a mistake,
- the battery icon shows correctly.

Maybe now the height, speed, etc. after correcting the current errors?
The script works better and new features in b4 improve its performance :)

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

Re: Scripts for ersky9x

Post by MikeB » Fri Jul 20, 2018 10:59 pm

I've changed the "Fix" code in my copy of the script.
I need to look closely at the code that draws the lines to see why they are sometimes not quite right.
I wanted to be sure the Lat and Long were working correctly, changing how they are displayed should be fairly easy.
The "white" line on the battery bar is the minimum voltage seen.

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

mrozilla
Posts: 60
Joined: Sat Nov 14, 2015 9:59 pm
Country: -

Re: Scripts for ersky9x

Post by mrozilla » Sat Jul 21, 2018 6:37 am

@Mike

What is the Dist option and how to add it?

I do not know how I can shorten Spd kts because the letter s falls on the arrow when it is pointing to the left. Is it possible to use some other shortcut or maybe a little bit to reduce the arrow, do you have any idea for this? Or maybe you can change the speed to show in km / h?

I would like to have altitude and height above the level possible, I added the Alt and Galt options and when I have GpsAltMain selected it shows me Alt, and when I check this option, Galt shows me. I noticed that when I have GpsAltMain selected it shows me the altitude (Alt) but on the last telemetry screen it shows Galt all the time (only Galt MAX does not show), can I do so in the script also show Alt and Galt at the same time?
Last edited by mrozilla on Sun Sep 09, 2018 9:30 pm, edited 2 times in total.

vodkabears
Posts: 20
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Re: Scripts for ersky9x

Post by vodkabears » Thu Aug 30, 2018 11:40 am

Hello everyone. I'm looking for a script for ersky9x which would configure a VTX via SmartAudio/Tramp with Betaflight. Does it exist? If not I can try to write one.

P.S. If using softserial for SmartPort do I have to bridge TX and RX pins together for scripts to work or only TX pin is enough? I know It's not a Betaflight thread but maybe it's not illegal to ask here.

vodkabears
Posts: 20
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Re: Scripts for ersky9x

Post by vodkabears » Fri Sep 21, 2018 6:06 pm

Hello there
Now it's just a small script to push RSSI but I'll code a vtx control script soon.
https://github.com/vodka-bears/ersky9x- ... ht-scripts

P.S. It seems there's a bug in r221: A model script doesn't run when the radio is powered on.
P.P.S It doesn't run only if splash screen is disabled.

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

Re: Scripts for ersky9x

Post by MikeB » Sun Sep 23, 2018 8:21 pm

What radio are you using?
It sounds like a timing "problem" with the SD card not becoming ready soon enough.
Does the model script start if you change models then change back?

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

vodkabears
Posts: 20
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Re: Scripts for ersky9x

Post by vodkabears » Mon Sep 24, 2018 6:08 am

9XR-PRO. Yes, the script starts always when it's expected to, except booting without splash screen.

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

Re: Scripts for ersky9x

Post by MikeB » Tue Sep 25, 2018 1:55 pm

I have a possible fix, I need to test it.

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

vodkabears
Posts: 20
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Re: Scripts for ersky9x

Post by vodkabears » Wed Sep 26, 2018 7:01 pm

I guess it's a simple delay between power on and script start?

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

Re: Scripts for ersky9x

Post by MikeB » Thu Sep 27, 2018 12:11 am

Not quite, due to the start up skipping the splash screen and warnings when there is a watchdog restart. I have put the script loading later, and it waits for the SD card to be fully ready before starting to load scripts.

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

ludn
Posts: 2
Joined: Mon Oct 08, 2018 11:23 am
Country: -
Location: Germany, H

Re: Scripts for ersky9x

Post by ludn » Mon Oct 08, 2018 4:47 pm

—only '0' in PID-Script—
Hi,
not sure if this the right place, but at least TX-scripting did motivate me to do PID modification with Beta flight 3.5.1 (Feel free to move to the right thread or give me a hint).

To realize this, i did an update on the 9XR Pro from openTX 2.19 to Ersky9xr-pc2r222.
For testing i connect a SPF3 Evo FC via F.Port, 'Serial receiver', UART3 port assigned, to a FrSky XSR.
Solved a few issues, eg. my old XJT (2015) needed the RX/TX mod! (like the DJT) to make telemetry work.
For my understanding serial tele-data goes (sequentially mixed with S.Bus signal) via TX connector Pin 5, called S.Bus, directly to Rxd/Txd Pin on transmitter board. This makes telemetry data and PID value reading possible.

For transmission the modified PID values, i did connect the unused Pin 2 on transmitter to TX1 and setup UART1 non-inv in telemetry menu. So it's connected internally to the XJT Tele-RX via mod. See signaling when script running:
InvFPORT, PID 9XR_Pro.png
Inv F.PORT
Does this make sense? -At least RC and telemetry is working, Debug TelRxCount is counting. Tried also non-/ inverted F.PORT & settings and several diode mods, got a bit lost in hundreds of forum -mods and -sides :)

-> within PID script all values show '0' and can't be modified. Can't believe script is for multi protocol only.
Bidirectionality:
  • On flightcontroller UART3 is connected to PB10 -> so it's FW-related only
  • XSR receiver: used for F.PORT PA 13, internal N-FET-inverter-output (to Pin3, named 'S.Port') is not bidirectional, but works for both RC & telemetry, right :?:
Which PID data sequence has to be found in data stream to make sure BF is set up correctly?
Or any other hint to solve issue?
Last edited by ludn on Wed Oct 10, 2018 9:07 am, edited 1 time in total.

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

Re: Scripts for ersky9x

Post by MikeB » Tue Oct 09, 2018 12:55 pm

vodkabears wrote:
Wed Sep 26, 2018 7:01 pm
I guess it's a simple delay between power on and script start?
I've just posted test version "R222c4" that delays loading model scripts.

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

vodkabears
Posts: 20
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Re: Scripts for ersky9x

Post by vodkabears » Wed Oct 10, 2018 9:30 am

ludn wrote:
Mon Oct 08, 2018 4:47 pm
—only '0' in PID-Script—
Hi,
not sure if this the right place, but at least TX-scripting did motivate me to do PID modification with Beta flight 3.5.1 (Feel free to move to the right thread or give me a hint).

To realize this, i did an update on the 9XR Pro from openTX 2.19 to Ersky9xr-pc2r222.
For testing i connect a SPF3 Evo FC via F.Port, 'Serial receiver', UART3 port assigned, to a FrSky XSR.
Solved a few issues, eg. my old XJT (2015) needed the RX/TX mod! (like the DJT) to make telemetry work.
For my understanding serial tele-data goes (sequentially mixed with S.Bus signal) via TX connector Pin 5, called S.Bus, directly to Rxd/Txd Pin on transmitter board. This makes telemetry data and PID value reading possible.

For transmission the modified PID values, i did connect the unused Pin 2 on transmitter to TX1 and setup UART1 non-inv in telemetry menu. So it's connected internally to the XJT Tele-RX via mod. See signaling when script running:InvFPORT, PID 9XR_Pro.png
Does this make sense? -At least RC and telemetry is working, Debug TelRxCount is counting. Tried also non-/ inverted F.PORT & settings and several diode mods, got a bit lost in hundreds of forum -mods and -sides :)

-> within PID script all values show '0' and can't be modified. Can't believe script is for multi protocol only.
Bidirectionality:
  • On flightcontroller UART3 is connected to PB10 -> so it's FW-related only
  • XSR receiver: used for F.PORT PA 13, internal N-FET-inverter-output (to Pin3, named 'S.Port') is not bidirectional, but works for both RC & telemetry, right :?:
Which PID data sequence has to be found in data stream to make sure BF is set up correctly?
Or any other hint to solve issue?
You need to modify a script to get it working with FPort. Some IDs need to be changed or something. There's a very little documentation on any Frsky serial link. Try looking up to opentx lua script code.

P.S. you don't need any inversion/uninversion hacks/mods/etc. F3 flight controllers are fine with inverted signal.

ludn
Posts: 2
Joined: Mon Oct 08, 2018 11:23 am
Country: -
Location: Germany, H

Re: Scripts for ersky9x

Post by ludn » Mon Oct 15, 2018 5:01 pm

Thanks for the good hint.
Did investigate a bit further: to have telemetry in BF at all, you have to
  • set serialrx_inverted = ON, set tlm_inverted = OFF
  • (the other way round tlm works also FC feeding XSR PA13, but on S.Port it misses tlm on output. It's not used in this case, but it shouldn't be after a simpel inversion)
I Modified script and added raw logging data
FportBFm, log.zip
(5.89 KiB) Downloaded 2 times
Unfortunately i can't see MSP_PID -ID in hex code, so data is missing, inverted or is somehow corrupted:
so PIDs have to stay at '0'
Screens.png
Might start with a different receiver and classic S.BUS + UART to start with something that is intended to work.
Btw: do you use any special hex editor for framing support / analyse?

Post Reply

Return to “ersky9x”