File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ def command_active_monitor(command: str, active: bool):
3737dataref = ws .dataref ("sim/cockpit2/clock_timer/local_time_seconds" )
3838ws .monitor_dataref (dataref )
3939
40+ arrdref = ws .dataref ("sim/weather/aircraft/wind_direction_degt[0]" )
41+ ws .monitor_dataref (arrdref )
42+
4043ws .monitor_command_active (ws .command ("sim/map/show_current" ))
4144
4245print ("\n \n please activate map in X-Plane with sim/map/show_current (usually key stroke 'm')\n " )
Original file line number Diff line number Diff line change @@ -486,9 +486,9 @@ def get_string_value(self, encoding: str) -> str | None:
486486 logger .warning ("value type is not data" )
487487 return None
488488 value_bytes = self .value
489- value_bytes_stripped = value_bytes . rstrip ( b" \x00 " ) # remove trailing 0 (bytes with value 0)
490- if len ( value_bytes_stripped ) > 0 :
491- value_bytes = value_bytes_stripped
489+ if value_bytes is None :
490+ logger . debug ( "no value" )
491+ return None
492492 if type (value_bytes ) is not bytes :
493493 logger .warning ("value is not bytes" )
494494 return None
Original file line number Diff line number Diff line change @@ -296,7 +296,14 @@ def rebuild_dataref_ids(self):
296296 """Rebuild dataref idenfier index"""
297297 if len (self ._dataref_by_id ) > 0 :
298298 if self .all_datarefs .has_data :
299- self ._dataref_by_id = {d .ident : d for d in self ._dataref_by_id .values ()}
299+ newdict = dict ()
300+ for d in self ._dataref_by_id .values ():
301+ if type (d ) is Dataref :
302+ newdict [d .ident ] = d
303+ elif type (d ) is list and len (d ) > 0 :
304+ t = d [0 ] # ident of first element, same for all elements in the list
305+ newdict [t .ident ] = d
306+ self ._dataref_by_id = newdict
300307 logger .info ("dataref ids rebuilt" )
301308 return
302309 logger .warning ("no data to rebuild dataref ids" )
You can’t perform that action at this time.
0 commit comments