RoboMagus / OctoPrint-LightControls

Raspberry PI pwm Light controlls plugin for Octoprint
GNU General Public License v3.0
5 stars 2 forks source link

[FR]: software button on GUI? #9

Open morris2009 opened 3 weeks ago

morris2009 commented 3 weeks ago

Hi, first of all thanks for the work performed with regards to hardware PWM for the RPI. I have a 12V ledstrip controlled with a pwm module that wasn't very usefull due to the flickering of the software pwm signal on the RPI 3b. This should make it much more useful.

I was wondering how I could use it with someting like a software button in the GUI to turn on/off the light. And another question, how could I use this together with octolapse to turn on full brightness for the camera snapshot and revert to lower brightness in between. I am not a developer myself, and haven't yet unraveled how I could have octolapse control the LED's via lightcontrols so that the hardware PWM is used. I don't think currently it is able to listen to gcode commands that could be used to control the PWM signal? That might also be a nice feature request for the future. Tnx!

*Edit OK, nevermind the software button question.. I guess my octoprint wasn't reloaded properly because i do see a lights section in the control tab.

RoboMagus commented 3 weeks ago

If I understand correctly, the issue regarding light controls on the Octoprint GUI has resolved itself?

Regarding the automated control of the light values; Currently this plugin only supports Start, Pause, Resume, and End print events to automatically set lights to a specific value. I do not use Octolapse myself, but I'll have to assume that on making a snapshot that plugin does not trigger any of these events. A brief look at that plugins page shows it does have some form of scripting / GCode command options that would run before and after a snapshot is taken.

As this LightControls plugin exposes some form of API that could be used to set the light values using the scripting part of the OctoLapse plugin. As you indicate you're not a programmer however, this could be quite a cumbersome task. Let me know if you're able to get this implemented based on API calls to this plugin. If not, I could probably add some custom @-commands to this plugin that would make it easier for e.g. Octolapse to control the light values.

It's been a while since I've worked on this plugin though, and I'm not actively using it anymore so it could be some time before I could get changes implemented.

morris2009 commented 3 weeks ago

Hi, Tnx for your quick reply. Getting something in scripting wouldn't be very easy for me, but if you have a very simple example, i could probably work from there. Implemeting listening to a @-command would be a huge improvement for this plugin, as from there you could use it in all kind of other plugins that already use insertion of @-commands and from slicers. Octolapse can indeed run a pre-image @-command, or run a pre-image script. If you don't use light-control anymore yourself, what did you change to? Or different printer with built-in lighting?

RoboMagus commented 2 weeks ago

If you don't use light-control anymore yourself, what did you change to? Or different printer with built-in lighting?

I'm not 3D printing that much anymore these days and currently run Octoprint containerized on a mini pc that also runs HomeAssistant, which I've used to automate a different set of lights around my printer. Its not as integrated with Octoprint anymore, but usable enough and easier to maintain all (smart-) devices through HomeAssistant for me.

RoboMagus commented 2 weeks ago

I've had some time to look at other plugins that parse @ Commands and it turned out to be quite easy to add this feature.

As I'm no longer actively using this plugin myself I've not been able to fully test these changes, other than in a simulated environment. The changes are currently released as a Release Candidate / pre-release.

Could you check out these changes by switching release channels to Development to update the plugin and report back to me if this works for you?

The use of these newly added commands are documented here.

morris2009 commented 2 weeks ago

Some small first tests by sending the @LIGHTCONTROL commands manually work perfectly. Am going to test with a print and my setup with Octolapse to check.

Tnx so much for the work!