PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.33k stars 13.44k forks source link

[Bug] Latest parameter meta data generation is causing failures in QGC validation #23800

Open DonLakeFlyer opened 1 day ago

DonLakeFlyer commented 1 day ago

Describe the bug

Output from QGC says it all:

PX4ParameterMetaDataLog: Invalid max value, name: "VTQ_TELEM_IDS_1"  type: 5  max: "4294967295"  error: "Value must be within 0 and 2147483647"
PX4ParameterMetaDataLog: Invalid value for bitmask, bit: 31
PX4ParameterMetaDataLog: Invalid max value, name: "VTQ_TELEM_IDS_2"  type: 5  max: "9223372036854775807"  error: "Value must be within 0 and 2147483647"

These parameters are INT32s. Note the metadata for max which is larger than an INT32.

And then for VTQ_TELEM_IDS_2:

PX4ParameterMetaDataLog: Invalid value for bitmask, bit: 32
PX4ParameterMetaDataLog: Invalid value for bitmask, bit: 33
...

This is trying to set bits which are not available on an INT32.

Also since these are both bit mask parameters these should really be unsigned.

To Reproduce

Boot latest daily build QGC

Expected behavior

No response

Screenshot / Media

No response

Flight Log

No response

Software Version

No response

Flight controller

No response

Vehicle type

None

How are the different components wired up (including port information)

No response

Additional context

No response

DonLakeFlyer commented 1 day ago

Also FYI: Although parameters theoretically support [u]int64's. QGCs px4 parameter metadata parsing code assumes 32 bits only for bit masks. That said switching to support 64 bits doesn't seem like a great idea since it's had zero testing. I don't think any current params are 64 bit.

DonLakeFlyer commented 1 day ago

@dagar Any reason bit masks can't be UINT32? That would fix the max problem.

DonLakeFlyer commented 18 hours ago

A unit test which sanity checks the metadata would be nice so that this doesn't make it all the way to QGC before it's discovered. Look at https://github.com/mavlink/qgroundcontrol/blob/master/src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc#L78 to see how QGC validates it for examples to test.