diff --git a/cflib/crazyflie/param.py b/cflib/crazyflie/param.py index bc339eb9e..77d474a39 100644 --- a/cflib/crazyflie/param.py +++ b/cflib/crazyflie/param.py @@ -62,15 +62,16 @@ MISC_CHANNEL = 3 MISC_SETBYNAME = 0 +MISC_VALUE_UPDATED = 1 MISC_GET_EXTENDED_TYPE = 2 - -PersistentParamState = namedtuple('PersistentParamState', 'is_stored default_value stored_value') - MISC_PERSISTENT_STORE = 3 MISC_PERSISTENT_GET_STATE = 4 MISC_PERSISTENT_CLEAR = 5 MISC_GET_DEFAULT_VALUE = 6 +PersistentParamState = namedtuple('PersistentParamState', 'is_stored default_value stored_value') + + # One element entry in the TOC @@ -186,32 +187,39 @@ def _check_if_all_updated(self): def _param_updated(self, pk): """Callback with data for an updated parameter""" + + # This method handles both param value packets as well as misc param updated packets + # The Misc packets have a command byte first and the variable id is shifted one byte + # Misc packets are not supported for V1 + if pk.channel == MISC_CHANNEL: + id_index = 1 + else: + id_index = 0 + if self._useV2: - var_id = struct.unpack('