RCSwitch implementation works in Pi4j 0.0.5 and not in 1.0

113 views
Skip to first unread message

Jorgen Wortel

unread,
Feb 23, 2016, 11:49:05 AM2/23/16
to Pi4J
I have rewritten the RCSwitch in Java on my raspberry pi. In pi4j 0.0.5 it works without a problem however not in 1.0
I have a simple led between the transmitterpin and ground and in both 0.0.5 and 1.0 the led blinks on the bytes send via the 433 Mhz transmitter.

Bennet Krause

unread,
Mar 1, 2016, 6:32:50 AM3/1/16
to Pi4J
I have the same problem. I use https://github.com/entrusc/Pi-RC-Switch. Switching the outlets works only sometimes, while it works perfectly with the corresponding Arduino library.

Jorgen Wortel

unread,
Mar 1, 2016, 9:53:59 AM3/1/16
to Pi4J
I checked the mentioned library and my code is a bit different. I just converted RCSwitch.cpp to same java logic. And it always works with 0.0.5 and not with 1.0.
I even tried the 1.1 SNAPSHOT release and that doesn't work.

I am not sure where to start looking. Perhaps it is a timing issue but I can see the indicator led blinking when a 'package' is send.

Op dinsdag 1 maart 2016 12:32:50 UTC+1 schreef Bennet Krause:

Robert Savage

unread,
Mar 16, 2016, 6:40:17 PM3/16/16
to Pi4J
How can I help, I'm not sure where to start?

If its a matter of GPIO switching speed .. then yes in the 1.0 release it slowed down quite a bit due to some overhead incurred by safety checks and pin state caching, etc.  We have made an effort in the 1.1-SNAPSHOT builds to optimize and get some of the performance back.  However, if you are really looking for the fastest GPIO switching from Java, then you might want to try using the WiringPi JNI wrapper APIs in Pi4J instead of the standard Pi4J GPIO classes.  These are a lower level API for direct access to the hardware.

The WiringPi JNI wrappers don't incur any of the Pi4J related overhead, they simply make JNI calls directly to the native WiringPi library methods. 
Here is an example program using the WiringPi wrappers for controlling a GPIO pins:

The WiringPi JNI wrappers are here:

Thanks, Robert

 
I am not sure where to start looking. Perhaps it is a timing issue but I can see the indicator led blinking when a 'package' is send.

Op dinsdag 1 maart 2016 12:32:50 UTC+1 schreef Bennet Krause:
I have the same problem. I use https://github.com/entrusc/Pi-RC-Switch. Switching the outlets works only sometimes, while it works perfectly with the corresponding Arduino library.

Am Dienstag, 23. Februar 2016 17:49:05 UTC+1 schrieb Jorgen Wortel:
I have rewritten the RCSwitch in Java on my raspberry pi. In pi4j 0.0.5 it works without a problem however not in 1.0
I have a simple led between the transmitterpin and ground and in both 0.0.5 and 1.0 the led blinks on the bytes send via the 433 Mhz transmitter.


Reply all
Reply to author
Forward
0 new messages