Scripts for ersky9x

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
User avatar
MikeB
9x Developer
Posts: 16622
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Scripts for ersky9x

Post by MikeB » Tue Dec 11, 2018 5:00 pm

I re-compiled for the 'PRO, and now I'm getting a response from the S8R using FrSkyX and Multi, it just started working again.
I'll try to post a "R222d3" test version either late today or tomorrow.
You could try creating a "raw log file" to see if PID data is getting back to the 'PRO, but not getting to the script.

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


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

Re: Scripts for ersky9x

Post by MikeB » Tue Dec 11, 2018 11:20 pm

I'm not sure what the problem is. I just flashed "R222d2" test version to my 'PRO and it reads the configuration data from a S8R using both the built in SxR menu and the SxR script. Tested using FrSkyX in Multi, international firmware on the S8R, V1.2.0.26 firmware on an external STM Multi module with telemetry on the SPort.

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

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

Re: Scripts for ersky9x

Post by midelic » Tue Dec 11, 2018 11:46 pm

Nah tested again with d2 not working, but working with a5 and lower.I received sport frames like acc data or fasv from betaflight so sport frames are received.When changing PID ,the TX script sent some request frames to betaflight, so I think the send part not working..As I said I used it with the last multi firmware V1.2.1.23.My multimodule has an inverter with 2 transistors(not the commercial module),maybe this could be a problem but I did not have problems before, until I updated ersky9x with the last firmware so I assumed the problem might be with new ersky9x firmware.

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

Re: Scripts for ersky9x

Post by MikeB » Wed Dec 12, 2018 5:36 pm

I think the only change in this area is the timing of when the SPort serial port is changed from input to output. There used to be a 600uS delay with multi after detecting the 7e and physical ID polling for SPort data, with the data transmission starting immediately after that. Now, the signal is changed to output immediately, with the data starting 600uS after that. This allows a line marking state to exist for a significant time to ensure the start bit is seen correctly.
I'll see if I can build you a test version without this change to see if that is your problem.

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

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

Re: Scripts for ersky9x

Post by MikeB » Wed Dec 12, 2018 9:15 pm

I've posted a test version for you to try, it delays signal reversing by the 600uS, but this doesn't work on my 'PRO, so isn't a fix that may be added permanently.

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


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

Re: Scripts for ersky9x

Post by midelic » Wed Dec 12, 2018 11:19 pm

Hi,
Thanks for the version.
Tested, but is not working ,the same problem nothing on PID/VTX screen.

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

Re: Scripts for ersky9x

Post by MikeB » Wed Dec 12, 2018 11:40 pm

Please create a raw log file so I can try to see if the problem is sending the request or receiving the response. I don't know if you could put a logic analyser on the SPort signal to see what is happening.
Are you testing the return value from "sportTelemetrySend" to see if your requests are being sent?

I just tested the "normal" code with a Jumper module and that is working OK with a S8R.

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

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

Re: Scripts for ersky9x

Post by midelic » Thu Dec 13, 2018 3:05 am

Hi see the raw files.It seems that some frames are not received,I see received one frame but not the consecutive ones.Out frames are with 7E;0D;30(FF )and In frames are with 7E;1B;32;counter(frame counter incremented in consecutive frame).Betaflight send back consecutive frames for all PID data.
Attached 2 versions with version a5(working) and version d2 (not working).

Could it be possible that basic syntax is changed from ersky9x version a5 to version d2.
Attachments
raw_files.zip
(11.4 KiB) Downloaded 21 times

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

Re: Scripts for ersky9x

Post by MikeB » Thu Dec 13, 2018 5:13 pm

I continuing to investigate. I find that "A5" doesn't work with my STM module, I'll see if I can pin down what changed.

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

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

Re: Scripts for ersky9x

Post by MikeB » Thu Dec 13, 2018 7:04 pm

Any chance you could pin down where, between "a5" and "d2" your problem started?

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

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

Re: Scripts for ersky9x

Post by midelic » Thu Dec 13, 2018 10:32 pm

a1,a5 working......a6,a7,a8,a9 .....not working
between a5 and a6

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

Re: Scripts for ersky9x

Post by MikeB » Thu Dec 13, 2018 11:13 pm

I'm also wondering if your inverters are causing problems. I note your raw log files have 0xFF bytes in them. This suggests to me you have spurious start bits occurring. I had problems with "noise" bytes, which is why I did some of the changes to prevent them.
The SPort hardware implementation is for inverted serial, with the signal line pulled to ground (marking) using a resistor when not driven. I suspect your hardware is pulling the line high (spacing/start bit) when not driven.
With my STM module, I don't get any 0xFF bytes. I may get some line break characters resulting in a 0x00 byte, but I discard these.

Is there any chance you could change your hardware inverter to allow the signal to idle low? Possibly using a PNP transistor instead of a NPN one.

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

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

Re: Scripts for ersky9x

Post by midelic » Fri Dec 14, 2018 12:49 pm

My inverted is with bipolar transistors the one below.
https://github.com/TauLabs/TauLabs/wiki ... -telemetry

I will hook up an analyzer see what is happening.
I remember when I tested before multi code with this inverter have no FF bytes so maybe code in multi is changed is pulling high the sport pin.

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

Re: Scripts for ersky9x

Post by midelic » Fri Dec 14, 2018 2:36 pm

nevermind
Last edited by midelic on Fri Dec 14, 2018 3:34 pm, edited 1 time in total.

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

Re: Scripts for ersky9x

Post by midelic » Fri Dec 14, 2018 3:33 pm

I think the previous files sent were corrupt so the analysis was not correct.
see new ones
I see an error in the frame.0x70,0x70(a5) correct
0x7E,0x0D,0x30,0x34,0x00,0x70,0x70,0x00,0x00,0xBA,
versus
a6-0x70,0x00-wrong
0x7E,0x0D,0x30,0x32,0x00,0x70,0x00,0x00,0x00,0x2D,

request PID code is 112(0x70)

Typical request PID frames examples
7E D 30 32 0 70 70 0 0
7E D 30 3B 0 70 70 0 0

Maybe basic syntax is changed between versions.
I think the payload crc in script calculation is changed.
I have these lines in the script

**************************************************
i = 2
while i <= 6
rem --- payloadTx[2]=payload size
payloadTx = mspTxBuf[mspTxIdx]
mspTxIdx = mspTxIdx + 1
mspTxCRC ^= payloadTx
i = i + 1
if mspTxIdx > t_size
goto break1
end
end



break1:
if i <= 6
payloadTx = mspTxCRC
i = i + 1
rem --- zero fill
while i <= 6
payloadTx = 0
i = i + 1
end
gosub mspSendSport
**************************************************

the values are calculated
payloadTx[3]=112(0x70)
payloadTx[4]= mspTxCRC=112(0x70)
the rest are zero
value = payloadTx[3] + payloadTx[4] * 256 + payloadTx[5] * 65536 + payloadTx[6] * 16777216

edit:
Solved the problem.The script language array declaration was changed.
The problem was in array declaration 8 bits array versus 32 bits.
array byte payloadTx[7](not working)
versus
array payloadTx[7](working)

Now is working ok with last version 222d2
Thanks for your patience.
Attachments
a5_1.txt
(137.87 KiB) Downloaded 24 times
a6_1.txt
(136.42 KiB) Downloaded 25 times

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

Re: Scripts for ersky9x

Post by MikeB » Sat Dec 15, 2018 12:06 am

I'm trying to understand why "array byte payloadTx[7]" doesn't work. It seems the CRC value is being calculated incorrectly.
I have the script as stored at www.er9x.com, which doesn't look quite the same as the code you show above, there is an subscript on "payloadTx":
i = 2
while i <= 6
rem --- payloadTx[2]=payload size
payloadTx = mspTxBuf[mspTxIdx]
mspTxIdx = mspTxIdx + 1
mspTxCRC ^= payloadTx
i = i + 1
if mspTxIdx > t_size
goto break1
end
end

break1:


if i <= 6
payloadTx = mspTxCRC
i = i + 1
rem --- zero fill
while i <= 6
payloadTx = 0
i = i + 1
end

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

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

Re: Scripts for ersky9x

Post by vodkabears » Sat Dec 15, 2018 6:40 am

So, is the problem in test ersky9x versions or in the script code?

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

Re: Scripts for ersky9x

Post by MikeB » Sat Dec 15, 2018 11:11 am

Trying to work that out!

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

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

Re: Scripts for ersky9x

Post by midelic » Sat Dec 15, 2018 2:20 pm

The script code is hosted at
https://github.com/midelic/Ersky9x-Tx-bas-scripts

Actually that was an example with array payloadTx[7] I did not bother check individually(edit:checked not working all need to change).
and I did changed to 32 bits for all arrays and tested ok.

from
array byte payload[7]
array byte payloadTx[7]
array byte payloadReq[32]
array byte values[32]
array byte values_pid[32]
array byte values_rates[32]
array byte value[32]


to
array payload[7]
array payloadTx[7]
array payloadReq[32]
array values[32]
array values_pid[32]
array values_rates[32]
array value[32]
Last edited by midelic on Sat Dec 15, 2018 6:56 pm, edited 2 times in total.

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

Re: Scripts for ersky9x

Post by midelic » Sat Dec 15, 2018 2:34 pm

nevermind
Last edited by midelic on Sun Dec 16, 2018 1:32 am, edited 4 times in total.

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

Re: Scripts for ersky9x

Post by MikeB » Sat Dec 15, 2018 9:49 pm

I've found out why your script failed when using byte arrays.
You declare:
array byte value[32]
but never use it. however, you also have:
value = payloadTx[3] + payloadTx[4] * 256 + payloadTx[5] * 65536 + payloadTx[6] * 16777216

A change I put in when going from "a5" to "a6" was to allow an array to be referenced by name only, with an explicit subscript of 0. I added this so those functions that take an array as a parameter (e.g. strtoarray( array, "text")), could be written with just the arra name instead of needing arrayname[0].
As a result, your line starting "value =" is actually using the first element if the "array byte value[32]", which is only a byte (ends up as "value[0] =").

You script should therefore work with byte arrays, but either remove the "array byte value[32]" declaration, or use a different name for value for the payload total.

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

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

Re: Scripts for ersky9x

Post by midelic » Sun Dec 16, 2018 12:47 am

Ahh you are right....code leftovers.
I removed that troublesome array.Now I revert back to byte array and working ok.

Thanks again.

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

Re: Scripts for ersky9x

Post by MikeB » Sun Dec 16, 2018 11:27 am

Nothing wrong with your script code, but in a number of places you have something like:
i = i + 1
It is more efficient, for both code size and execution, if you use:
i += 1
which you do use in some places.
This is particularly significant for:
payloadTx[1] = payloadTx[1] + SPORT_MSP_STARTFLAG
when you would avoid indexing the array twice.

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

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

Re: Scripts for ersky9x

Post by MikeB » Tue Dec 18, 2018 9:36 am

One other change worth considering is when using constant values. Currently you have a number of variables initialised to constants, e.g.:
SPORT_MSP_VERSION = 32
These could be replaced by constant definitions:
const SPORT_MSP_VERSION 32
This removes each item from using RAM for the variable storage, together with the code, when executing, that initialises them.

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

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

Re: Scripts for ersky9x

Post by vodkabears » Thu Dec 27, 2018 10:13 am

midelic wrote:
Sat Dec 15, 2018 2:20 pm
The script code is hosted at
https://github.com/midelic/Ersky9x-Tx-bas-scripts

Actually that was an example with array payloadTx[7] I did not bother check individually(edit:checked not working all need to change).
and I did changed to 32 bits for all arrays and tested ok.

from
array byte payload[7]
array byte payloadTx[7]
array byte payloadReq[32]
array byte values[32]
array byte values_pid[32]
array byte values_rates[32]
array byte value[32]


to
array payload[7]
array payloadTx[7]
array payloadReq[32]
array values[32]
array values_pid[32]
array values_rates[32]
array value[32]
I did a VTX script earlier but nevermind, you rock.
https://github.com/vodka-bears/ersky9x- ... ht-scripts

agarabaghi
Posts: 10
Joined: Fri Dec 28, 2018 8:42 pm
Country: -

Re: Scripts for ersky9x

Post by agarabaghi » Sat Jan 05, 2019 1:37 pm

are there any scripts for the crossfire micro (bind / power out mainly?)

voland
Posts: 13
Joined: Tue Jan 15, 2019 8:50 pm
Country: -

Re: Scripts for ersky9x

Post by voland » Tue Jan 15, 2019 9:16 pm

Hi there, is there any script for VTX that works on Taranis X7?

I've logged several issues that they do no work on X7, nobody replied:

https://github.com/midelic/Ersky9x-Tx-b ... s/issues/1
and
https://github.com/vodka-bears/ersky9x- ... s/issues/1

Is this a dead functionality, is anyone supporting it?
Cheers.

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

Re: Scripts for ersky9x

Post by MikeB » Wed Jan 16, 2019 6:53 pm

I've done a couple of edits so the encoder works as well as the up/down buttons, so this might be better on the X7. I don't have any betaflight hardware so I can't test this very much, but you are able to select between Set and Reload on the menu.

Mike
Attachments
bf_vtx.zip
(4.45 KiB) Downloaded 38 times
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

voland
Posts: 13
Joined: Tue Jan 15, 2019 8:50 pm
Country: -

Re: Scripts for ersky9x

Post by voland » Wed Jan 16, 2019 9:24 pm

Thanks Mike, I'll do a test tonight!

voland
Posts: 13
Joined: Tue Jan 15, 2019 8:50 pm
Country: -

Re: Scripts for ersky9x

Post by voland » Wed Jan 16, 2019 11:17 pm

Hey Mike, is there any github repository for the scripts? Just in case if I can contribute/fix something. Cheers.


Post Reply

Return to “erskyTx (was ersky9x)”