New algorithm for Night-to-Day Bulb-Ramping#23
Open
jreinholm wants to merge 1 commit intotimelapseplus:masterfrom
Open
New algorithm for Night-to-Day Bulb-Ramping#23jreinholm wants to merge 1 commit intotimelapseplus:masterfrom
jreinholm wants to merge 1 commit intotimelapseplus:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.