Skip to content

Commit

Permalink
DFReader: recognise VER.BU for build type
Browse files Browse the repository at this point in the history
allows correct mode mapping when version string is modified for custom build
  • Loading branch information
tridge committed Oct 16, 2023
1 parent f508300 commit e51a7d4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,18 @@ def _add_msg(self, m):
self.mav_type = mavutil.mavlink.MAV_TYPE_SUBMARINE
elif m.Message.find("Blimp") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_AIRSHIP
if type == 'VER' and hasattr(m,'BU'):
build_types = { 1: mavutil.mavlink.MAV_TYPE_GROUND_ROVER,
2: mavutil.mavlink.MAV_TYPE_QUADROTOR,
3: mavutil.mavlink.MAV_TYPE_FIXED_WING,
4: mavutil.mavlink.MAV_TYPE_ANTENNA_TRACKER,
7: mavutil.mavlink.MAV_TYPE_SUBMARINE,
13: mavutil.mavlink.MAV_TYPE_HELICOPTER,
12: mavutil.mavlink.MAV_TYPE_AIRSHIP,
}
mavtype = build_types.get(m.BU,None)
if mavtype is not None:
self.mav_type = mavtype
if type == 'MODE':
if hasattr(m,'Mode') and isinstance(m.Mode, str):
self.flightmode = m.Mode.upper()
Expand Down Expand Up @@ -901,7 +913,7 @@ def skip_to_type(self, type):
if self.type_nums is None:
# always add some key msg types so we can track flightmode, params etc
type = type.copy()
type.update(set(['MODE','MSG','PARM','STAT','ORGN']))
type.update(set(['MODE','MSG','PARM','STAT','ORGN','VER']))
self.indexes = []
self.type_nums = []
for t in type:
Expand Down Expand Up @@ -1171,7 +1183,7 @@ def skip_to_type(self, type):
if self.type_list is None:
# always add some key msg types so we can track flightmode, params etc
self.type_list = type.copy()
self.type_list.update(set(['MODE','MSG','PARM','STAT','ORGN']))
self.type_list.update(set(['MODE','MSG','PARM','STAT','ORGN','VER']))
self.type_list = list(self.type_list)
self.indexes = []
self.type_nums = []
Expand Down

0 comments on commit e51a7d4

Please sign in to comment.