-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement WiLED Protocol (WiLP) and update example sketches #22
Open
seanlano
wants to merge
57
commits into
master
Choose a base branch
from
implement_WiLP
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…et, need to fix in WiLEDProto.cpp)
Add testcases into WiLP implementation branch
…e checksum on incoming messages
…ge type, and add unit tests
…nd unit test for it
seanlano
changed the title
Implement WiLED Protocol (WilP) and update example sketches
Implement WiLED Protocol (WiLP) and update example sketches
Nov 22, 2017
This commit includes the first iteration of code that actually reads the rotary encoder and puts the intended value onto a PWM output.
Previously the Switch library was used externally, but some changes need to be made so it has been added to the WiLED repository.
Due to the limited GPIO on the EPS8266, it is necessary to use the analogue input to read the state of the pushbutton on the rotary encoder. The Switch library was hard-coded to use the digitalRead() function - this commit adds a compile-time option to use analogRead() and do a threshold comparison instead.
Drawing on older code which used ESP-link, this commit adds full lamp output control using the rotary encoder - this means turning the encoder changes the dimming level, and pressing the encoder switch turns the output on or off. Delayed off timer is also implemented, as is the mode setting function (although this does not have any affect at the moment). No wireless functions are implemented yet, but from this commit onwards a WiLED lamp can be used with proper function.
Include a mention of the Switch library and its license, fix other minor wording.
This commit begins to introduce the notion of a hardware abstraction layer - initially with an abstraction for the LED output. Instead of directly using 'analogWrite' in the LEDOutput class, for example, there is a generic function 'setPWM' provided by the HAL that then calls the appropriate 'analogWrite' call for the specific hardware. This doesn't add much for just the ESP8266 - but it will make isolating Arduino specific code much easier.
This commit removes the improper use of "__" (double-underscore). This was mistakenly being used to indicate internal variables, but this actually should not be done because it conflicts with reserved compiler variables.
This commit adds HAL functions for a rotary encoder, a switch, and also adds setup checks to each to ensure pin mode has been set correctly before trying to read or write from the hardware.
The previous 'Rotary' library was hard-coded for Arduino. This commit changes this to instead use the HAL for WiLED. As part of this, the "half-step" feature was removed, as it was not used. Hardware input initialisation is now left to the HAL library.
Some of the functionality in LEDOutput would be better separated into two classes - this commit copies LEDOutput, and further commits will begin to separate features into one or the other.
Instead of calling digitalRead() or analogRead() directly, the Switch class now uses an avaiable HAL wrapper to call hardware-specific functions.
The HAL framework so far was only running on the ESP8266 hardware - this commit creates some special test HAL libraries that can be used with Google Test to check that code using HAL libraries is performing as expected, without the need to check this on real hardware each time.
This commit adds further HAL unit test functions.
Previously, a symbolic link was being used to resolve paths to WiLED libraries - instead now this is handled by an improved Makefile config. Appropriate changes are also made to source files, so they no longer need to use the symbolic link.
With the newly implemented HAL, it is possible to check the logic of the various libraries - this commit implements tests of the Encoder library, by checking both clockwise and counter-clockwise directions, and also testing bouce between states.
The Switch library needed a few things tidied up to work properly with the HAL code. Also added unit tests for some basic use cases.
Adds the necessary changes to the library to support the hal_Millis class for unit testing with time variables. Adds initial basic unit test code. Adds Makefile lines to compile the test.
Added a further unit test for RunMode, to check the output pattern of "Blink Mode 0" worked as expected. In doing so, an off-by-one error was found and corrected.
Check the output pattern of "Blink Mode 1" in the unit test
Check the output pattern of "Blink Mode 2" and "Blink Mode 3" in the unit test
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 PR will bring in an initial feature-complete implementation of the WiLED Protocol, along with examples for both the ESP8266 and Feather M0 hardware types.