From 363a32b8e5873cc1839cb7ded4a4ec325bac761a Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Thu, 26 Nov 2020 09:51:42 -0600 Subject: [PATCH] Update Reference.md --- docs/Reference.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/Reference.md b/docs/Reference.md index e2528f2..95d62a1 100644 --- a/docs/Reference.md +++ b/docs/Reference.md @@ -125,23 +125,23 @@ Creating an instance of this **class** overrides the default HAP range for a Cha * instantiated Ranges are added to the HomeSpan HAP Database and associated with the last Characteristic instantiated * instantiating a Range without first instantiating a Characteristic throws an error during initialization -## SpanButton(int pin, uint16_t longTime=2000, uint16_t singleTime=5, uint16_t doubleTime=200)* +## *SpanButton(int pin, uint16_t longTime, uint16_t singleTime, uint16_t doubleTime)* Creating an instance of this **class** attaches a pushbutton handler to the ESP32 *pin* specified. * instantiated Buttons are associated with the last Service instantiated * instantiating a Button without first instantiating a Service throws an error during initialization - -* *pin* - the ESP32 pin to which a one pole of a normally-open pushbutton will be connected; the other pole is connected to ground -* *longTime* - the minimum time (in millis) required for the button to be pressed and held to trigger a Long Press (default=2000 ms) -* *singleTime* - the minimum time (in millis) required for the button to be pressed to trigger a Single Press (default=5 ms) -* *doubleTime* - the maximum time (in millis) allowed between consecutive Single Presses to qualify as a Double Press (default=200 ms) +* the first argument is required; the rest are optional + * *pin* - the ESP32 pin to which a one pole of a normally-open pushbutton will be connected; the other pole is connected to ground + * *longTime* - the minimum time (in millis) required for the button to be pressed and held to trigger a Long Press (default=2000 ms) + * *singleTime* - the minimum time (in millis) required for the button to be pressed to trigger a Single Press (default=5 ms) + * *doubleTime* - the maximum time (in millis) allowed between consecutive Single Presses to qualify as a Double Press (default=200 ms) * Trigger Rules: * If button is pressed and continuously held, a Long Press will be triggered every longTime ms until the button is released * If button is pressed for more than singleTime ms but less than longTime ms and then released, a Single Press will be triggered, UNLESS the button is pressed a second time within doubleTime ms AND held again for at least singleTime ms, in which case a DoublePress will be triggered; No further events will occur until the button is released -* If singleTime>longTime, only Long Press triggers can occur -* If doubleTime=0, Double Presses cannot occur + * If singleTime>longTime, only Long Press triggers can occur + * If doubleTime=0, Double Presses cannot occur * HomeSpan automatically calls the `button(int pin, int pressType)` method of a Service upon a trigger event in any Button associated with that Service, where *pin* is the ESP32 pin to which the pushbutton is connected, and *pressType* is an integer that can also be represented by the enum constants indicated: * 0=single press (SpanButton::SINGLE)