thomst08 / OctoLight

OctoLight with auto turn off and on
7 stars 3 forks source link

Would it be possible to add a button behavior as an option? #5

Closed Mysteoa closed 8 months ago

Mysteoa commented 8 months ago

Hi,

Would it be possible to add a button behavior option that turns the GPIO pin on and then after slight delay off?

With the current solution that I have to turn on some LED, I have to press a button to turn them on or off. The Octolight button is currently configured to act as a toggle. I need to press it 2 times for my light to turn on, and the same for off.

thomst08 commented 8 months ago

Hey @Mysteoa,

I have thought of this but never implemented such a function yet. When you say you press a button, do you mean in the interface (in the toolbar) or do you mean a physical button?

The original idea I had for the toolbar button, was to have a drop down beside the button to select it to toggle off after a while, would this suit your needs?

Mysteoa commented 8 months ago

Sorry about this. I'm having a hard time to finding the correct words to explain, so I might not have been clear.

I have a USB LEDs that has a button on them. When it's pressed, they turn on. I have wired a cable from that button to a GPIO pin. Using your plugin, from the interface, I have to double-click the Light bulb icon to essentially send a short signal. This will turn on the LED. I have to repeat the double click to turn the LEDs off.

What I need is for when I press the toolbar button once, to set the GPIO pin to HIGH and after few ms to LOW.

thomst08 commented 8 months ago

Arrr, I see, you want the plugin to act as a button push (put the pin high then low after a few ms) instead of a always high for on and always low for off.

Is that correct?

Mysteoa commented 8 months ago

Yes, that is correct.

thomst08 commented 8 months ago

I like your suggestion for this setup, I will have a think of how it could be done and possibly implement it when I have a chance. I will keep you posted on if/when I do this.

Mysteoa commented 8 months ago

Thank you.

thomst08 commented 8 months ago

Hey @Mysteoa,

I have released version 0.1.9, this allows you to treat the light pin as a button press. You can control the length of the press and if this function is enabled in the settings. Let me know if that solves your issue.

Mysteoa commented 8 months ago

Thank you for the quick response. Unfortunately, just after my message to you, my OctoPi server decided he will not work anymore. I'm currently trying to figure out why. It only starts in save mode. It probably has something to do with a plugin I installed yesterday, but I have removed it already, and it's not any better. I may have to reinstall it from a BKP.

thomst08 commented 8 months ago

That's ok, let me know when you've had a chance to test it.

Mysteoa commented 8 months ago

I manged to fix OctorPi, not entirely sure how, but it works.

I manged to test it out. It works perfectly. Thank you, @thomst08 Now I need to make a housing for the LED and some other stuff.

thomst08 commented 8 months ago

Excellent, I will mark this issue as solved :)