I have the following set-up:
A couple of SenseBender Micro's
A Raspberry Pi 2 with the NRF24 connected to the GPIO pins
The RPi runs the PiGatewaySerial
The RPi also runs the pimatic(.org) controller, using the mysensor plugin.
In this set-up I noticed that the RPI misses some messages send by the SenseBender Micro's, especially when messages are send in rapid succession, e.g. when "presenting" the sensors.
I modified the PiGatewaySerial.cpp by using the interrupt generated by the NRF24 (see https://www.raspberrypi.org/forums/viewtopic.php?t=17061&p=290453) and have the interrupt routine run "gw->processRadioMessage();". (And remove this call from the main loop of PiGatewaySerial.cpp). I also use a semaphore to ensure that the NRF24 connected to the RPi is either used by the interrupt routine or by "gw->parseAndSend(buff);", which is the other major item in the main loop.
The result is that no messages are lost anymore. I can share the code if requested.
In the main loop there remains only one polling item "ret = poll(&fds, 1, 500);". I searched quite a bit, but am not able to find a way to make also this call interrupt based. This call waits for about half a second if there is a message that can be read from, in loose terms, "/dev/ttyMySensorsGateway". This waiting for half a second is what makes the RPi miss send messages and which is resolved using the interrupt from the NRF24.
Does anybody know how to make this call "ret = poll(&fds, 1, 500);" using interrupts? I do not like polling!