From 2c02e27197fe848ea0e701f9ba560c0b6ffc61ac Mon Sep 17 00:00:00 2001 From: Joeboyc2 Date: Wed, 23 Sep 2020 16:49:55 +0100 Subject: [PATCH 01/11] Add the ability to override R,G,B,WPIN values Enable the ability to use the -D option in the platform_override.ini to set the pin numbers outside of the file --- wled00/NpbWrapper.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wled00/NpbWrapper.h b/wled00/NpbWrapper.h index dbb867b6c..d867ef86b 100644 --- a/wled00/NpbWrapper.h +++ b/wled00/NpbWrapper.h @@ -88,11 +88,20 @@ #define W2PIN 5 //W2 pin for analog LED strip #undef IR_PIN #else + //Enable override of Pins by using the platformio_override.ini file //PWM pins - PINs 5,12,13,15 are used with Magic Home LED Controller - #define RPIN 5 //R pin for analog LED strip - #define GPIN 12 //G pin for analog LED strip - #define BPIN 15 //B pin for analog LED strip - #define WPIN 13 //W pin for analog LED strip + #ifndef RPIN + #define RPIN 5 //R pin for analog LED strip + #endif + #ifndef GPIN + #define GPIN 12 //G pin for analog LED strip + #endif + #ifndef BPIN + #define BPIN 15 //B pin for analog LED strip + #endif + #ifndef WPIN + #define WPIN 13 //W pin for analog LED strip + #endif #endif #undef RLYPIN #define RLYPIN -1 //disable as pin 12 is used by analog LEDs From 2cc6edd8680352286f3c0a30472d97652b70ec52 Mon Sep 17 00:00:00 2001 From: "S. Seegel" Date: Sun, 27 Sep 2020 01:58:21 +0200 Subject: [PATCH 02/11] Added washing machine FX --- wled00/FX.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ wled00/FX.h | 9 ++++++--- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index d8265c297..611451fd1 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3712,3 +3712,48 @@ uint16_t WS2812FX::mode_dancing_shadows(void) return FRAMETIME; } + +/* + * Generates a tristate square wave w/ attac & decay + * @param x input value 0-255 + * @param pulsewidth 0-127 + * @param attdec attac & decay, max. pulsewidth / 2 + * @returns signed waveform value + */ +int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) { + int8_t a; + if (x > 127) { + a = -127; + x -= 127; + } + else + a = 127; + + if (x < attdec) { //inc to max + return (int16_t) x * a / attdec; + } + else if (x < pulsewidth - attdec) { //max + return a; + } + else if (x < pulsewidth) { //dec to 0 + return (int16_t) (pulsewidth - x) * a / attdec; + } + return 0; +} + +/* + Imitates a washing machine, rotating same waves forward, then pause, then backward. + By Stefan Seegel +*/ +uint16_t WS2812FX::mode_washing_machine(void) { + int8_t speed= tristate_square8((uint16_t) (SEGMENT.speed + 100) * now / 20000, 90, 15) / 15; + + SEGENV.step += speed; + + for (int i=0; i Date: Sun, 27 Sep 2020 11:37:16 +0200 Subject: [PATCH 03/11] Loxone support added (#1185) * A separate socket for UDP api has been added. This uses the same API as HTML. Commands for Loxone were added to the API. * html files for udp api newly generated * codm pixel controller board configurations added to platformio.ini file * Parser for LX/LY commands adapted. Calculation of the values corrected. Segment handling for LX/LY removed. * Lox parser moved to own file. Lox parser added to the JSON api. Within a segment LX and LY are now supported. * serial port removed * F() macro added Co-authored-by: Marius Groos --- platformio.ini | 40 + wled00/data/settings_sync.htm | 4 + wled00/fcn_declare.h | 3 + wled00/html_settings.h | 341 ++-- wled00/html_ui.h | 2933 ++++++++++++++++----------------- wled00/json.cpp | 52 + wled00/lx_parser.cpp | 78 + wled00/set.cpp | 36 + wled00/udp.cpp | 56 +- wled00/wled.cpp | 7 +- wled00/wled.h | 7 +- wled00/wled_eeprom.cpp | 9 + wled00/xml.cpp | 4 + 13 files changed, 1910 insertions(+), 1660 deletions(-) create mode 100644 wled00/lx_parser.cpp diff --git a/platformio.ini b/platformio.ini index 2c6e2717a..825584ef3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -375,3 +375,43 @@ build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build extends = env:esp32dev build_type = debug build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features} + +# ------------------------------------------------------------------------------ +# codm pixel controller board configurations +# ------------------------------------------------------------------------------ + +[env:codm-controller-0.4] +board = esp_wroom_02 +platform = ${common.platform_wled_default} +board_build.ldscript = ${common.ldscript_2m1m} +build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 + +[env:codm-controller-0.4-WS2801] +board = esp_wroom_02 +platform = ${common.platform_latest} +board_build.ldscript = ${common.ldscript_2m1m} +build_flags = ${common.build_flags_esp8266} -D USE_WS2801 -D CLKPIN=13 -D DATAPIN=3 + +[env:codm-controller-0.4-APA102] +board = esp_wroom_02 +platform = ${common.platform_latest} +board_build.ldscript = ${common.ldscript_2m1m} +build_flags = ${common.build_flags_esp8266} -D USE_APA102 -D CLKPIN=13 -D DATAPIN=3 + +[env:codm-controller-0.5] +board = esp_wroom_02 +platform = ${common.platform_wled_default} +board_build.ldscript = ${common.ldscript_2m1m} +build_flags = ${common.build_flags_esp8266} + +[env:codm-controller-0.5-WS2801] +board = esp_wroom_02 +platform = ${common.platform_latest} +board_build.ldscript = ${common.ldscript_2m1m} +build_flags = ${common.build_flags_esp8266} -D USE_WS2801 #-D CLKPIN=0 -D DATAPIN=2 + +[env:codm-controller-0.5-APA102] +board = esp_wroom_02 +platform = ${common.platform_latest} +board_build.ldscript = ${common.ldscript_2m1m} +build_flags = ${common.build_flags_esp8266} -D USE_APA102 #-D CLKPIN=0 -D DATAPIN=2 diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 7c13650e9..2f414ced7 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -38,6 +38,10 @@ Send Alexa notifications:
Send Philips Hue change notifications:
Send Macro notifications:
Send notifications twice: +

UDP Api

+Enable UDP Api:
+Port:
+Reboot required to apply changes.

Realtime

Receive UDP realtime:

Network DMX input
diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 86d20934c..12d4854c0 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -223,4 +223,7 @@ void sappend(char stype, const char* key, int val); void sappends(char stype, const char* key, char* val); void getSettingsJS(byte subPage, char* dest); +//lx_parser.cpp +bool parseLx(int lxValue, int rgbw[4]); + #endif diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 22ed90ca7..b4b96a6fa 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -167,163 +167,163 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; // Autogenerated from wled00/data/settings_ui.htm, do not edit!! const char PAGE_settings_ui[] PROGMEM = R"=====(UI Settings diff --git a/wled00/e131.cpp b/wled00/e131.cpp index bfc135156..12e2ba85c 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -24,8 +24,8 @@ void handleDDPPacket(e131_packet_t* p) { } } - uint16_t offsetLeds = p->channelOffset /3; - uint16_t packetLeds = p->dataLen /3; + uint32_t offsetLeds = htonl(p->channelOffset) /3; + uint16_t packetLeds = htons(p->dataLen) /3; uint8_t* data = p->data; uint16_t c = 0; if (p->flags & DDP_TIMECODE_FLAG) c = 4; //packet has timecode flag, we do not support it, but data starts 4 bytes later diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 6bebd2ebe..98e0c922a 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -357,7 +357,7 @@ onclick="Save()">Save)====="; // Autogenerated from wled00/data/settings_sync.htm, do not edit!! const char PAGE_settings_sync[] PROGMEM = R"=====(Sync Settings