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

New algorithm for Night-to-Day Bulb-Ramping #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jreinholm
Copy link
Contributor

This algorithm is based on a new rotating buffer similar to iev() that stores light readings over the three hour span at night just before dawn. This buffer is named nightEv(), and is the same size as iev() but light readings are added at a much slower rate to extend it to 3 hours, instead of the integration span. The arrayMedian50() function will then capture a precise level of EV for the darkest part of the night.

If the user starts the TL+ just before dawn, the entire nightEv() array is initialized with the current darkness EV value. It was also necessay to add the following statement to the code when starting bulb-ramping in the dark: lightReading = status.lightStart_f = status.nightTarget_i8, so these values are not set to: light.readIntegratedEv().

In the “RUN_BULB” routine, the algorithm detects when the average light starts going a certain amount above the calculated darkness level (nightLight), and normal bulb-ramping starts from that point. Many flags and condition were added to make sure the time of the sunrise was valid, and then bulb-ramping should continue without interruption until full daylight or whenever.

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