bxparks / AceButton

An adjustable, compact, event-driven button library for Arduino that debounces and dispatches events to a user-defined event handler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could we make `isLongPressed()` public?

Turbine1991 opened this issue · comments

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");
          }
        }
      }