From 4ef33231767e672c4eb55e2cba8f6867226ad220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Thu, 21 Dec 2023 14:05:16 +0100 Subject: [PATCH] Queue up to 3 poll requests, Readme update Using 3 queued poll requests we can be sure to not miss any change by interrupt or manually triggered poll. See #59 --- README.md | 6 +++++- src/pcf857x.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 72a3a38..952fdf7 100644 --- a/README.md +++ b/README.md @@ -200,8 +200,12 @@ doPoll (): Promise; Manually poll changed inputs from the PCF8574/PCF8574A/PCF8575 IC. If a change on an input is detected, an `input` Event will be emitted with a data object containing the `pin` and the new `value`. + This have to be called frequently enough if you don't use a GPIO for interrupt detection. -If you poll again before the last poll was completed, the new poll will be queued up an get executed if the current poll is done. + +Poll requests will be queued internally up to 4 total requests (one active and three waiting) including polls triggered by interrupts. +If you try to trigger a poll while the queue is already full, the new poll will be rejected. +This is due to not have too many unnecessary polls. ### isPolling() diff --git a/src/pcf857x.ts b/src/pcf857x.ts index 7b1924b..1a5485b 100644 --- a/src/pcf857x.ts +++ b/src/pcf857x.ts @@ -125,7 +125,7 @@ export abstract class PCF857x