RAK 19700 User Button, Double Click Rate?

Hello, all. I’ve successfully wired in a momentary push-button switch between my RAK 19700 base’s AIN1 and GND. Specified the user button as pin 31 in the device config and now I’ve got a nice little user-button.

The whole process is detailed here:

First off, it works! I can successfully drop into super-deep-sleep mode with a long press on the button. It wakes up again with a simple click of the same button.

A double-click of the same button will also cause the node to initiate an ad-hoc nodeinfo ping.

I couldn’t “see” any evidence of the ping, but hooking up to serial and watching the debug logs shows me that it is acknowledging and responding to the double-click as well…sometimes.

I think it’s got to do with the timming of what Meshtastic determines to be a “double click” versus two closely spaced single-clicks.

At present, it seems I’m only about 50/50 as to whether I get two single clicks back-to-back, or a single double-click.

Is there any way to adjust what the system considers a “double click” from the stand point of timming? It seems if that detection threshold were a little looser, it would “see” the second single click as a double click more consistently.

Also, I’ve noticed if you’ve double clicked a second time within a certain time threshold, the debug shows it reading the double click but opting not to send the ping out if it’s been too soon since the last time. That’s fine, I understand why that’s a feature, but does anyone know what that maximum time between pings is? I don’t want to spam the mesh, but it’s a helpful tool “in the field” for range tests and the like.

I know I could review the source code, and I may end up doing just that, but wanted to put the question out there…and let everyone know you do NOT need an add-on board to obtain a user-button on a RAK19700!

Best to all!

Found it in the source code.

If I’m interpreting this correctly, for multi-clicks, successive clicks have to be (>= 1ms AND <= 250ms) of one another.

Another interesting tidbit here I didn’t realize until looking at the code, a triple-click on nodes with on-board GPS toggles power to the GPS radio, while a quad-click on nodes with e-Ink displays forces a screen refresh.

Here’s a link to the code in-context:

FWIW, I’ve gotten more used to the click-cadence now that I’ve done it enough times. I may put in a low-priority feature request for that…while not at all critical, it seems like making that delay value a user variable might make sense.

I’m eager to see if the software shutdown of the GPS actually saves on battery drain, as I’ve also wired a kill switch between IO2 and GND…but if the soft-switch does the job just the same that makes the IO2 GND redundant…but that’s a different thread.

Best to all,
Pol