Unmapping/remapping pins
See original GitHub issueIf I create an IO config for a pin with
config = DigitalInput.newConfigBuilder(rpi4j).provider("pigpio-digital-input").id("pin-"+pinNumber).address(pinNumber)....
pin = rpi4j.create(config);
the name “pinX” is registered in the Registry and the pin works accordingly.
If I then want to disconnect the pin I call
pin.shutdown(rpi4j);
which seems to forward the disconnect to pigpio but doesn’t unregister the IO in the Registry.
Any attempt to then create a new config with the same id creates an exception:
com.pi4j.io.exception.IOAlreadyExistsException: IO instance [pin14] already exists in the Pi4J runtime context; unable to create a new instance using this reserved id.
at com.pi4j.provider.impl.ProviderProxyHandler.invoke(ProviderProxyHandler.java:99)
at com.sun.proxy.$Proxy2.create(Unknown Source)
at com.pi4j.context.Context.create(Context.java:309)
at com.pi4j.internal.IOCreator.create(IOCreator.java:60)
at com.pi4j.internal.IOCreator.create(IOCreator.java:101)
at com.pi4j.internal.IOCreator.create(IOCreator.java:189)
...
The registry on the autoContext doesn’t seem to have a way to remove things from it (it is a DefaultRegistry not RuntimeRegistry)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Tutorial: Betaflight Resource Remapping - Oscar Liang
Resource Remapping is an awesome feature in Betaflight, that allows you to swap some pins around on a flight controller.
Read more >Remapping pins to add motors? - IntoFPV Forum
Hello, I have a Kakute F7 mini that has 6 motor inputs that i'm trying to add two more motors to for an...
Read more >6.a. Remapping the Arduino Connections - Pololu
It is easy to cut the connections at these points and establish new connections to replace the broken ones if desired. The following...
Read more >Correct procedure to remap I/O pins
When remapping peripherals to IO pins on the PIC (PIC24FJ256GA106), does one also need to assign the I/O direction of the pins?
Read more >Remap Motors In Betaflight (damaged pins fix) - YouTube
Here I shot you how to determine which it is, and if it is a bad motor output pin then how to remap...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I merged a PR, and i think it should be fine now since v2.2.0
I see @eitch did a commit https://github.com/Pi4J/pi4j-v2/pull/198/files related to this topic.