You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
440 B
26 lines
440 B
2 weeks ago
|
import struct
|
||
|
from .tools import bytes_to_int_list, int_list_to_bytes
|
||
|
|
||
|
drawer = 1.3
|
||
|
d_drawer = struct.pack('>f', float(drawer))
|
||
|
output = d_drawer[2:] + d_drawer[:2]
|
||
|
vl_output = bytes_to_int_list(output)
|
||
|
|
||
|
# vl_output
|
||
|
# [26214, 16294]
|
||
|
|
||
|
# d_drawer
|
||
|
# b'?\xa6ff'
|
||
|
|
||
|
r_drawer = int_list_to_bytes(vl_output)
|
||
|
|
||
|
# r_drawer
|
||
|
# b'ff?\xa6'
|
||
|
|
||
|
routput = r_drawer[2:] + r_drawer[:2]
|
||
|
|
||
|
# routput
|
||
|
# b'?\xa6ff'
|
||
|
|
||
|
struct.unpack('>f', routput)
|
||
|
# (1.2999999523162842,)
|