mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-11-27 12:55:32 +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,
|
||||
end_of_frame_pos=cython.uint,
|
||||
length_int=cython.uint,
|
||||
preamble=cython.uint,
|
||||
length_high=cython.uint,
|
||||
maybe_msg_type=cython.uint
|
||||
preamble=char,
|
||||
length_high=char,
|
||||
maybe_msg_type=char
|
||||
)
|
||||
cpdef data_received(self, object data)
|
||||
|
||||
|
@ -16,7 +16,7 @@ def _varuint_to_bytes(value: _int) -> bytes:
|
||||
if value <= 0x7F:
|
||||
return bytes((value,))
|
||||
|
||||
result = []
|
||||
result = bytearray()
|
||||
while value:
|
||||
temp = value & 0x7F
|
||||
value >>= 7
|
||||
|
Loading…
Reference in New Issue
Block a user