Skip to content

MSP: Add minimum power index to MSP_VTX_CONFIG#11190

Open
sensei-hacker wants to merge 2 commits intoiNavFlight:maintenance-9.xfrom
sensei-hacker:feature-vtx-power-min
Open

MSP: Add minimum power index to MSP_VTX_CONFIG#11190
sensei-hacker wants to merge 2 commits intoiNavFlight:maintenance-9.xfrom
sensei-hacker:feature-vtx-power-min

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Dec 19, 2025

User description

Summary

Adds minPowerIndex (byte 12) to MSP_VTX_CONFIG response to indicate the minimum valid power index for VTX devices.

This complements the existing powerCount field and enables configurator to display all available power levels without hardcoding device-specific logic.

Related Configurator PR: iNavFlight/inav-configurator#2486

Changes

File: src/main/fc/fc_msp.c

Added single byte to MSP_VTX_CONFIG response after powerCount:

uint8_t minPowerIndex = 1;  // Default for most VTX devices
if (deviceType == VTXDEV_MSP) {
    minPowerIndex = 0;  // MSP supports power off
}
sbufWriteU8(dst, minPowerIndex);

Values:

  • MSP VTX: minPowerIndex = 0 (supports power off at index 0)
  • SmartAudio/Tramp: minPowerIndex = 1 (power off not supported)

Protocol Change

Before (11 bytes):

  1. device_type
  2. band
  3. channel
  4. power
  5. pitmode
  6. ready
  7. low_power_disarm
  8. vtxtable_available
  9. band_count
  10. channel_count
  11. power_count

After (12 bytes):

1-11. (same as above)
12. minPowerIndex (NEW)

Compatibility

✅ Backward Compatible

  • Old configurators (9.0) + New firmware (9.1): Works - old configurators ignore byte 12
  • New configurators (9.1) + Old firmware (9.0): Works - new configurators have fallback logic

MSP Power Level Examples

MSP VTX (minPowerIndex=0, powerCount=4):

  • Valid indices: 0, 1, 2, 3, 4
  • Index 0 = power off
  • Indices 1-4 = active power levels

SmartAudio (minPowerIndex=1, powerCount=8):

  • Valid indices: 1, 2, 3, 4, 5, 6, 7, 8
  • Power off not supported (pit mode instead)

Rationale

Current firmware sends powerCount (maximum valid index) but not the minimum. This works for most VTX devices which start at index 1, but MSP VTX devices support power off at index 0.

Without this change, configurators must hardcode device-type-specific logic:

// Hardcoded logic (bad)
var minPower = (device_type == DEV_MSP) ? 0 : 1;

With this change, configurator gets complete info from firmware:

// Dynamic from firmware (good)
var minPower = FC.VTX_CONFIG.power_min;

Testing

  • ✅ Code compiles cleanly
  • ✅ Backward compatibility verified (old configurators ignore extra byte)
  • ✅ Forward compatibility verified (new configurator has fallback)
  • 🔲 Hardware testing pending (MSP, SmartAudio, Tramp VTX devices)

Related

Description

  • Adds minPowerIndex field to MSP_VTX_CONFIG response

  • Enables configurators to display power levels dynamically

  • MSP VTX devices report minPowerIndex=0, others report 1

  • Maintains backward compatibility with older configurators


Diagram Walkthrough

flowchart LR
  A["MSP_VTX_CONFIG Request"] --> B["Check Device Type"]
  B --> C{"Is MSP VTX?"}
  C -->|Yes| D["minPowerIndex = 0"]
  C -->|No| E["minPowerIndex = 1"]
  D --> F["Send 12-byte Response"]
  E --> F
  F --> G["Configurator Receives Complete Power Range Info"]
Loading

File Walkthrough

Relevant files
Enhancement
fc_msp.c
Add minPowerIndex to VTX config response                                 

src/main/fc/fc_msp.c

  • Added minPowerIndex field (byte 12) to MSP_VTX_CONFIG response
  • Sets minPowerIndex to 0 for VTXDEV_MSP devices, 1 for others
  • Placed after powerCount field in response buffer
  • Enables dynamic power level configuration without hardcoding device
    logic
+6/-0     

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 <noreply@anthropic.com>
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Dec 19, 2025

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

These entries are not relevant to this PR and should not be included
in upstream changes.
@sensei-hacker sensei-hacker added this to the 9.1 milestone Feb 8, 2026
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.

1 participant