(data, bits, verbose=False)
return level * 0.5151515151
Returns sensor level value from data using sensor bit mask in micro volts (uV).
Returns sensor level value from data using sensor bit mask in micro volts (uV).
Returns sensor level value from data using sensor bit mask in micro volts ( uV ) .
def get_level(data, bits, verbose=False):
    """
    Returns sensor level value from data using sensor bit mask in micro volts (uV).
    """
    # if verbose:
    #    return detailed_get_level(data, bits)
    level = 0
    bit_list = []
    for i in range(13, -1, -1):
        level <<= 1
        b = (bits[i] // 8) + 1
        o = bits[i] % 8
        bit_list.append(str(ord(data[b]) >> o & 1))
        if sys.version_info >= (3, 0):
            level |= (data[b] >> o) & 1
        else:
            level |= (ord(data[b]) >> o) & 1
            # print(level)
    # print(bit_list)
    # whole_bits = list(reversed(bit_list[0:7]))
    # whole_bits.append('0')
    # whole = int(''.join(whole_bits), 2)
    # print(whole)
    # print(whole / 0.051)
    # precision_bits = bit_list[7:14]
    # precision_bits.append('0')
    # precision_bits.append('0')
    # print(int(''.join(precision_bits), 2))
    # precision = int(''.join(precision_bits), 2)
    # print(precision / 0.51)
    # level = whole / 0.051
    # level += precision / 0.51
    # level = level * 2
    # print((level) * 0.5151515151)
    return level * 0.5151515151
def get_level ( data , bits , verbose = False ) : # if verbose: #    return detailed_get_level(data, bits) level = 0 bit_list = [ ] for i in range ( 13 , - 1 , - 1 ) : level <<= 1 b = ( bits [ i ] // 8 ) + 1 o = bits [ i ] % 8 bit_list . append ( str ( ord ( data [ b ] ) >> o & 1 ) ) if sys . version_info >= ( 3 , 0 ) : level |= ( data [ b ] >> o ) & 1 else : level |= ( ord ( data [ b ] ) >> o ) & 1 # print(level) # print(bit_list) # whole_bits = list(reversed(bit_list[0:7])) # whole_bits.append('0') # whole = int(''.join(whole_bits), 2) # print(whole) # print(whole / 0.051) # precision_bits = bit_list[7:14] # precision_bits.append('0') # precision_bits.append('0') # print(int(''.join(precision_bits), 2)) # precision = int(''.join(precision_bits), 2) # print(precision / 0.51) # level = whole / 0.051 # level += precision / 0.51 # level = level * 2 # print((level) * 0.5151515151) return level * 0.5151515151