Skip to content

PLR: trigger power lost by timeout #27953

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

Open
wants to merge 2 commits into
base: bugfix-2.1.x
Choose a base branch
from

Conversation

vovodroid
Copy link
Contributor

Trigger power lost event basing on timeout, rather than on cycle counter. It provides more control and allow to skip false triggering.

Depending on UPS/PSU capacitors, DC/AC bed, it could be 0.1-0.5 second. I put default 10ms, I guess it more or less matches current 3 idle() calls.

To prolong this timeout heaters could be disabled during outage period until power is back.

@vovodroid
Copy link
Contributor Author

I see that build tests fails with Marlin/src/feature/powerloss.h:216:42: error: 'POWER_LOSS_TIMEOUT' was not declared in this scope

But there is Copying ConfigurationsRepo/config/examples/Prusa/MK3S-BigTreeTech-BTT002/Configuration_adv.h to Marlin/Configuration_adv.h. Obviously POWER_LOSS_TIMEOUT is not not defined there, because it's new define.

@thisiskeithb
Copy link
Member

I'll mention it again, but these types of changes should be optional in case the current method works better for someone or a user prefers it.

Disable POWER_LOSS_TIMEOUT in the default config (here) and then conditionally change how PLR is triggered if POWER_LOSS_TIMEOUT is enabled. Then add or modify a test so CI checks include it.

@vovodroid
Copy link
Contributor Author

Any advantages of current idle() fixed counter over configurable timeout?

@vovodroid vovodroid force-pushed the plr-power-timeout-pr branch from 1ec9759 to d198f1f Compare July 4, 2025 10:56
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