Trouble with tach - interrupt/GPIO

Greetings all.

I am trying to do something useful while learning node red. Perhaps not ideal but necessary. I have node red loaded on an NanoPi NEO2 and have added node-red-contrib-opi-gpio in order to gain access to gpio and interrupts. If it comes to it, I also have node-red-contrib-python3-function and python3 on board just in case but the function may not be ready enough to use - especially for someone in my situation! I would never know...

The useful thing I am trying to do is periodically check that a pc style fan is turning and possibly get an idea if it is failing (by looking at jitter/ variation between measurements). Fan is not PWM'd at the moment to simplify the timing and may never be. I have about 9 ms period on the tach output between falling edges. As far as I know I have no option to condition the interrupt to capture system (Allwinner H5 based board) timer/clock/counter directly - at least not with the module above. That would be easiest, most CPU efficient and most accurate. The closest I can conceive of to that is to enable pin / interrupt node, capture time, capture time at next interrupt, disable node and then use time difference to determine speed. I don't really need rpm, just a number to track for an increase that would show fan is slowing or stalled. Then periodically repeat. I realize a stalled fan means either no second interrupt if timing is just right or no interrupt at all. I think that part will be easy(er) once I have the first half of the cycle working.

I know the pin and interrupt are 'working' because when I enable it the system bogs down unless I turn the de-bounce way up - effectively limiting the rate of interrupts.

With all the other aspects of NR that I am needing to learn, I am having trouble figuring out how to manage this part of my project. I have come across some possible solutions that involve python in a function but that further complicates the scope since I don't know it either and they would probably need adaptation. The method I have described above is might work and avoids doing everything in a function. I will get to this but please not all at once!

Can anyone point me to or give an example of how I would do this inside NR? I read this "You can poll the pin by sending a message to the node, or you may use interrupt to achieve an event-driven behavior, or use both modes together." in the node/module. I need both modes but it isn't clear to me how I would enable this GPIO node properly and get a usefully precise system time coincident with the interrupts and then disable the pin before another interrupt.

Thanks a lot if you got this far. Double if you can help me out!

Q