IRC Tramp CLI Power Tables#11217
IRC Tramp CLI Power Tables#11217SomeTestStuffDoesntWork wants to merge 4 commits intoiNavFlight:maintenance-9.xfrom
Conversation
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
|
Thanks for doing your first INAV PR! A lot of people will be very happy about this, because they've been asking for it for a long time. This is great, if it works out. You mentioned comments. Let me comment on comments. :) That's great code - totally self-explanatory. Someone who isn't even a programmer could likely read and pretty much understand that because it reads pretty much like English prose. If cmdLine is empty, print an error and return. Awesome. THEREFORE, the comment repeating what the code says may be unnecessary noise that actually ends up making the code harder to read by making it longer: There's also the question there of -- are the comments before the code or after? Hmm, both? But here there is nothing to explain - it's great, self-evident code. Typically, comments should describe WHY the code is doing something that isn't obvious. This certainly might! A comment could say 0.0 is added to make it a float. ( Though maybe explicitly casting to a float would be better in that example.) We have a function called constructPowerTable(). Which contructs the power table, of course. |
…ed better range checks to PL commands. Hooked the new configuration into settings.yaml. Added preprocessor conditionals to static functions for tramp PL configuration to ensure that when the tramp option excludes the commands from the build the static processing functions are not left unused. Added tramp_pl_table command to ease updating the configuration in the cases where no default hard coded PL table values are to be reused. If less than the max number of PL entries are provided, remaining entries are filled with that of the last passed PL to ensure that the default values are not used. Tested on F405, worked without issue.
This all sounds good to me. Took a pass through and cleaned up the comments. Additionally, this commit should fix the unused static function errros from SITL builds. Had the commands in preprocessor conditionals but not the static functions used to service those commands. The functions should now follow the command definitions |
|
Hi @SomeTestStuffDoesntWork this is a great addition and something I've been looking for in INAV since I have some IRC Tramp based VTXs that won't work properly in the current implementation. I'm in the process of testing your code applied to INAV 9.0.1 and came across some problems as I wasn't fully able to replicate the success you had in your PR. I was able to fix the first problem (though not sure if it is correct), which is that default and min values for the new cli variable I've confirmed with these two changes that the firmware builds correctly and does not throw any system errors in INAV Configurator. For reference, the FC that I'm testing this on is the AtomRC F405 Navi and the Jhemcu Ruibet Tran 3016 VTX. After doing a full erase flash with the modified firmware, I applied the VTX power table using I hardcoded the table the old way as described in this discussion #8340 and was able to confirm all 5 power values work as expected once I force INAV to use the hardcoded table for the 1600mw VTX using the Would you happen to know why this could be? Additionally, I don't fully understand the purpose of the variable I think your implementation could also be refined if there is no default table at all. To simplify the code and usability, would it make sense to have the user manually define the power values for their specific IRC Tramp vtx that way there's little to no confusions about what's overriding what? Thanks for your help with helping me understand your code better! |
Maintenance 9.x to master
…-to-tramp-power-levels
|
Test firmware build ready — commit Download firmware for PR #11217 228 targets built. Find your board's
|
|
Hi @robotgoat, thanks for taking a look at this PR! I apologize for any issues that have made their way into the latest commit and I am working to resolve them locally. I should have updates ready to try out again within the next few days. The power overrides (as they currently function) consist of five individual table entries that each can contain a single power level. When the power levels are selected during VTX initialization, either the hard coded values are chosen or if the associated power override table entry contains a custom user value, the power override is used. Since the table construction is currently dictated by the size of the default table selected (IE if the default for the power reported by the VTX contains four entries, only four entries can be overridden), it may be possible that some of the other assigned power levels are getting truncated. I will try to resolve this issue as it does pose a limitation unless the vtx_max_power_override is used to force selection of a power group with all five entries (vtx_max_power_override can still be used as the override swap takes place after the vtx_max_power_override's operations are applied). While this is a bit of redirection it was the best compromise I could come up with to make sure that all prior VTX operations still work with existing configurations while also allowing custom tables to slip in underneath as an additional layer. This could be simplified with the removal of the defaults, but that would force the use of the power table and also probably require a configurator change, all of which I am a bit hesitant to suggest unless there is significant interest in that approach. I'll also take a look at removing the individual power level override commands in favor of the the tramp_pl_table command as it introduces a bit of noise that doesn't buy much additional function. With that removed, some of the individual default-value checking can go away in favor of a single check on the first value. |
|
@SomeTestStuffDoesntWork no problem! Thank you for taking time to make this feature available and explaining how it works. I agree with your implemention to keep the default list of power tables while adding the custom power table override feature as an option as it's the least destructive while giving users this additional feature. I also think it will be a good idea to remove the individual power level override. Thank you for explaining how the existing cli variable One additional thing that your implementation adds is |
Summary
Testing
This has been tested with an ATOMRC F405 NAVI on the ground communicating with a stubborn VTX. This VTX was particulary impacted by the default tables as its PLs are set as 1, 2, and 3 in place of milliwatt values, making the defaults impossible to use. Changing PL entries 1, 2, and 3 to 1, 2, and 3 milliwatts respectively fixed this issue and the VTX correctly transitioned to higher PLs on command. Non-volatile storage was tested and saved values were recovered across power cycles. Configuration reset was also tested and all values initialized to -1 as expected. Additional board tests may be required.
Please Note: This contains a settings change and will most likely require a diff all + full erase + reapplication of original config in order to perform further testing.
Related
This may fix the following:
Other Notes
I apologize in advance for any coding standards inconsistencies. I regularly use a slightly different set and some issues may have slipped through. Additionally, I have left a fair quantity of comments. Some of these may not be as useful, but I tend to err on the side of more comments rather than less to assist with later maintenance. I can remove the majority of these if they just add noise.