mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-11-28 13:05:12 +01:00
Speed up plain text frame helper (#692)
This commit is contained in:
parent
0eb468ec61
commit
663f7ca950
@ -21,9 +21,9 @@ cdef class APIPlaintextFrameHelper(APIFrameHelper):
|
|||||||
add_length=bytes,
|
add_length=bytes,
|
||||||
end_of_frame_pos=cython.uint,
|
end_of_frame_pos=cython.uint,
|
||||||
length_int=cython.uint,
|
length_int=cython.uint,
|
||||||
preamble=cython.uint,
|
preamble=char,
|
||||||
length_high=cython.uint,
|
length_high=char,
|
||||||
maybe_msg_type=cython.uint
|
maybe_msg_type=char
|
||||||
)
|
)
|
||||||
cpdef data_received(self, object data)
|
cpdef data_received(self, object data)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ def _varuint_to_bytes(value: _int) -> bytes:
|
|||||||
if value <= 0x7F:
|
if value <= 0x7F:
|
||||||
return bytes((value,))
|
return bytes((value,))
|
||||||
|
|
||||||
result = []
|
result = bytearray()
|
||||||
while value:
|
while value:
|
||||||
temp = value & 0x7F
|
temp = value & 0x7F
|
||||||
value >>= 7
|
value >>= 7
|
||||||
|
Loading…
Reference in New Issue
Block a user