Add sk6812rgbw support (#666)

* Removed -HUP so the default -TERM signal is sent instead.
- hyperiond only listens for TERM and INT. HUP is often used to get an exe to reread its config

Changed pgrep to add '-x' so it wont partial match on the exe name.
- I have multiple instances with multiple hyperiond-instance1 names
- this ensures the service script only kills the right process

* reversing errant change to hyperion.systemd.sh

* adding support for SK6812 - not working yet

* Changed rpi_ws281x submodule to be penfold42's fork

* Set White to zero for now

* starting on the code to make the White led do stuff

* Added some basic whie led calculation
white = min(r,g,b)
r-=w, g-=w, b-=w

* cleaned up a couple of compiler warnings

* updated strip type to use corrected RGBW strip type
(the SK6812RGBW datasheet is wrong)

* moved bitpair_to_byte initialiser to (hopefully) work with older GCC

* compiler warning in udp driver
removed some tabs in ws2812b.cpp

* formatting - spaces to tabs

* moved rpi_281x to tag sk6812-v1.0

* attempt #3 at migrating the rpi_281x submodule to my fork/branch

* moving to my fork of rpi_281x

* Started implementing multiple RGB to RGBW conversion options

a quick hack has been implemented inside WS281x.cpp but ive started
moving this to RgbToRgbw.cpp for reuse by other led device types

* migrated RGB to RGBW conversion to RgbToRgbw.cpp


Former-commit-id: ff8e9038c4bb8203b71b42d12bf23be4abcc0b3b
This commit is contained in:
penfold42
2016-06-01 06:55:56 +10:00
committed by brindosch
parent 6fbfda03fa
commit d5ce395e8e
10 changed files with 143 additions and 7 deletions

View File

@@ -1,4 +1,3 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/utils)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/utils)
@@ -12,6 +11,8 @@ add_library(hyperion-utils
${CURRENT_SOURCE_DIR}/ColorRgb.cpp
${CURRENT_HEADER_DIR}/ColorRgba.h
${CURRENT_SOURCE_DIR}/ColorRgba.cpp
${CURRENT_HEADER_DIR}/ColorRgbw.h
${CURRENT_SOURCE_DIR}/ColorRgbw.cpp
${CURRENT_HEADER_DIR}/Image.h
${CURRENT_HEADER_DIR}/Sleep.h
@@ -32,6 +33,9 @@ add_library(hyperion-utils
${CURRENT_HEADER_DIR}/RgbChannelAdjustment.h
${CURRENT_SOURCE_DIR}/RgbChannelAdjustment.cpp
${CURRENT_HEADER_DIR}/RgbToRgbw.h
${CURRENT_SOURCE_DIR}/RgbToRgbw.cpp
${CURRENT_HEADER_DIR}/jsonschema/JsonFactory.h
${CURRENT_HEADER_DIR}/jsonschema/JsonSchemaChecker.h
${CURRENT_SOURCE_DIR}/jsonschema/JsonSchemaChecker.cpp

View File

@@ -0,0 +1,10 @@
// Local includes
#include <utils/ColorRgbw.h>
ColorRgbw ColorRgbw::BLACK = { 0, 0, 0, 0 };
ColorRgbw ColorRgbw::RED = { 255, 0, 0, 0 };
ColorRgbw ColorRgbw::GREEN = { 0, 255, 0, 0 };
ColorRgbw ColorRgbw::BLUE = { 0, 0, 255, 0 };
ColorRgbw ColorRgbw::YELLOW= { 255, 255, 0, 0 };
ColorRgbw ColorRgbw::WHITE = { 0, 0, 0, 255 };

View File

@@ -0,0 +1,24 @@
#include <utils/ColorRgb.h>
#include <utils/ColorRgbw.h>
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, std::string _whiteAlgorithm) {
if (_whiteAlgorithm == "subtract_minimum") {
output->white = std::min(input.red, input.green);
output->white = std::min(output->white, input.blue);
output->red = input.red - output->white;
output->green = input.green - output->white;
output->blue = input.blue - output->white;
}
else if (_whiteAlgorithm == "sub_min_warm_adjust") {
}
else if ( (_whiteAlgorithm == "") || (_whiteAlgorithm == "white_off") ) {
output->red = input.red;
output->green = input.green;
output->blue = input.blue;
output->white = 0;
}
else {
std::cout << "ERROR: unknown whiteAlgorithm " << _whiteAlgorithm << std::endl;
}
}