Scripts for ersky9x
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
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.
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
Hi,
Thanks for the version.
Tested, but is not working ,the same problem nothing on PID/VTX screen.
Thanks for the version.
Tested, but is not working ,the same problem nothing on PID/VTX screen.
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
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.
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 442 times
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
Any chance you could pin down where, between "a5" and "d2" your problem started?
Mike
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
a1,a5 working......a6,a7,a8,a9 .....not working
between a5 and a6
between a5 and a6
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
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.
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.
Re: Scripts for ersky9x
nevermind
Last edited by midelic on Fri Dec 14, 2018 3:34 pm, edited 1 time in total.
Re: Scripts for ersky9x
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.
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.
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 47
- Joined: Thu Aug 23, 2018 5:37 am
- Country: Russian Federation
- Contact:
Re: Scripts for ersky9x
So, is the problem in test ersky9x versions or in the script code?
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
Trying to work that out!
Mike
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
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]
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.
Re: Scripts for ersky9x
nevermind
Last edited by midelic on Sun Dec 16, 2018 1:32 am, edited 4 times in total.
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
Ahh you are right....code leftovers.
I removed that troublesome array.Now I revert back to byte array and working ok.
Thanks again.
I removed that troublesome array.Now I revert back to byte array and working ok.
Thanks again.
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
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!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 47
- Joined: Thu Aug 23, 2018 5:37 am
- Country: Russian Federation
- Contact:
Re: Scripts for ersky9x
I did a VTX script earlier but nevermind, you rock.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]
https://github.com/vodka-bears/ersky9x- ... ht-scripts
-
- Posts: 10
- Joined: Fri Dec 28, 2018 8:42 pm
- Country: -
Re: Scripts for ersky9x
are there any scripts for the crossfire micro (bind / power out mainly?)
Re: Scripts for ersky9x
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.
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.
- MikeB
- 9x Developer
- Posts: 17996
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Scripts for ersky9x
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
Mike
- Attachments
-
- bf_vtx.zip
- (4.45 KiB) Downloaded 420 times
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Scripts for ersky9x
Thanks Mike, I'll do a test tonight!
Re: Scripts for ersky9x
Hey Mike, is there any github repository for the scripts? Just in case if I can contribute/fix something. Cheers.