8000 Substract timestamps using ticks_diff() to account for wrap around by fgervais · Pull Request #36 · blynkkk/lib-python · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Substract timestamps using ticks_diff() to account for wrap around #36

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions blynklib_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def receive(self, length, timeout):
def is_server_alive(self):
now = ticks_ms()
h_beat_ms = self.heartbeat * const(1000)
rcv_delta = now - self._last_rcv_time
ping_delta = now - self._last_ping_time
send_delta = now - self._last_send_time
rcv_delta = time.ticks_diff(now, self._last_rcv_time)
ping_delta = time.ticks_diff(now, self._last_ping_time)
send_delta = time.ticks_diff(now, self._last_send_time)
if rcv_delta > h_beat_ms + (h_beat_ms // const(2)):
return False
if (ping_delta > h_beat_ms // const(10)) and (send_delta > h_beat_ms or rcv_delta > h_beat_ms):
Expand Down
0