This was meant to convert VTX_OPTIONS from int8 to int16, and is present
in the 4.3.0 release, so anybody running 4.3.0 or later has already had
it applied.
It should be noted that it never actually did anything. 0658f06030
widened _options from AP_Int8 to AP_Int16 and added the conversion in
the same commit, but passed the new width rather than the old one:
_options.convert_parameter_width(AP_PARAM_INT16);
The argument to convert_parameter_width() is the type the value was
stored as *before* the widening, so this should have been
AP_PARAM_INT8. AP_Param::scan() matches on the type in the parameter
header, so a value written as an int8 is never found by a scan for an
int16 and the conversion always returned false without touching
anything. A user upgrading across the widening lost their VTX_OPTIONS
regardless.
So this removes dead code, and the migration floor is not really what
makes it safe to do so.
These are now "PARAMETER_CONVERSION - Added: <Mon>-<Year>", so a grep for conversion vintages finds them and can parse the date. No functional change.
Also names the release the conversion was for, which is the part that
actually matters when deciding whether a conversion can be retired. The
date alone is ambiguous here: 0658f06030 was authored Dec-2021 but did
not reach master until Sep-2022, and the conversion is absent from
4.2.0 and present in 4.3.0. Dating it from when it was written would
point at the wrong release.
set_option_enabled sets or clears a single configured option bit,
replacing the open-coded read-modify-write the MSP VTX pitmode path
used. Use ARRAY_SIZE(_power_levels) for the new power-level loops and
call the levels "active" to match the state they test.
It is non-essential and only useful with a digital VTX, so do not build it
into every >1MB board. Boards with the hardware opt in (FPV/OSD boards via
minimize_fpv_osd.inc, others by defining AP_MSP_VIDEOTX_ENABLED).
Add MSP as a VTX control transport alongside the existing providers.
VTX_TYPES selects which transport is allowed to drive the VTX so MSP and
SmartAudio/Tramp/CRSF do not fight over it.
The MSP provider is built behind AP_MSP_VIDEOTX_ENABLED, which requires
HAL_MSP_ENABLED and defaults on for boards with more than 1MB of flash.
Power levels from MSP arrive as a one-based index; map it onto the
supported levels so it lines up with the rest of the VTX power handling.
unpack_settings() for the v2.1 extended response frame copied
num_power_levels+1 bytes into the fixed power_levels[8] array, where
num_power_levels comes straight from the wire and is unbounded. A
malformed frame could request a copy of up to 256 bytes, overrunning
both the source and destination arrays.
Clamp the count to the size of the arrays before copying.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
parse_response_buffer() cast the received buffer to the response frame
struct selected by the command byte without checking that enough bytes
were actually received. A short or corrupt frame (for example a
GET_SETTINGS response with a length field of zero) could pass the CRC
check yet cause the parser to read channel/power/frequency fields from
buffer positions that were never written this cycle, pushing stale
values into the VTX settings.
Pass the received byte count into parse_response_buffer() and, in each
command case, reject frames that are too short for the struct being
interpreted.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Tramp 'v' reply reports both configured and actual power, but only
the configured value reached AP_VideoTX, hiding VTXes that ignore the
request or have a hardware power floor. Expose the actual value via
set/get_actual_power_mw() (-1 = not reported) and warn once when it
exceeds VTX_MAX_POWER or the request by more than 50%.
update_power() also rejected any mW not in the SmartAudio power table,
silently dropping valid Tramp values like 2500mW. Accept off-table
values when a Tramp provider is active, stashing them in the custom
power slot so later equality checks still work.
A VTX that silently rejects a value drove an infinite retry loop because
update() re-armed retry_count on every mismatch. Re-arm only when the
configured value actually changes, and warn once when retries exhaust on
the same value. Also defines get_current_actual_power() and
get_current_temp(), which were declared but never implemented.
Fixes an issue where setting the VTX_BAND parameter to LowRace would cause the video transmitter to hang or stop responding. Now LowRace band can be selected and used reliably without causing any malfunction.
We will reserve BOARD_FLASH_SIZE for the internal flash on stm32 flash processors, use HAL_PROGRAM_SIZE_LIMIT_KB in the general code base.
Notable change here is that boards with external flash will start to get features only available with more than 2MB of program storage
correct settings when power set is received
add support for capturing all supported power levels
learn power levels in SmartAudio 2.1
add better support for VTX power levels
don't set power to 0 if in pitmode
add option for iNav compatibility
support non-conforming SmartAudio implementations
re-enable pitmode on SmartAudio 2.0
add support for "blind" VTX setting