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

Implement WiLED Protocol (WiLP) and update example sketches #22

Open
wants to merge 57 commits into
base: master
Choose a base branch
from

Conversation

seanlano
Copy link
Owner

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.

Sean Lanigan and others added 30 commits October 30, 2017 22:45
Add testcases into WiLP implementation branch
@seanlano seanlano changed the title Implement WiLED Protocol (WilP) and update example sketches Implement WiLED Protocol (WiLP) and update example sketches Nov 22, 2017
Sean Lanigan added 23 commits December 27, 2017 14:25
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant