Replies: 6 comments 10 replies
-
If you are getting a kEventDoubleClicked, then it must be detecting a kEventClicked, because the DoubleClicked depends on the Clicked. So it sounds like you changed something in the configuration of Try stripping down your program to get rid of everything but the AceButton related code, insert some |
Beta Was this translation helpful? Give feedback.
-
Well, it still looks buggy to me. I stripped the button code down and ran it with a barest minimum setup and loop code as a kind of clean room test. Those two files are:
Then I included the button file in my large code (~1 MB bin). Thus the code is exactly the same, and I ran it the same way. The outcome is shown next:
In the clean case the AceButton behaves as it should - a short press and some 560 ms later the click is detected. Likewise Double and Long behave as they should. However, the very same code gives quite different answers when incorporated into my large project. The single click's recognition takes very close to 16 sec longer! The double-click is normal, and so is the Long press. However, a spurious Click is detected - I had not touched the button - after again some exactly 16 sec later. You'll note in the code that I have removed the namespace definition which you suggest in your reference code, fearing some overwriting from elsewhere in the source. But this does not seem to be the case. I have also played with feature setting and removing, but no combination brought the proper click recognition back. I am puzzled about the 16 sec delays - is there some last-resort-cleaning done in the code? Somehow my large script has an influence on this button code. What can it possibly be? |
Beta Was this translation helpful? Give feedback.
-
I am not calling But I added the command anyway, and, as expected, nothing changed; clean room works well with and without it, and project still fails on the single click detection with and without it. What ESP do you have? I had WROOM-32, -32D, -32E, PICO, WROVER and it had worked in the past on all of them. AceButton worked so smoothly, I didn't pay much attention :-/ and can't tell when the change occurred. |
Beta Was this translation helpful? Give feedback.
-
The code shown above is still what is used also in the big project, no other calls within it! Your printing request of course has now been added. I also modified some settings to easily distinguish them from defaults. This is the output in setup() after calling my InitButton(): By the way, my AceButton version is 1.8.3, which has no ButtonConfig::getRepeatPressIntervalDelay() ?
Then some other actions occur, and the output becomes:
First, something has overwritten both click and double delay, but not the other. However, the delays are not what the log on button presses says (1st number is millis() output):
So, the click is delayed by >16 sec but it should be delayed by >32 sec, and the double is delayed by 0.3 sec, but should be delayed by >16 sec. How does this fit together? Which actions did the overwriting? I checked all of them, and very clearly, only WiFi activation did it. When I block WiFi, the AceButton is working as it should. And when unblocked, Wifi, and everything else except Acebutton, is working properly. Any chance for those two libs - AceButton and WiFi - creating conflicts? As I said, all of it did work together, and I had touched neither the AceButton code nor the WiFi code for a while, but suddenly this problem turned up. |
Beta Was this translation helpful? Give feedback.
-
How about correcting a wrong index at an array of structures in my code? :-(( Your suggestion of the printouts finally led to the discovery. Phew, that bug must have been there for at least a year. C(++) sucks; time to take a rest and look for Rust? AceButton is now running as smoothly as ever! Sorry for the mess, and thanks for the help. One question: since kEventLongReleased seems to be a new one, is it possible to somehow convert this to a LongLongPress (like 10sec) ? I could use an extra event. |
Beta Was this translation helpful? Give feedback.
-
Mulling over the idea of counting kEventRepeatPressed - I'll call them ticks - I am wondering whether this approach couldn't be used more easily and more flexibly, even to the point of allowing Morse code recognition? Sorry, but as former radio HAM, this isn't far fetched for me. The dot and dash symbols of Morse code have a clear time relationship. One dot has the length of 1 time unit, one dash of 3 time units. The time delay between symbols is equally well defined: within a letter the delay is 1 time unit, between letters 3 time units, and between words 7 units. For a good Morse typist, a time unit might be 50ms. The word ACE will then look like: (# = dot, ### = dash)
The length would then be 30 x 50ms = 1.5 sec. Now let's say the ticks also come 50 ms apart. You would have to look for missing ticks. 1 tick is a dot, 2 is also a dot, 3 is a dash, 4 and perhaps even 5, 6,...(?) also become a dash. Similar for spaces, i.e. lacking ticks. To distinguish an input of just the letter A from a word like ACE, you would have to look ahead for only 3 ticks (or 4, 5 to allow for human imperfection). Or a classic Long might be 20 ticks, a LongLong 100 ticks. But you wouldn't fire a Long after 20 ticks, you'd wait until the user lifts his finger from the button and a break in flow of ticks occurs. Up to a count of 99 it could still be considered as only a Long. It seems reasonable to assume that the user would not be surprised about nothing happening for 80 ticks, because he has still his finger on the button. At the end, ticks are proportional to time in millisec, so counting ticks is basically the same as measuring delays. But it may be easier to count and program? |
Beta Was this translation helpful? Give feedback.
-
I have been using AceButton on an ESP32's 'Boot' button (GPIO 0) and it worked really well with Click, Doubleclick, and Longpress. But suddenly I get no longer a 'Clicked' response, but I still get Double and Long.
I was using version 1.6, and after detecting the problem, I upgraded to 1.8.3, but no change to my problem.
When pressing a button I see a kEventPressed. Pressing again after some 10+ seconds, I see another kEventPressed followed by a kEventDoubleClicked. Doing a doubleclick as fast as I can also gives a correct kEventDoubleClicked.
Longpress still coming correctly after 2 sec (programmed setLongPressDelay(2000);).
Setting 'setClickDelay()' down to 100 or up to 1000 does not make a difference.
How do I get my click back?
Beta Was this translation helpful? Give feedback.
All reactions