bxparks / AceButton

An adjustable, compact, event-driven button library for Arduino that debounces and dispatches events to a user-defined event handler.
MIT License
393 stars 37 forks source link

Could we make `isLongPressed()` public? #93

Closed Turbine1991 closed 2 years ago

Turbine1991 commented 2 years ago

Hi, I'm overhauling my indicator system in my scooter. It has two buttons for indication.

I cycle through modes by tapping both indicators at the same time. However, I need to process combination taps but ignore it if either is long pressed. Rather than keep my own state tracker, why not make isLongPressed() public?

      if (eventType == AceButton::kEventPressed) {
        if (left.isPressedRaw() && right.isPressedRaw()) { // If both bottons are pressed
          if (!left.isLongPressed() && !right.isLongPressed()) { // Skip if either button is long pressed, taps only
            Serial.println("Both");
          }
        }
      }