Skip to content

Conversation

@McGiverGim
Copy link
Member

Adds an VTX tab to control the VTX and populate the VTX Table. To go with: betaflight/betaflight#8693

This PR is not finished, it needs some refactor and some little changes, but is at 99% almost done. It has been opened to discuss some things:

  1. Now, the tab only appears for Betaflight 4.1, but the code to make it work in Betaflight 4.0 (or earlier) is almost there if we want to give support because the VTX Table is conditional at compilation so I needed to take it into account.
  2. The tab is divided into two, the upper part can be used in older Betafligth versions but it can be used too in 4.1 when there is no vtx table support.
  3. In the upper right there is a box with general info that is valid always.
  4. Flag vtxtype unknown, vtxtype not supported. We want to show the tab only with the general info and with a message that VTX not valid? Or we prefer to hide the tab?
  5. Flag vtxtables not supported. We want to show the tab only with the upper part giving some functionality or hide the tab?

image

@McGiverGim
Copy link
Member Author

McGiverGim commented Aug 9, 2019

Little reordering of fields, I think is uglier, but now is like the output of vtxtable:

image

@Docteh
Copy link
Contributor

Docteh commented Aug 9, 2019

Does this get us the ability to configure everything VTX related within the configurator?

Would the VTX tab showing up be conditional on a port specifying either Smart Audio or Tramp? If that is the case we might want to have the ports information grabbed on connect

@McGiverGim
Copy link
Member Author

Yes, that's the idea. Configure all the VTX from within the Configurator.
About it showing up, is the decision that has to be made.

@mikeller
Copy link
Member

This looks good, thank you very much @McGiverGim.

I think we should also look into adding a way to easily load a set of values into this tab from a file / snippet, so that manufacturers can publish VTX tables suitable for their hardware.

@McGiverGim
Copy link
Member Author

Yes, my idea is add later a wizard that adds sample values to all fields. But I prefer to do it in a later PR.

@mikeller
Copy link
Member

mikeller commented Aug 10, 2019

Yes, my idea is add later a wizard that adds sample values to all fields.

As in 'sample values loaded from a file'?

We have to avoid putting any 'default' or 'sample' values into the firmware or configurator, as this will open us up to being accused of enabling users to break the law, and potentially be banned from distribution.

@McGiverGim
Copy link
Member Author

Yes, that is the reason why I didn't add them here. I prefer to discuss later which is the best way to do it.

My idea was to add a wizard, where the user can select the "sample" bands to use, and the wizard will complete the VTX Table, showing a message that "the user must verify that the bands are valid for the country and adjust them to the law before saving". But as I say, is better to discuss it. We have samples too in the VTX Table wiki page, so I don't think this is very different for that.

@Docteh
Copy link
Contributor

Docteh commented Aug 12, 2019

Well, with the samples over on the wiki, a user has to leave the configurator and go over there.

I can kind of see this going both ways, if its made too difficult to get the right sort of information, users will end up just internet searching the best thing to shove in, which might have all channels unlocked.

It sounds like FCC and CEPT might have clear limitations, the thing to avoid would be a third option that just unlocks everything.

If we get a nastygram on a wiki page, we just have to remove/correct some information, correcting a configurator would be a little more work.

@McGiverGim
Copy link
Member Author

Force pushed changes:

  • Fixed code as per review
  • Modified with MSP changes in the PR of firmware part
  • Hide the tables and show a warning note when vtx not supported or unknown.
  • Little corrections in CSS and HTML.

I think is more or less ready to go. Any remaining detail can be fixed later if needed.

@McGiverGim
Copy link
Member Author

Rebased too with latest master...

@McGiverGim
Copy link
Member Author

Pushed a little update: animated the hide and show of the frequency vs channel/band selection. It seems to me that it was too hard the change :)

@etracer65
Copy link
Member

Was doing some testing this morning and there are some problems with how the "Enter frequency directly" logic is working. The logic is that if band > 0 and frequency > 0 then we're in "enter directly" mode. Otherwise we're in band/channel mode.

The data that's being sent in MSP_SET_VTX_CONFIG needs to follow this as well so the firmware knows how to behave. So if in "enter directly" mode then band must be 0.

@etracer65
Copy link
Member

Also I pushed a small fix to the MSP PR that properly does the frequency lookup based on the supplied band/channel. Nothing that affects your changes - just fixes the display only the right panel after a save so the frequency displays the actual value rather than 0. Previously required a reboot to get the frequency set properly.

@etracer65
Copy link
Member

Finally, one cosmetic suggestion. It loos like the band and channel count entries could be located on the same row to save a little vertical space.

@McGiverGim
Copy link
Member Author

Was doing some testing this morning and there are some problems with how the "Enter frequency directly" logic is working. The logic is that if band > 0 and frequency > 0 then we're in "enter directly" mode. Otherwise we're in band/channel mode.

Did you mean band = 0 and frequency > 0? If not I don't understand that.

Finally, one cosmetic suggestion. It loos like the band and channel count entries could be located on the same row to save a little vertical space.

Yes, and the power level too, but this breaks a little the fields size aesthetic of all the tab and it will not serve as nothing, the table will end using the same space: the VTX Table has more width than the mode selection table, and we have the status table in the right. I can't move up the VTX Table because it will go over the status. So is better than the mode table has a similar height than the status table from a design point of view.

@etracer65
Copy link
Member

Yeah, sorry. I meant band == 0 && frequency > 0. I originally wrote it the reverse describing band/frequency mode and then edited it incorrectly to describe "direct entry" mode.

@etracer65
Copy link
Member

I was referring to the band/channel counts in the VTX Table section at the bottom.

@McGiverGim
Copy link
Member Author

Yeah, sorry. I meant band == 0 && frequency > 0. I originally wrote it the reverse describing band/frequency mode and then edited it incorrectly to describe "direct entry" mode.

Then maybe I have a bug that I can't see. This is what I tried to do here:

let frequencyEnabled = $("vtx_frequency_channel").prop('checked');
if (frequencyEnabled) {
VTX_CONFIG.vtx_frequency = parseInt($("#vtx_frequency").val());
VTX_CONFIG.vtx_band = 0;
VTX_CONFIG.vtx_channel = 0;
} else {
VTX_CONFIG.vtx_band = parseInt($("#vtx_band").val());
VTX_CONFIG.vtx_channel = parseInt($("#vtx_channel").val());
VTX_CONFIG.vtx_frequency = 0;
if (semver.lt(CONFIG.apiVersion, "1.42.0")) {
if (VTX_CONFIG.vtx_band > 0 || VTX_CONFIG.vtx_channel > 0) {
VTX_CONFIG.vtx_frequency = (band - 1) * 8 + (channel - 1);
}
}
}

When the direct frequency is enabled, I put the band and channel to zero. If channel/frequency mode enable, I put the frequency to zero except if firmware is less that 1.42, then the frequency has the codification of band and channel.

If you have found a bug that I can reproduce please describe the steps.

@etracer65
Copy link
Member

First test:

Set up some value vtx table info - doesn't really matter what. I used:

# vtxtable
vtxtable bands 5
vtxtable channels 8
vtxtable band 1 BOSCAM_A A CUSTOM  5865 5845 5825 5805 5785 5765 5745 5725
vtxtable band 2 BOSCAM_B B CUSTOM  5733 5752 5771 5790 5809 5828 5847 5866
vtxtable band 3 BOSCAM_E E CUSTOM  5705 5685 5665 5645 5885 5905 5925 5945
vtxtable band 4 FATSHARK F CUSTOM  5740 5760 5780 5800 5820 5840 5860 5880
vtxtable band 5 RACEBAND R CUSTOM  5658 5695 5732 5769 5806 5843 5880 5917
vtxtable powerlevels 3
vtxtable powervalues 25 200 400
vtxtable powerlabels 25 200 500

Then in CLI set it up for a manual frequency:

set vtx_band = 0
set vtx_freq = 5800

After saving and going back to the tab it will have:

Screen Shot 2019-08-13 at 9 46 20 AM

@etracer65
Copy link
Member

Next test: Start with the same config but this time set the band and channel like:

set vtx_band = 5
set vtx_channel = 1

(or use the Configurator tab).

The tab will be correct and look like this:

Screen Shot 2019-08-13 at 9 49 41 AM

Then change to a manual frequency using the switch and try to set to 5800 like this:

Screen Shot 2019-08-13 at 9 50 36 AM

Then save and the settings will revert back to the band/channel setup.

@McGiverGim
Copy link
Member Author

If you are referring at the state of the switch, I don't have a manner to know if the values that I'm reading are from a frequency or from a band/channel selection. I can modify it "remembering" the latest state, but nothing more. Is that what you suggest?

@etracer65
Copy link
Member

If you are referring at the state of the switch, I don't have a manner to know if the values that I'm reading are from a frequency or from a band/channel selection. I can modify it "remembering" the latest state, but nothing more. Is that what you suggest?

When you read the settings from MSP_VTX_CONFIG, if band == 0 and frequency > 0 then the "enter directly" switch should be selected. Otherwise not and the user has to enter band and channel. So no, not remembering from client side. Basing it on the state of the settings.

@McGiverGim
Copy link
Member Author

Sorry for the two forces, in the first there were some code that I don't wanted to push.

@etracer65 Fixed the problem, there was a bug in the set part.

Another think: the frequency value comes with zero when there is a band/channel selected. I can see it at the status in the right. It will not be interesting to populate it with the real frequency from the table? If yes, this can be done in the firmware part or the Configurator part.

@etracer65
Copy link
Member

Another think: the frequency value comes with zero when there is a band/channel selected. I can see it at the status in the right. It will not be interesting to populate it with the real frequency from the table? If yes, this can be done in the firmware part or the Configurator part.

That's already fixed and is the update to the MSP PR that I mentioned earlier today.

@McGiverGim
Copy link
Member Author

Perfect then! We are ready to go with a first version :)

@etracer65
Copy link
Member

Just tested the "direct entry" vs. the band/channel entry and it now looks good. The cosmetic improvement I was referring to was this:

Screen Shot 2019-08-13 at 12 28 31 PM

Seems like we could put these both on the same row and save a little vertical space.

@McGiverGim
Copy link
Member Author

Sorry for the late response, I didn't have time before. Implemented the @etracer65 suggestion:
image

Copy link
Member

@mikeller mikeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, and works well, thank you very much.

One thing that needs to be fixed is that it should not be possible to set Band / Channel in 'Selected Mode' to a combination if the corresponding field in the VTX table contains 0 It is probably easiest if we use a drop down for the 'Channel' setting to make this possible.

I like how the sections are arranged in the tab. But I think that, because the 'VTX Table' section is below the 'Selected Mode' section, it is not obvious to users that they first need to configure 'VTX Table' before they can configure 'Selected Mode'. I think to make it easier for users to realise this, it would be helpful if we showed a note about this at the top of the 'Selected Mode' section whenever the 'VTX Table' section is unconfigured.

@McGiverGim
Copy link
Member Author

One thing that needs to be fixed is that it should not be possible to set Band / Channel in 'Selected Mode' to a combination if the corresponding field in the VTX table contains 0 It is probably easiest if we use a drop down for the 'Channel' setting to make this possible.

Do you want that this works against the stored VTX Table or against the "live" vtx table? Now, the upper table works against the stored values, I can change it to make it work against the "live" table, but the values of the upper table must be sent before the new vtx table, so I don't think if it has sense. It will be enough to filter against the stored VTX Table of do I change it to be against the "live" table?

I think to make it easier for users to realise this, it would be helpful if we showed a note about this at the top of the 'Selected Mode' section whenever the 'VTX Table' section is unconfigured.

Ok, I will add it.

@mikeller
Copy link
Member

One thing that @etracer65 suggested was to, instead of limiting the choices for band / channel selection, show a warning informing users that the band / channel they selected was disabled - this would be easy to be made to work against the to be stored VTX table, and it would work for what we want.

@McGiverGim
Copy link
Member Author

I'm not too sure how to implement that, to me is the same. If I verify if the band/channel exist to show a warning, I must do it against the stored or the live table.

Maybe are you talking about:

  • Let the user select any band channel from 1 to 8.
  • Let the user save it.
  • If the band/channel are zero when reading it again from MSP, then they were invalid. Show a warning.

I think this makes the things too complicated. I'm not too sure if this will work as expected. The band/channel is sent before the new VTX Table, so maybe is valid but not at this moment so is the same that if I verify them against the stored table.

@McGiverGim
Copy link
Member Author

@etracer65 another thing I've observed doing tests is that if I select a band/channel and save it, and then I remove the VTX Table, the band/channel selected continues and I receive it as the band/channel selected. Is that ok?

@etracer65
Copy link
Member

etracer65 commented Aug 16, 2019

@etracer65 another thing I've observed doing tests is that if I select a band/channel and save it, and then I remove the VTX Table, the band/channel selected continues and I receive it as the band/channel selected. Is that ok?

Well it's not ideal, but also not really a big problem. I guess we should probably reset the band/channel (and also powerlevel) back to 0 if they exceed the available vtxtable count. Something like this would be normally done in the config validation in config.c when saving (so that changes from other sources like CLI are also validated), not in the MSP. I'll look at a separate PR since it's not directly related to the MSP one.

@etracer65
Copy link
Member

As mentioned, added a separate PR to reset invalid vtx band/channel/powerlevel settings.

betaflight/betaflight#8726

@McGiverGim
Copy link
Member Author

Without changing the entire way this tab is designed, and the MSP command is designed I think the better is to validate against the stored values, and if the user modifies the VTX Table letting and invalid value for the selected one, the FC will return it to zero. I think this will be enough.

@McGiverGim
Copy link
Member Author

Pushed a PR with:

  • Some little fixes
  • Adding a message remembering to fill the VTX Table before use the Select Mode form.
  • Letting only select the correct channel values stored in the FC.

I think this is the better that we can do without moving the VTX Table to another place (maybe a button that opens the table in a window to modify it, and let a read only table in the tab, but I think this will complicate the user experience to fix some edge cases).

@McGiverGim
Copy link
Member Author

It seems I forgot to push some update? I have modified files at my local branch, sorry.

@McGiverGim
Copy link
Member Author

@mikeller what is the final decision with this? Do I need to add some warning or similar? Is not clear to me if this has some changes pending.

Copy link
Member

@mikeller mikeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@McGiverGim: Sorry, I didn't get around to testing this until now.
It looks good, good work. One minor remark about the messages.

@mikeller mikeller added this to the 10.6.0 milestone Aug 20, 2019
@McGiverGim
Copy link
Member Author

Added the yes/no general messages... is a little strange because it wasn't used in other places, the only other place was commented, but now we have it ready for the future ;)

@mikeller mikeller merged commit bb67dbb into betaflight:master Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants