(self, data, timestamp=None, verbose=False)
Initializes packet data. Sets the global battery value.
        Updates each sensor with current sensor value from the packet data.

        :param data - Values decrypted to be processed
        :param verbose - Flag for outputting debug values.
Initializes packet data. Sets the global battery value.
        Updates each sensor with current sensor value from the packet data.
Initializes packet data . Sets the global battery value . Updates each sensor with current sensor value from the packet data .
def __init__(self, data, timestamp=None, verbose=False):
        """
        Initializes packet data. Sets the global battery value.
        Updates each sensor with current sensor value from the packet data.

        :param data - Values decrypted to be processed
        :param verbose - Flag for outputting debug values.
        """

        # bit_list = []
        # for i in range(len(data) * 8):
        #    byte = (i // 8)
        #    print(byte)
        #    bit_list.append(str((ord(data[byte]) & i)))
        # print(bit_list)
        if timestamp is None:
            self.timestamp = datetime.now()
        else:
            self.timestamp = timestamp
        if sys.version_info >= (3, 0):
            self.raw_data = [int(bit) for bit in data]
            data = self.raw_data
            self.counter = data[0]
        else:
            if type(data[0]) == str and len(data[0]) > 1:
                self.raw_data = [chr(int(bit)) for bit in data]

                data = self.raw_data
            else:
                self.raw_data = data
            self.counter = ord(data[0])
        # print([ord(c) for c in data])
        self.battery = None
        if self.counter > 127:
            self.battery = battery_values[str(self.counter)]
            self.counter = 128
        self.sync = self.counter == 0xe9
        self.sensors = sensors_mapping.copy()
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y'])
        # print("Gyro Y: {}".format(value))
        self.sensors['Y']['value'] = value * 1.0
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X'])
        # print("Gyro X: {}".format(value))
        self.sensors['X']['value'] = value * 1.0
        """
        #value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_2'])
        #print("Gyro Y 2: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_2'])
        print("Gyro X 2: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_3'])
        print("Gyro Y 3: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_3'])
        print("Gyro X 3: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_4'])
        print("Gyro Y 4: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_4'])
        print("Gyro X 4: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_5'])
        print("Gyro Y 5: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_5'])
        print("Gyro X 5: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_6'])
        print("Gyro Y 6: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_6'])
        print("Gyro X 6: {}".format(value))"""
        self.sensors['Z']['value'] = '?'

        for name, bits in sensors_14_bits.items():
            if not 'GYRO' in name:
                value = get_level(self.raw_data, bits, verbose)
                setattr(self, name, (value,))
                self.sensors[name]['value'] = value
        self.quality_bit, self.quality_value = self.handle_quality(self.sensors, verbose)
def __init__ ( self , data , timestamp = None , verbose = False ) : # bit_list = [] # for i in range(len(data) * 8): #    byte = (i // 8) #    print(byte) #    bit_list.append(str((ord(data[byte]) & i))) # print(bit_list) if timestamp is None : self . timestamp = datetime . now ( ) else : self . timestamp = timestamp if sys . version_info >= ( 3 , 0 ) : self . raw_data = [ int ( bit ) for bit in data ] data = self . raw_data self . counter = data [ 0 ] else : if type ( data [ 0 ] ) == str and len ( data [ 0 ] ) > 1 : self . raw_data = [ chr ( int ( bit ) ) for bit in data ] data = self . raw_data else : self . raw_data = data self . counter = ord ( data [ 0 ] ) # print([ord(c) for c in data]) self . battery = None if self . counter > 127 : self . battery = battery_values [ str ( self . counter ) ] self . counter = 128 self . sync = self . counter == 0xe9 self . sensors = sensors_mapping . copy ( ) value = get_gyro ( self . raw_data , sensors_14_bits [ 'GYRO_Y' ] ) # print("Gyro Y: {}".format(value)) self . sensors [ 'Y' ] [ 'value' ] = value * 1.0 value = get_gyro ( self . raw_data , sensors_14_bits [ 'GYRO_X' ] ) # print("Gyro X: {}".format(value)) self . sensors [ 'X' ] [ 'value' ] = value * 1.0 """
        #value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_2'])
        #print("Gyro Y 2: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_2'])
        print("Gyro X 2: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_3'])
        print("Gyro Y 3: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_3'])
        print("Gyro X 3: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_4'])
        print("Gyro Y 4: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_4'])
        print("Gyro X 4: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_5'])
        print("Gyro Y 5: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_5'])
        print("Gyro X 5: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_Y_6'])
        print("Gyro Y 6: {}".format(value))
        value = get_gyro(self.raw_data, sensors_14_bits['GYRO_X_6'])
        print("Gyro X 6: {}".format(value))""" self . sensors [ 'Z' ] [ 'value' ] = '?' for name , bits in sensors_14_bits . items ( ) : if not 'GYRO' in name : value = get_level ( self . raw_data , bits , verbose ) setattr ( self , name , ( value , ) ) self . sensors [ name ] [ 'value' ] = value self . quality_bit , self . quality_value = self . handle_quality ( self . sensors , verbose )