From 30e4b27516a1426c0c4492fb7ae771cfcaf41ee8 Mon Sep 17 00:00:00 2001 From: sparky8512 <76499194+sparky8512@users.noreply.github.com> Date: Sun, 14 Feb 2021 13:47:24 -0800 Subject: [PATCH] Fix handling of 0 history samples range This can happen when polling the history buffer very frequently (<= 1 second). --- starlink_grpc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/starlink_grpc.py b/starlink_grpc.py index d019aa7..78aeb3f 100644 --- a/starlink_grpc.py +++ b/starlink_grpc.py @@ -765,6 +765,9 @@ def _compute_sample_range(history, parse_samples, start=None, verbose=False): if start is None or start < current - parse_samples: start = current - parse_samples + if start == current: + return range(0), 0, current + # This is ring buffer offset, so both index to oldest data sample and # index to next data sample after the newest one. end_offset = current % samples