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

Thunderstorm Support #60

Closed
wants to merge 16 commits into from
Closed

Thunderstorm Support #60

wants to merge 16 commits into from

Conversation

Kaiede
Copy link
Owner

@Kaiede Kaiede commented Nov 1, 2018

Adds thunderstorm support for addressing Issue #18.

Kaiede and others added 16 commits October 5, 2018 15:28
libbsd provides access to arc4random_uniform(), which is a better random number generator than the one defined in POSIX. It also happens to coincide nicely with Darwin.

CBSD is a nice wrapper around libbsd on Linux.
Instead of having different tokens for each PWM mode, instead use PWM00-PWM15 naming for each PWM mode. This will make it easier to share schedules in the future.
This enables the use of both sets of hardware PWM pins. 12 and 13 are a little bit easier to use when wiring (they both next to ground pins, unlike 19. Also unlike 19 which is used for SPI, 12 and 13 aren't used for any other purpose than GPIO.

Going forward, it might be a good idea to add something to the configuration that allows the user to pick high or low.
Removes an extra step that we don't really need to do separately. 'swift package show-dependencies' will do the resolve for us.
There’s still some work to be done to allow the lights to be configured for the storm and lightning itself, but this is what’s required to start implementing the events themselves.
A good “random” API was added in Swift 4.2, but we can’t use it yet. But it doesn’t mean we can’t use the API with an implementation backed by arc4random_uniform().
This is the first step towards being able to add the events into the light controller, by having a basic implementation of the event controller.
With a tweak to the EventId enum, we can now load each StormEventController into the light controller, while keeping the keys unique, presumably.
Autogenerated hashing and equatable for enums like EventId is only available on Swift 4.1 and later. So we need a custom hasher for Swift 3.1.1 and 4.0.x.
This refactors the layer code that lunar cycles use for storms. At least for now, if a storm starts, the lights will dim for the storm. No lightning implementation yet.
The storm behavior work is required to produce the lightning strike flashes during a storm. It still needs the pieces that allow the Light Controller to have a ‘stack’ of behaviors to completely function, as well as a way to pop old unwanted behaviors off the stack when done.
This work concludes the main development push for Thor, by integrating the storm behavior into the light controller for lighting strikes.
@Kaiede
Copy link
Owner Author

Kaiede commented Aug 14, 2019

This has gotten so old, the PR should be abandoned and revisited later if needed.

@Kaiede Kaiede closed this Aug 14, 2019
@Kaiede Kaiede deleted the thor branch August 14, 2019 19:36
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