WLToys V912/V915/? protocols
- mwm
- Topic Author
- Offline
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- SeByDocKy
- Offline
- Posts: 1016
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
case PROTOCMD_NUMCHAN: return (void *)9L;
case PROTOCMD_DEFAULT_NUMCHAN: return (void *)9L;
and
if (Channel[8] >= 0) { // 9-th channel
// Map TX value -100..100 to internal value -100..100
int scaled_value = Channel[8] * 100 / CHAN_MAX_VALUE;
int channel_of_the_bit_to_set = scaled_value / 4;
packet[6+channel_of_the_bit_to_set*2] |= 0x10 << (scaled_value % 4);
}
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
I did not move anything except to press the buttons, so I presume changes to data will show up when those are pressed (of course in addition to inits, channels, etc.). I'm purely guessing, but it looks like it binds about 3.5 seconds into the file (packet 4790?) with my V912. There are several changes in the data packets that may be helpful. Beginning packet 6304, byte 16 was 00, goes to 80, and then 40 at 7924, back to 00 at 8682. At 8506, byte 13 was DC goes to DA for about 10 packets, back to DC, then at 9826 goes to DD for the rest.
I hope this is helpful.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
I was thinking about replacing the existing WLToys mechanism with a more general one. I.e. - you either used the current WLToys V9x9 extension, which gives you the current behavior. Or you turn on the WLToys Bits (or some such name) extension, and get one where each channel sets four bits in a lower channel number. Might not be able to just mask them out, but that's the general idea.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
By the way, the code as it is written is either buggy or strange. If PROTOOPTS_WLTOYS is on, it fills out that 4 bits for channels 4-7 (zero based), BUT it already used the value of these channels to fill out corresponding bytes in the package. It is probably harmless, but weird.
For the sake of preserving compatibility you can either introduce a new option which turns on new behavior for binary channels, or keep 4 old channels fixed and make only new ones flexible.
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
I've already tweaked the code to add a second option, but it currently does nothing. I'm investigating different ways to specify the bits to set. I think I like the idea of specifying which channel to apply the bit (or maybe bits) to. That way, you only need as many extra channels as you need to set bits in, not however many it takes to get to the channel you want to set the bit it. That my V915 has channels 5, 6 and 7 in the mixer but doing nothing (and actually dangerous to turn on!) is really annoying.
Assuming that they haven't extended the values even further, so that we only have those 4 extra bits per channel, then we need 16 bits. With 8 extra channels to use, that's two bits per channel to get them all. I don't think the mixer programming will be that much worse: you need a mixer for each bit, and just use the mux type add to add them up. But trying to squeeze in 4 bits could be a problem.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
I doubt very much that you need more than 4, at most 8 such bits for a WLToys helicopter. May be my imagination fails me, but it is really really hard to control such a beast reasonably.
So what if when WLToys option is on there would be 4 "analog" channels and 8 single bit channels which can map to any of the possible 32 bits.
It is flexible and powerful enough, and does not require too much mixer/mux programming, which you need to explain to people all the time. You would need to explain it to me, even
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
I can easily seem them going past 4 extra functions - the v912/915 Tx has six buttons, their stock v9x9 tx has eight. My v323 has five extra functions (video, photo, led, flip, and headless mode*). But ... the V912 and V915 felt dated on release (4-channel FP helis with a flybar? In 2014? Really?), and it wouldn't surprise me if they are the last of the FlySky protocol 'copters from WLtoys.
So I'm looking at three possible options:
First, after figuring out what bits turn on the extra functions, and just add three channels to the WLToys options for them. With GREAT BIG WARNINGS that turning on the V9x9 options on a V91x can be dangerous.
Once you get beyond "channel X turns on/off feature Y", explaining it becomes an issue. Telling someone "turn on bit 2 in channel 3" doesn't really help someone who wants to turn off the lights!
The easiest second is the one I first proposed. Channel 5 sets bits in channel 1. We just grab the bits directly, with values of 0-15 corresponding to the nibble being 0-15, and so on. So the current system would have mixers that set So for the V959, we'd have two mixers on channel 6 with fixed values of 4 & 8, the first of which was the video control, and the second of which took a photo. But we'd need to keep a document somewhere of what all the bits in the WLToys models did.
The last option is basically the code you presented on any channels beyond 4, except that instead of treating the channel value as a channel number & bit offset, you treat it as a channel number & the bits above.
Hmm. I think I just decided to go with option 2, at least for now, as that requires the least perturbation to the existing code. Option 1 may still be preferable. Or maybe both, by adding the bits discovered with the new value for the WLToys option to the old code as well.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
Note 1: this is a build based on the latest team nightly build. Please install the file system as well as the DFU. If you've been running 4.0.1, you'll have to edit hardware.ini, not tx.ini, to enable your extra modules.
Note 2: This will turn the WLToys options OFF on all existing FlySky protocol models. Set it to V9x9 to get the old behavior.
The new feature is that the WLToys option now has two settings, "v9x9" which has the old code in it, and "Bits", which is the new behavior. The new code takes the value of channels 5-8, divides by 10, throws out the high order bits, and then ors those into the appropriate parts of channels 1-4, respectively.
The v959 model works properly for lights and camera control. I can't test flip, as my v959 hasn't been flight-worthy in quite a while (it's actually in pieces for another project). Camera control uses mix0 and mix2 to toggle video & photo modes. Lights are on GEAR1, and flip is on FMOD1. Note that these may need to be toggled on/off to trigger the device they control.
Here's my channel 8, done as three mixes so it's clear what's going on:
[channel8]
template=complex
[mixer]
dest=Ch8
scalar=0
curvetype=fixed
[mixer]
dest=Ch8
switch=FMODE1
scalar=10
usetrim=0
curvetype=fixed
[mixer]
dest=Ch8
switch=GEAR1
scalar=20
usetrim=0
muxtype=add
curvetype=fixed
All the curves are fixed. We set the output to 0 in the first mixer, so everything is off by default. The second mixer, enabled by FMOD1, sets the output value to 10, which is flip mode. The third mixer uses an add mux to add the value of 20, for the lights.
The V915 uses the same two values in channel 8 for it's lights and "turbo" mode, except they are backwards: turbo uses 20, and the lights use 10. I managed to not notice that turbo was being enabled before, so we only need to find the camera control buttons on the V912.
I would be very surprised if they are set via channel 7. Don't test it until after you've exhausted 5, 6 and the other two values (40 and 80) for 8. And before you do, take the blades off your propeller.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
victzh wrote: As follows from @Deal57 SPI traces these new bits go into protocol's channel 6 (1-based). The bitmask values are 0x40 and 0x80. How is it expressed in your notation?
Not possible with the current code. I've attached a dfu that extends the "extra" channels from 8 to 10. With it, you set channel 10 to 40 or 80 to get either bit, and make sure that channel 6 has a mix type of None.
It looks like they just moved the camera from channel 3 to channel 6. But both variations on the WLToys extension already use channel 6 to carry bits that get sent to other channels.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
Of course, we have no evidence that we need to cover more than 24 bits, as we haven't seen them set bits in channels 7 and 8 yet. Unless you've got an intuitive solution, I'm in favor of just adding channels 9 & 10 to the existing set of four, and document that turning on channels 6 and 7 on the V912/V915 is bad for the health of your model and you.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
The mode I set up isn't that painful. The bits for a channel are in the channel 4 above it, which should be unused. To add 0x10 to the channels control bits, you add 10 to the channel above it. I think it's worthwhile if it means we can get all the bits without any oddities.
But if they're using channel 6, that an oddity - you wind up adding control bits to a channel used for adding control bits! So lets just add channels for the two new controls so users don't have to worry about bits and which channel goes where, etc.
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- WLToys V912/V915/? protocols