I'm currently in a middle of one project based on Raspberry Pi with PiFace board. I'm using Java 8 with Java Fx and Pi4J library.
I think I've found a bug in Pi4J library. Let me describe how it look like.
Scenario:
Step 1. For these first two inputs which are shown at the picture above i'm setting from another device low state, constant zero, something around 0,47 volt.
Step 2. With the code:
Code: Select all
piface = new PiFaceDevice(PiFace.DEFAULT_ADDRESS, Spi.CHANNEL_0);
SwitchState switchState = piface.getSwitch(PiFaceSwitch.S1).getState();
Step 3. Now, I send constant high state for both inputs, something around 3,15 volt.
Step 4. With the code from step 2 i'm checking again what state have both inputs. First and the second have OFF state which is correct state.
Step 5. Finally, I'm sending low state for both of them at the same time. There's minimal difference between 'falling down' these states so they are not perfectly synchronized.
These two pictures taken from oscilloscope represents what i've said.
In that case orange line 'falls down' slower.Blue line - input 1
Orange line - input 2
Pi4J library informs:
input 1 state: low (ok)
input 2 state: high (bad)

In that case blue line 'falls down' slower.
Pi4J library informs:
input 1 state: low (bad)
input 2 state: high (ok)

Anyway...oscilloscope shows now low state (ON) for both. Electronic gauge also shows voltage for low state (0,47) for both, but not library. Library shows low state only for just one of them. Low state gets switch which 'falled down' little faster than the other one. The second switch stays with high (OFF) state which is wrong state.
Oscilloscope shows correct values, electronic gauge shows also correct voltages but library don't.
I've checked this state with:
Code: Select all
piface.getSwitch(PiFaceSwitch.S1).getState();Code: Select all
piface.getInputPin(0).getState();I hope that it's not serious (or even) not a bug but maybe i'm not doing (checking) something.
Please, help.
Best regards,
Chris.
