Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #3955: added a delay after switching relay #4474

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented Jan 9, 2025

helps to stabilize power on the LEDs before sending data

- helps to stabilize power on the LEDs before sending data
@DedeHai DedeHai added this to the 0.15.1 candidate milestone Jan 9, 2025
Copy link
Collaborator

@softhack007 softhack007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me.

@DedeHai did you check that the delay is only happening once when the relay actually gets switched?

The relay handling code is very old (=hard to read) - a repeated digitalWrite of the same value would not be noticeable, however a repeated delay might hurt ...

@DedeHai
Copy link
Collaborator Author

DedeHai commented Jan 9, 2025

the code is only executed once when exiting offmode: at the end of the function, offmode is disabled.

@DedeHai DedeHai merged commit bb0c0af into Aircoookie:main Jan 9, 2025
19 checks passed
@softhack007
Copy link
Collaborator

👍

@softhack007
Copy link
Collaborator

@DedeHai on a second look - do you think that the same delay should also be added at startup when initially controlling the relay? If yes, then maybe this location should also be changed:

WLED/wled00/wled.cpp

Lines 590 to 593 in bb0c0af

if (rlyPin >= 0) {
pinMode(rlyPin, rlyOpenDrain ? OUTPUT_OPEN_DRAIN : OUTPUT);
digitalWrite(rlyPin, (rlyMde ? bri : !bri));
}

WLED::beginStrip() runs once at startup, long before handleIO() gets called for the first time.

Just a random after-merge thought. Could be I'm just not involved at discord so I missed something important 🤷‍♂️ ...

softhack007 pushed a commit to MoonModules/WLED that referenced this pull request Jan 9, 2025
- helps to stabilize power on the LEDs before sending data
@DedeHai
Copy link
Collaborator Author

DedeHai commented Jan 10, 2025

I thought about that too, but I have noticed recently, that there may be a bug in that part of the code and I wanted to take a closer look at: I did notice in a test, that the relay did not always switch to on depending on config settings and preset settings.
in addition (unrelated): I would like to change the "orange color" behavior at bootup: if there are more than 1 segments, it is impossible to get anything else than orange on the higher numbered segments, which actually puzzles me that there was never a request to change that. or it may just be me: I always shut down my lights with a hard switch rather than putting them in standby, so this behaviour of orange at bootup is annoying.
I have a branch with a fix ready for PR with only one downside: if a new segment is created, it will be black instead of orange, to keep that, the web UI would need to set it so as WLED cannot know if a segment is new or if it changed from a preset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants