Repository navigation
Conversation
onur-ozkan
approved these changes
Nov 17, 2026
onur-ozkan
left a comment
Member
There was a problem hiding this comment.
Looks clean, thanks!
Could you please fix the CI errors and re-push the changes (into same commit)?
Mattbusel
force-pushed
the
fix/bitflags-default-empty
branch
from
November 17, 2026 05:33
2cb5d52 to
9f8760d
Compare
Bitflag enums used the first declared flag as DEFAULT, so default messages carried a set flag (e.g. GIMBAL_DEVICE_CAP_FLAGS_HAS_RETRACT). Bitmasks now default to empty(); regular enums keep entries[0]. Fixes mavlink#557
Mattbusel
force-pushed
the
fix/bitflags-default-empty
branch
from
November 17, 2026 07:56
9f8760d to
ac09b4e
Compare
This branch has not been deployed
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
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.
Fixes #557.
emit_const_defaultusedentries[0]for every enum, so bitmask enums defaulted to their first flag. For exampleGimbalDeviceCapFlags::default()wasGIMBAL_DEVICE_CAP_FLAGS_HAS_RETRACT, which means a defaultGIMBAL_DEVICE_INFORMATION_DATAclaimed a retract capability.Fix: bitmask enums now emit
pub const DEFAULT: Self = Self::empty();. Regular enums still use the first entry.Regression test:
mavlink/tests/bitflags_default_test.rschecksGimbalDeviceCapFlags,HlFailureFlag,MavProtocolCapabilityand a defaultGIMBAL_DEVICE_INFORMATION_DATA.Results:
mav_boolandundersized_bitflag; only theDEFAULTlines change.serde_test::test_ser_de_heartbeatupdated: a defaultHEARTBEAT_DATAnow serializesbase_modeas""(no flags) instead of"MAV_MODE_FLAG_SAFETY_ARMED". The old expectation encoded the Make 0 default for bitflags #557 bug.cargo fmt --all -- --checkis clean.MavBoolstill defaults to false (MAV_BOOL_FALSEis 0), soas_bool()doesn't change.