HeatPump icon indicating copy to clipboard operation
HeatPump copied to clipboard

Read all packets in buffer during sync and before update

Open sethkinast opened this issue 2 years ago • 0 comments

Currently we strictly read one packet each time sync() is called. This means that if writePacket() is ever called twice in a row before reading, a packet will be permanently buffered.

In cases where you expect to write a packet and receive a response in the next packet, such as during update(), having buffered packets guarantees you won't receive the correct packet next.

Changing sync() and update() to flush the serial buffer makes the behavior much more robust and in my testing has always given me the 0x41 0x61 pair successfully when I call update().

Closes #181

sethkinast avatar Jun 29 '22 05:06 sethkinast