adds duration and marks as deprecated, updates docs #84

Closed
cameroncking wants to merge 1 commits from ckxng/deprecate-duration into master
cameroncking commented 2022-03-19 08:04:24 +03:00 (Migrated from github.com)
  • adds back duration
  • marks duration as deprecated
  • updates docs by running doxygen

Problem

The default behavior of library managers are updating Bounce2 from 2.60 to 2.70, as they are not aware of a backwards-incompatible change to the API has taken place. See thomasfredericks/Bounce2#82.

This causes compile errors such as:

.pio\libdeps\adafruit_circuitplayground_m0\ButtonSuite\src\ButtonBase.cpp: In member function 'BUTTONSUITE::BUTTONSTATUS ButtonBase::update()':
.pio\libdeps\adafruit_circuitplayground_m0\ButtonSuite\src\ButtonBase.cpp:82:18: error: 'class Bounce' has no member named 'duration'
   82 |   if (_debouncer.duration() < _longPressInterval)
      |                  ^~~~~~~~

Solution

Add duration back into the API, restoring backwards-compatibility, but mark it as deprecated.

Evidence

The following app, which depends on lendres/ButtonSuite (which in turn depends on Bounce2) gets a compile error using unpatched Bounce2 v2.70. When patched with this change, the app compiles and functions normally.

platformio.ini

[env:adafruit_circuitplayground_m0]
platform = atmelsam
board = adafruit_circuitplayground_m0
framework = arduino
lib_deps =
    adafruit/Adafruit NeoPixel@^1.10.4
    thomasfredericks/Bounce2@^2.60
    lendres/ButtonSuite@^2.1.0

main.cpp

#include <Arduino.h>
#include <MomentaryButton.h>

MomentaryButton button(4);

void setup() {
    pinMode(13, OUTPUT);
    digitalWrite(13, LOW);
    pinMode(4, INPUT_PULLDOWN);
}

void loop() {
    if (button.pushed()) {
        digitalWrite(13, HIGH);
    }
    else {
        digitalWrite(13, LOW);
    }
}
- adds back duration - marks duration as deprecated - updates docs by running doxygen # Problem The default behavior of library managers are updating Bounce2 from 2.60 to 2.70, as they are not aware of a backwards-incompatible change to the API has taken place. See thomasfredericks/Bounce2#82. This causes compile errors such as: ``` .pio\libdeps\adafruit_circuitplayground_m0\ButtonSuite\src\ButtonBase.cpp: In member function 'BUTTONSUITE::BUTTONSTATUS ButtonBase::update()': .pio\libdeps\adafruit_circuitplayground_m0\ButtonSuite\src\ButtonBase.cpp:82:18: error: 'class Bounce' has no member named 'duration' 82 | if (_debouncer.duration() < _longPressInterval) | ^~~~~~~~ ``` # Solution Add duration back into the API, restoring backwards-compatibility, but mark it as deprecated. # Evidence The following app, which depends on lendres/ButtonSuite (which in turn depends on Bounce2) gets a compile error using unpatched Bounce2 v2.70. When patched with this change, the app compiles and functions normally. platformio.ini ``` [env:adafruit_circuitplayground_m0] platform = atmelsam board = adafruit_circuitplayground_m0 framework = arduino lib_deps = adafruit/Adafruit NeoPixel@^1.10.4 thomasfredericks/Bounce2@^2.60 lendres/ButtonSuite@^2.1.0 ``` main.cpp ``` #include <Arduino.h> #include <MomentaryButton.h> MomentaryButton button(4); void setup() { pinMode(13, OUTPUT); digitalWrite(13, LOW); pinMode(4, INPUT_PULLDOWN); } void loop() { if (button.pushed()) { digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } } ```
cameroncking commented 2022-03-29 03:05:03 +03:00 (Migrated from github.com)

@thomasfredericks resolved in diff for #82 instead. Thanks!

@thomasfredericks resolved in [diff](https://github.com/thomasfredericks/Bounce2/commit/79db9f00168eaad226d37b72adb80a66c0f98ef8#diff-a44a64df20b3815624fe84ea8f06d066d9eb0140214fb55810a0774938839299) for #82 instead. Thanks!

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Max/thomasfredericks_Bounce2#84