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

Ensure LED fade brightness is never negative #1780

Merged

Conversation

avanwinkle
Copy link
Collaborator

This PR fixes a bug where a FAST LED fade can sometimes calculate a negative brightness. The issue is caused by the fade's start_time being after the current_time.

I've done much investigation into the issue and cannot figure out the root cause, aside from a possible floating-point rounding error that causes the two calls to self.machine.clock.get_time() to yield slightly offset values. I found no systemic or regularly reproducible cause for the issue, so I cannot "fix" it at this time. Instead, just do a safety check to ensure the value is never negative.

Also, did some linting cleanup while the file is changed.

don't be negative

Copy link

sonarcloud bot commented Mar 16, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@avanwinkle avanwinkle merged commit ff98d73 into missionpinball:dev Mar 16, 2024
15 checks passed
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.

1 participant