3333
3434from ._xyz_packet import _XYZPacket
3535
36+
3637class QuaternionPacket (_XYZPacket ):
3738 """A packet of x, y, z float values. Used for several different Bluefruit controller packets."""
3839
3940 # Use _XYZPacket to handle x, y, z, and add w.
4041
41- _FMT_PARSE = ' <xxffffx'
42+ _FMT_PARSE = " <xxffffx"
4243 PACKET_LENGTH = struct .calcsize (_FMT_PARSE )
4344 # _FMT_CONSTRUCT doesn't include the trailing checksum byte.
44- _FMT_CONSTRUCT = ' <2sffff'
45- _TYPE_HEADER = b'!Q'
45+ _FMT_CONSTRUCT = " <2sffff"
46+ _TYPE_HEADER = b"!Q"
4647
4748 def __init__ (self , x , y , z , w ):
4849 """Construct a QuaternionPacket from the given x, y, z, and w float values."""
@@ -52,14 +53,16 @@ def __init__(self, x, y, z, w):
5253 def to_bytes (self ):
5354 """Return the bytes needed to send this packet.
5455 """
55- partial_packet = struct .pack (self ._FMT_CONSTRUCT , self ._TYPE_HEADER ,
56- self ._x , self ._y , self ._z , self ._w )
56+ partial_packet = struct .pack (
57+ self ._FMT_CONSTRUCT , self ._TYPE_HEADER , self ._x , self ._y , self ._z , self ._w
58+ )
5759 return partial_packet + self .checksum (partial_packet )
5860
5961 @property
6062 def w (self ):
6163 """The w value."""
6264 return self ._w
6365
66+
6467# Register this class with the superclass. This allows the user to import only what is needed.
6568QuaternionPacket .register_packet_type ()
0 commit comments