Scripts for ersky9x

ersky9x is a port of er9x for use on the sky9x board.
User avatar
MikeB
9x Developer
Posts: 16050
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 62 times
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 18378
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: 16050
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: 16050
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: 16050
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: 32
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: 32
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: 16050
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: 32
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: 16050
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: 32
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: 16050
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: 6
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: 16050
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: 32
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: 6
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 11 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 primary worked?
Btw: do you use any special hex editor for framing support / analyse?

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

Re: Scripts for ersky9x

Post by ludn » Tue Oct 23, 2018 4:05 pm

(kind of good) news:
PID-script does not work on SBUS + UART either, all values are '0'.
Checked with X4R SB receiver with newest FW.

Wondering what's wrong with my setup or what did change, cause actual betaflight-ids are considered.
► Show Spoiler
Where is the hook when RC & telemetry is working fine?
SBUS 2018-10-23-173724.zip
(1.53 KiB) Downloaded 8 times

Can someone sketch his working setup (which BF-version & -setting, used FC-ports, transmitter modul)?

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

Re: Scripts for ersky9x

Post by vodkabears » Tue Oct 23, 2018 5:34 pm

ludn, do you have any telemetry working besides RSSI (FasV, A4, Alt, etc)? Try wiring SmartPort to TX3, not RX3. Remember thar UART3 must be used only with SmartPort, it can't be shared with anything else.

I modified PID script so now it works with FPort. I'll commit/push it to my github as soon as I finish with VTX script. Sorry for a long silence, I waited for a new FC since the old one had been fried.

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

Re: Scripts for ersky9x

Post by vodkabears » Tue Oct 23, 2018 6:36 pm

Hello everyone. I updated my github (https://github.com/vodka-bears/ersky9x- ... ht-scripts), I added VTX control script (needs testing with Tramp and RTC6705) and now all my scripts support FPort.

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

Re: Scripts for ersky9x

Post by ludn » Wed Oct 24, 2018 7:11 am

hi, thanks for provide script-mod.
yeah: FasV, A4, Alt etc. are working (should work simultaneously to PIDs?).

But changed to TX3-pin they are not. Thus TelRxCount is still counting in Debug Menu and some static raw data.
Than there is also no complain about missing tlm within script.
UART3 is not shared in BF settings and should not be on FC either.
Will check different UART and other FC..

Can you share your raw debug data or give a hint what data stream it has to contain?

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

Re: Scripts for ersky9x

Post by vodkabears » Thu Oct 25, 2018 5:08 am

To be honest, I don't know how to log a UART and have no single idea what datastream has to contain. I used subroutines ported from opentx lua script by midelic. There's no documentation on MSP-SmartPort link and I can't grasp it from the code. I can take a picture of a debug screen (I haven't changed it in a PID script). BTW, I had a similar problem with XSR-M and Omnibus F4, but it has been fixed on its own.
P.S. Yes, if you get telemetry from your FC, scripts should work.
P.P.S. I had 2 working setups. One is 'PRO, XJT, XSR-M, clone of Omnibus F4 (RIP), Betaflight 3.5.1, softserial tx on ppm5. The 2nd (current) is the same radio, XSR-M flashed with FPort firmware (that's why I was able to add FPort support), NEWF7 V1(Banggood), Betaflight 3.5.1, tx6, serialrx_inverted = ON.

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

Re: Scripts for ersky9x

Post by ludn » Thu Oct 25, 2018 5:15 pm

cheers, this is helpful.
I have more and more the feeling, both all-in-one cube FCs have got an UART conflict on board caused by these numerous peripheral components.
Unfortunately i have no circuit diagram, so have to reverse-engineer this stuff to be clear.

Logging on TX -i found here in forum- is quite simple:
  1. Telemetry/logging/log: switch set eg. 'THR', (timeout, new file, etc. can be also set here)
  2. In Debug menu (9/13), long press 'menu" to get '(x) Raw' format (to be repeated at each TX startup)
  3. to start log: activate the defined switch, inverted 'L' appears on LCD. Files are found on SD/logs/*.raw
I found it also helpful having the checkboxes in telemetry menu (scrolling down), informing live about each updated parameter

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

Re: Scripts for ersky9x

Post by vodkabears » Sat Oct 27, 2018 8:39 am

Here's my raw log: https://drive.google.com/open?id=1A6FWH ... CTPTMylYWM
According to CSV log logging stopped when I ran a script. I don't know what's in the raw log so this might help.
First I ran a PID script, changed Roll P drom 46 to 47, saved, then back to 46, saved. After that it I ran a vtx script, changed channel from R5 to R6, set, refreshed, changed back to R5, saved. Finally i closed a script and flipped the logging switch off.
P.S. My rx is connected to fc via FPort.

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

Re: Scripts for ersky9x

Post by ludn » Mon Oct 29, 2018 4:41 pm

Now it's clarified, i can see the data difference in the logs and in the BF-source code it's confirmed:
USE_MSP_OVER_TELEMETRY is disabled in this BF-build!
Thanks, for your help!

User avatar
midelic
Posts: 88
Joined: Mon Dec 23, 2013 9:57 pm
Country: -

Re: Scripts for ersky9x

Post by midelic » Tue Dec 11, 2018 4:25 am

Mike,
I tried to change PID's and VTX(basic script) using multiprotocol last code(Sport polling activated) and ersky9x last code and I did not receiving anything, all values were zero.
I went down with testing and found that last ersky9x version working with multi(changing PID's) is ersky9xProvR222a5.Any version after that is not working with multi when tried to change PID/VTX.However ,the generic telemetry(RSSI SWR,A1) is working ok.
I have 9xpro TX with multimodule.Can you test, maybe missed something.

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

Re: Scripts for ersky9x

Post by MikeB » Tue Dec 11, 2018 3:30 pm

I'll look into it over the next couple of days. I didn't get a response from a S8R using Multi, so I think I'll know when I've fixed it.

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

Post Reply

Return to “ersky9x”