-
Notifications
You must be signed in to change notification settings - Fork 370
VTX: Fetch power level count and min from FC (resolves #2202 conflict) #2486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sensei-hacker
wants to merge
3
commits into
iNavFlight:maintenance-9.x
Choose a base branch
from
sensei-hacker:feature-read-power-level-count
base: maintenance-9.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
VTX: Fetch power level count and min from FC (resolves #2202 conflict) #2486
sensei-hacker
wants to merge
3
commits into
iNavFlight:maintenance-9.x
from
sensei-hacker:feature-read-power-level-count
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resolves merge conflict in PR iNavFlight#2202 by adding support for dynamic power_min from firmware while maintaining backward compatibility. Changes: - Added FC.VTX_CONFIG.power_min field (default 1) - Updated MSPHelper.js to read power_min from firmware (INAV 9.1+) - Added defensive buffer checking for backward compatibility with 9.0 - Falls back to device-type logic if firmware doesn't send power_min (MSP VTX: min=0, others: min=1) - Resolved merge conflict in js/vtx.js by removing both POWER_MIN constant and getMinPower()/getMaxPower() functions - Updated tabs/configuration.js to use FC.VTX_CONFIG.power_min instead of VTX.POWER_MIN This implementation: - Works with current firmware 9.0 (graceful fallback) - Ready for future firmware 9.1 with power_min support - Eliminates hardcoded device-type logic in configurator - Maintains single source of truth in firmware Related: iNavFlight#2202 Related: iNavFlight#2206 Related: iNavFlight/inav#10395 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Contributor
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
Move power_min fallback outside buffer length check to handle edge case where packet is truncated after vtxtable_available flag. Addresses Qodo suggestion #1 for more robust parsing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Member
Author
sensei-hacker
added a commit
to sensei-hacker/inav_unofficial_targets
that referenced
this pull request
Dec 19, 2025
Adds minPowerIndex (byte 12) to MSP_VTX_CONFIG response to indicate the minimum valid power index for the VTX device. - MSP VTX: minPowerIndex = 0 (supports power off at index 0) - SmartAudio/Tramp: minPowerIndex = 1 (power off not supported) This allows configurator to correctly display all available power levels without hardcoding device-specific logic. Backward compatible: old configurators will ignore the extra byte. Related: iNavFlight/inav-configurator#2486 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Member
Author
|
Requires iNavFlight/inav#11190 to be fully effective (otherwise the fallback is used) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
Summary
This PR resolves the merge conflict in #2202 by adding support for dynamic
power_minfrom the flight controller while maintaining compatibility with INAV 9.0 RCx.Original PR: #2202 by @bkleiner
Conflict cause: PR #2206 added MSP VTX support which uses 0-based power indexing (index 0 = power off), while #2202 assumed all devices are 1-based.
Changes
1. Added
power_minFieldFC.VTX_CONFIG.power_minfield (default: 1)2. Enhanced MSP Parser (js/msp/MSPHelper.js)
power_minfrom firmware if available (INAV 9.1+)3. Resolved Merge Conflict (js/vtx.js)
POWER_MINconstant andgetMinPower()/getMaxPower()functionsDEV_MSP = 6constant from master4. Updated VTX Power UI (tabs/configuration.js)
VTX.POWER_MINtoFC.VTX_CONFIG.power_minCompatibility
✅ Configurator 9.1 (this PR) + Firmware 9.0
Firmware sends 11 bytes, configurator detects missing
power_minand falls back to device-type logic✅ Configurator 9.0 (current) + Firmware 9.1 (future)
Old configurator ignores extra bytes, uses hardcoded logic
Firmware Enhancement (Future)
The configurator is ready to receive
power_minfrom firmware. To complete this feature, add one byte toMSP_VTX_CONFIGresponse in firmware:Once firmware sends this byte, the configurator will automatically use it instead of the fallback logic.
Benefits
✅ Preserves PR #2202's original intent - eliminates hardcoded device-type logic
✅ Single source of truth - firmware owns all VTX capabilities
✅ Fixes MSP VTX power off support (index 0 now accessible)
✅ Backward compatible with firmware 9.0
✅ Forward compatible - ready for firmware 9.1 enhancement
✅ No breaking changes in either upgrade direction
Testing
Related
Checklist
Description
Add dynamic VTX power configuration from firmware with backward compatibility
band_count,channel_count,power_count,power_mininFC.VTX_CONFIGpower_minfrom firmware (INAV 9.1+) with fallback logic for 9.0Enhanced MSP parser with defensive buffer checking
power_minRemoved hardcoded power level functions from VTX module
getMinPower()andgetMaxPower()functionsUpdated VTX power UI to use firmware values
VTX.getMinPower/getMaxPower()toFC.VTX_CONFIG.power_minandpower_countDiagram Walkthrough
File Walkthrough
fc.js
Add VTX configuration fields for power levelsjs/fc.js
FC.VTX_CONFIG:band_count,channel_count,power_count,power_minpower_minto 1 for backward compatibilityMSPHelper.js
Enhance MSP parser with dynamic power configurationjs/msp/MSPHelper.js
band_count,channel_count,power_countfrom firmware ifavailable
power_min: MSP VTX uses 0, others use 1if firmware doesn't send it
configuration.js
Update VTX power UI to use firmware valuestabs/configuration.js
FC.VTX_CONFIG.power_mininstead of
VTX.getMinPower()FC.VTX_CONFIG.power_countinstead of
VTX.getMaxPower()logic
vtx.js
Remove hardcoded VTX power level functionsjs/vtx.js
getMinPower()function that returned device-type specificminimum power index
getMaxPower()function that returned device-type specificmaximum power index