gigibu5 / OctoLight

24 stars 34 forks source link

Make OctoLight work with RPi's GPIO in BOARD or BCM numbering #36

Closed adrcunha closed 7 months ago

adrcunha commented 2 years ago

Instead of initializing GPIO in BOARD mode, only do it if it's not already setup, otherwise use the already setup mode. Translate pin numbering on-the-fly, thus no UI changes are necessary.

This way, OctoLight works nicely with other plugins that use RPi's GPIO, like OctoPrint Micro Panel.

Tested with OctoPrint 1.7.2 + Python 3.7.3 + OctoPi 0.18.0 + OctoPrint Micro Panel 3.0.1 (all latest versions).

Fixes #29

thomst08 commented 7 months ago

Hey @adrcunha,

Just reaching out, I didn't know about this issue until recently, I have included an update in my fork that fixes this issue, but in a different way, you're more then welcome to use it, branch it, improve it, etc, if that's of interest. This is the one currently in the main OctoPrint plugin list.

https://github.com/thomst08/OctoLight/releases/tag/v0.2.2

But otherwise, this is awesome work :)

adrcunha commented 7 months ago

Hey @thomst08,

Thanks for reaching out. I did check your fork (thanks for that!) but looks like I misread your BCM support because I thought it wouldn't play well with Micro Panel. But now that I rechecked it, I see that I'm wrong. The only missing feature for me is starting OctoPrint with the lights on (see https://github.com/adrcunha/OctoLight/commit/54b9520a5b7c9a46ca542c806beebb403fc31c10). If you're OK with that feature, I'll send you a PR and abandon my fork. :)

Thanks!

thomst08 commented 7 months ago

Please do! That sounds like a good idea.... You could expand that and include that as an event, say the event of octoprint starting? That way, giving the user more options, like an auto turn off or just stay on.

If you see something that can be improved, do it. :)

adrcunha commented 7 months ago

Closing this in favor of @thomst08's fork.