Use diozero for GPIO (#2171)

The old GPIO abstraction was replaced with
[`diozero`](https://www.diozero.com), which supports most hardware
running Linux due to its use of GPIO character devices provided by the
Linux kernel. `diozero` also supports [alternate
providers](https://www.diozero.com/concepts/providers.html#providers) if
for some reason the character device API is insufficient. Certain
capabilities outside of the character device API is also implemented for
common hardware.

Custom GPIO commands are implemented via a custom `diozero` provider.
The configuration for custom GPIO will need manually updated according
to the Hardware Config documentation page.

The status LED class was also reworked to support additional statuses or
LED indication types, although none have been added yet.

This was tested on a RPi 5 with LL3 illumination LEDs and an RGB status
led attached. All capabilities worked as expected. All 8 status LED
colors were tested and functional via modifying the code. Basic
functionality of custom GPIO was tested with dummy commands.
This commit is contained in:
Alan Everett
2025-12-11 23:28:18 -05:00
committed by GitHub
parent c2433e0332
commit 467f22bfdc
27 changed files with 1031 additions and 1487 deletions

View File

@@ -268,15 +268,15 @@ public class Main {
ConfigManager.getInstance().load(); // init config manager
ConfigManager.getInstance().requestSave();
logger.debug("Loading HardwareManager...");
// Force load the hardware manager
HardwareManager.getInstance();
logger.info("Loading ML models...");
var modelManager = NeuralNetworkModelManager.getInstance();
modelManager.extractModels();
modelManager.discoverModels();
logger.debug("Loading HardwareManager...");
// Force load the hardware manager
HardwareManager.getInstance();
logger.debug("Loading NetworkManager...");
NetworkManager.getInstance().reinitialize();
@@ -306,7 +306,7 @@ public class Main {
VisionSourceManager.getInstance().registerTimedTasks();
logger.info("Starting server...");
HardwareManager.getInstance().setRunning(true);
HardwareManager.getInstance().setError(null);
Server.initialize(DEFAULT_WEBPORT);
}
}