diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d3a466c4..a9804b1f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,43 +2,47 @@ ### Development versions after 0.9.1 release +#### Build 2003300 + +- Major change of project structure from .ino to .cpp and func_declare.h + #### Build 2003262 - - Fixed compilation for Analog LEDs - - Fixed sync settings network port fields too small +- Fixed compilation for Analog LEDs +- Fixed sync settings network port fields too small #### Build 2003261 - - Fixed live preview not displaying whole light if over 255 LEDs +- Fixed live preview not displaying whole light if over 255 LEDs #### Build 2003251 - - Added Pacifica effect (tentative, doesn't yet support other colors) - - Added Atlantica palette - - Fixed ESP32 build of Espalexa +- Added Pacifica effect (tentative, doesn't yet support other colors) +- Added Atlantica palette +- Fixed ESP32 build of Espalexa #### Build 2003222 - - Fixed Alexa Whites on non-RGBW lights (bump Espalexa to 2.4.5) +- Fixed Alexa Whites on non-RGBW lights (bump Espalexa to 2.4.5) #### Build 2003221 - - Moved Cronixie driver from FX library to drawOverlay handler +- Moved Cronixie driver from FX library to drawOverlay handler #### Build 2003211 - - Added custom mapping compile define to FX_fcn.h - - Merged pull request #784 by @TravisDean: Fixed initialization bug when toggling skip first - - Added link to youtube videos by Room31 to readme +- Added custom mapping compile define to FX_fcn.h +- Merged pull request #784 by @TravisDean: Fixed initialization bug when toggling skip first +- Added link to youtube videos by Room31 to readme #### Build 2003141 - - Fixed color of main segment returned in JSON API during transition not being target color (closes #765) - - Fixed arlsLock() being called after pixels set in E1.31 (closes #772) - - Fixed HTTP API calls not having an effect if no segment selected (now applies to main segment) +- Fixed color of main segment returned in JSON API during transition not being target color (closes #765) +- Fixed arlsLock() being called after pixels set in E1.31 (closes #772) +- Fixed HTTP API calls not having an effect if no segment selected (now applies to main segment) #### Build 2003121 - - Created changelog.md - make tracking changes to code easier - - Merged pull request #766 by @pille: Fix E1.31 out-of sequence detection +- Created changelog.md - make tracking changes to code easier +- Merged pull request #766 by @pille: Fix E1.31 out-of sequence detection diff --git a/wled00/alexa.cpp b/wled00/alexa.cpp index e35f5b358..c9f61ff23 100644 --- a/wled00/alexa.cpp +++ b/wled00/alexa.cpp @@ -1,9 +1,13 @@ -#include "alexa.h" #include "wled.h" -#include "const.h" -#include "led.h" -#include "wled_eeprom.h" -#include "colors.h" + +/* + * Alexa Voice On/Off/Brightness/Color Control. Emulates a Philips Hue bridge to Alexa. + * + * This was put together from these two excellent projects: + * https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch + * https://github.com/probonopd/ESP8266HueEmulator + */ +#include "src/dependencies/espalexa/EspalexaDevice.h" #ifndef WLED_DISABLE_ALEXA void onAlexaChange(EspalexaDevice* dev); diff --git a/wled00/alexa.h b/wled00/alexa.h deleted file mode 100644 index c2adfebe3..000000000 --- a/wled00/alexa.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef WLED_ALEXA_H -#define WLED_ALEXA_H -/* - * Alexa Voice On/Off/Brightness Control. Emulates a Philips Hue bridge to Alexa. - * - * This was put together from these two excellent projects: - * https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch - * https://github.com/probonopd/ESP8266HueEmulator - */ -#include "src/dependencies/espalexa/EspalexaDevice.h" - -void onAlexaChange(EspalexaDevice* dev); -void alexaInit(); -void handleAlexa(); -void onAlexaChange(EspalexaDevice* dev); - -#endif // WLED_ALEXA_H \ No newline at end of file diff --git a/wled00/blynk.cpp b/wled00/blynk.cpp index 2307a6942..39b43ba80 100644 --- a/wled00/blynk.cpp +++ b/wled00/blynk.cpp @@ -1,9 +1,9 @@ -#include "blynk.h" -#include "const.h" #include "wled.h" #include "src/dependencies/blynk/Blynk/BlynkHandlers.h" -#include "led.h" -#include "colors.h" + +/* + * Remote light control with the free Blynk app + */ uint16_t blHue = 0; byte blSat = 255; diff --git a/wled00/blynk.h b/wled00/blynk.h deleted file mode 100644 index f17f774a0..000000000 --- a/wled00/blynk.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef WLED_BLYNK_H -#define WLED_BLYNK_H -#include -/* - * Remote light control with the free Blynk app - */ - -void initBlynk(const char* auth); -void handleBlynk(); -void updateBlynk(); -// TODO: Make sure that the macro expansions are handled correctly. - -#endif //WLED_BLYNK_H \ No newline at end of file diff --git a/wled00/button.cpp b/wled00/button.cpp index a80061eeb..e71cce965 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -1,8 +1,4 @@ -#include "button.h" #include "wled.h" -#include "led.h" -#include "wled_eeprom.h" -#include "set.h" /* * Physical IO diff --git a/wled00/button.h b/wled00/button.h deleted file mode 100644 index f974888e7..000000000 --- a/wled00/button.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef WLED_BUTTON_H -#define WLED_BUTTON_H -#include -/* - * Physical IO - */ - -void shortPressAction(); -void handleButton(); -void handleIO(); - -#endif // WLED_BUTTON_H \ No newline at end of file diff --git a/wled00/colors.cpp b/wled00/colors.cpp index 6f2477574..f76499a01 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -1,6 +1,9 @@ -#include "colors.h" #include "wled.h" +/* + * Color conversion methods + */ + void colorFromUint32(uint32_t in, bool secondary) { if (secondary) { diff --git a/wled00/colors.h b/wled00/colors.h deleted file mode 100644 index 85e0adb50..000000000 --- a/wled00/colors.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef WLED_COLORS_H -#define WLED_COLORS_H -#include -/* - * Color conversion methods - */ - -void colorFromUint32(uint32_t in, bool secondary = false); -void colorFromUint24(uint32_t in, bool secondary = false); -void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0); -void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb -void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb - -void colorXYtoRGB(float x, float y, byte* rgb); // only defined if huesync disabled TODO -void colorRGBtoXY(byte* rgb, float* xy); // only defined if huesync disabled TODO - -void colorFromDecOrHexString(byte* rgb, char* in); -void colorRGBtoRGBW(byte* rgb); //rgb to rgbw (http://codewelt.com/rgbw). (RGBW_MODE_LEGACY) - -#endif //WLED_COLORS_H \ No newline at end of file diff --git a/wled00/const.h b/wled00/const.h index 21be19536..535a59870 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -1,5 +1,5 @@ -#ifndef wled_const_h -#define wled_const_h +#ifndef WLED_CONST_H +#define WLED_CONST_H //Defaults #define DEFAULT_CLIENT_SSID "Your_Network" @@ -72,4 +72,7 @@ #define HUE_ERROR_TIMEOUT 251 #define HUE_ERROR_ACTIVE 255 +//EEPROM size +#define EEPSIZE 2560 //Maximum is 4096 + #endif diff --git a/wled00/cronixie.cpp b/wled00/cronixie.cpp deleted file mode 100644 index e3b951b86..000000000 --- a/wled00/cronixie.cpp +++ /dev/null @@ -1,243 +0,0 @@ -#include "cronixie.h" -#include "wled.h" - -#ifndef WLED_DISABLE_CRONIXIE -byte _digitOut[6] = {10,10,10,10,10,10}; - -byte getSameCodeLength(char code, int index, char const cronixieDisplay[]) -{ - byte counter = 0; - - for (int i = index+1; i < 6; i++) - { - if (cronixieDisplay[i] == code) - { - counter++; - } else { - return counter; - } - } - return counter; -} - -void setCronixie() -{ - /* - * digit purpose index - * 0-9 | 0-9 (incl. random) - * 10 | blank - * 11 | blank, bg off - * 12 | test upw. - * 13 | test dnw. - * 14 | binary AM/PM - * 15 | BB upper +50 for no trailing 0 - * 16 | BBB - * 17 | BBBB - * 18 | BBBBB - * 19 | BBBBBB - * 20 | H - * 21 | HH - * 22 | HHH - * 23 | HHHH - * 24 | M - * 25 | MM - * 26 | MMM - * 27 | MMMM - * 28 | MMMMM - * 29 | MMMMMM - * 30 | S - * 31 | SS - * 32 | SSS - * 33 | SSSS - * 34 | SSSSS - * 35 | SSSSSS - * 36 | Y - * 37 | YY - * 38 | YYYY - * 39 | I - * 40 | II - * 41 | W - * 42 | WW - * 43 | D - * 44 | DD - * 45 | DDD - * 46 | V - * 47 | VV - * 48 | VVV - * 49 | VVVV - * 50 | VVVVV - * 51 | VVVVVV - * 52 | v - * 53 | vv - * 54 | vvv - * 55 | vvvv - * 56 | vvvvv - * 57 | vvvvvv - */ - - //H HourLower | HH - Hour 24. | AH - Hour 12. | HHH Hour of Month | HHHH Hour of Year - //M MinuteUpper | MM Minute of Hour | MMM Minute of 12h | MMMM Minute of Day | MMMMM Minute of Month | MMMMMM Minute of Year - //S SecondUpper | SS Second of Minute | SSS Second of 10 Minute | SSSS Second of Hour | SSSSS Second of Day | SSSSSS Second of Week - //B AM/PM | BB 0-6/6-12/12-18/18-24 | BBB 0-3... | BBBB 0-1.5... | BBBBB 0-1 | BBBBBB 0-0.5 - - //Y YearLower | YY - Year LU | YYYY - Std. - //I MonthLower | II - Month of Year - //W Week of Month | WW Week of Year - //D Day of Week | DD Day Of Month | DDD Day Of Year - - DEBUG_PRINT("cset "); - DEBUG_PRINTLN(cronixieDisplay); - - overlayRefreshMs = 1997; //Only refresh every 2secs if no seconds are displayed - - for (int i = 0; i < 6; i++) - { - dP[i] = 10; - switch (cronixieDisplay[i]) - { - case '_': dP[i] = 10; break; - case '-': dP[i] = 11; break; - case 'r': dP[i] = random(1,7); break; //random btw. 1-6 - case 'R': dP[i] = random(0,10); break; //random btw. 0-9 - //case 't': break; //Test upw. - //case 'T': break; //Test dnw. - case 'b': dP[i] = 14 + getSameCodeLength('b',i,cronixieDisplay); i = i+dP[i]-14; break; - case 'B': dP[i] = 14 + getSameCodeLength('B',i,cronixieDisplay); i = i+dP[i]-14; break; - case 'h': dP[i] = 70 + getSameCodeLength('h',i,cronixieDisplay); i = i+dP[i]-70; break; - case 'H': dP[i] = 20 + getSameCodeLength('H',i,cronixieDisplay); i = i+dP[i]-20; break; - case 'A': dP[i] = 108; i++; break; - case 'a': dP[i] = 58; i++; break; - case 'm': dP[i] = 74 + getSameCodeLength('m',i,cronixieDisplay); i = i+dP[i]-74; break; - case 'M': dP[i] = 24 + getSameCodeLength('M',i,cronixieDisplay); i = i+dP[i]-24; break; - case 's': dP[i] = 80 + getSameCodeLength('s',i,cronixieDisplay); i = i+dP[i]-80; overlayRefreshMs = 497; break; //refresh more often bc. of secs - case 'S': dP[i] = 30 + getSameCodeLength('S',i,cronixieDisplay); i = i+dP[i]-30; overlayRefreshMs = 497; break; - case 'Y': dP[i] = 36 + getSameCodeLength('Y',i,cronixieDisplay); i = i+dP[i]-36; break; - case 'y': dP[i] = 86 + getSameCodeLength('y',i,cronixieDisplay); i = i+dP[i]-86; break; - case 'I': dP[i] = 39 + getSameCodeLength('I',i,cronixieDisplay); i = i+dP[i]-39; break; //Month. Don't ask me why month and minute both start with M. - case 'i': dP[i] = 89 + getSameCodeLength('i',i,cronixieDisplay); i = i+dP[i]-89; break; - //case 'W': break; - //case 'w': break; - case 'D': dP[i] = 43 + getSameCodeLength('D',i,cronixieDisplay); i = i+dP[i]-43; break; - case 'd': dP[i] = 93 + getSameCodeLength('d',i,cronixieDisplay); i = i+dP[i]-93; break; - case '0': dP[i] = 0; break; - case '1': dP[i] = 1; break; - case '2': dP[i] = 2; break; - case '3': dP[i] = 3; break; - case '4': dP[i] = 4; break; - case '5': dP[i] = 5; break; - case '6': dP[i] = 6; break; - case '7': dP[i] = 7; break; - case '8': dP[i] = 8; break; - case '9': dP[i] = 9; break; - //case 'V': break; //user var0 - //case 'v': break; //user var1 - } - } - DEBUG_PRINT("result "); - for (int i = 0; i < 5; i++) - { - DEBUG_PRINT((int)dP[i]); - DEBUG_PRINT(" "); - } - DEBUG_PRINTLN((int)dP[5]); - - _overlayCronixie(); //refresh -} - -void _overlayCronixie() -{ - byte h = hour(local); - byte h0 = h; - byte m = minute(local); - byte s = second(local); - byte d = day(local); - byte mi = month(local); - int y = year(local); - //this has to be changed in time for 22nd century - y -= 2000; if (y<0) y += 30; //makes countdown work - - if (useAMPM && !countdownMode) - { - if (h>12) h-=12; - else if (h==0) h+=12; - } - for (int i = 0; i < 6; i++) - { - if (dP[i] < 12) _digitOut[i] = dP[i]; - else { - if (dP[i] < 65) - { - switch(dP[i]) - { - case 21: _digitOut[i] = h/10; _digitOut[i+1] = h- _digitOut[i]*10; i++; break; //HH - case 25: _digitOut[i] = m/10; _digitOut[i+1] = m- _digitOut[i]*10; i++; break; //MM - case 31: _digitOut[i] = s/10; _digitOut[i+1] = s- _digitOut[i]*10; i++; break; //SS - - case 20: _digitOut[i] = h- (h/10)*10; break; //H - case 24: _digitOut[i] = m/10; break; //M - case 30: _digitOut[i] = s/10; break; //S - - case 43: _digitOut[i] = weekday(local); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //D - case 44: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; i++; break; //DD - case 40: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; i++; break; //II - case 37: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //YY - case 39: _digitOut[i] = 2; _digitOut[i+1] = 0; _digitOut[i+2] = y/10; _digitOut[i+3] = y- _digitOut[i+2]*10; i+=3; break; //YYYY - - //case 16: _digitOut[i+2] = ((h0/3)&1)?1:0; i++; //BBB (BBBB NI) - //case 15: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:0; i++; //BB - case 14: _digitOut[i] = (h0>11)?1:0; break; //B - } - } else - { - switch(dP[i]) - { - case 71: _digitOut[i] = h/10; _digitOut[i+1] = h- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //hh - case 75: _digitOut[i] = m/10; _digitOut[i+1] = m- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //mm - case 81: _digitOut[i] = s/10; _digitOut[i+1] = s- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ss - //case 66: _digitOut[i+2] = ((h0/3)&1)?1:10; i++; //bbb (bbbb NI) - //case 65: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:10; i++; //bb - case 64: _digitOut[i] = (h0>11)?1:10; break; //b - - case 93: _digitOut[i] = weekday(local); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //d - case 94: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //dd - case 90: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ii - case 87: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //yy - case 89: _digitOut[i] = 2; _digitOut[i+1] = 0; _digitOut[i+2] = y/10; _digitOut[i+3] = y- _digitOut[i+2]*10; i+=3; break; //yyyy - } - } - } - } -} - -void _drawOverlayCronixie() -{ - byte offsets[] = {5, 0, 6, 1, 7, 2, 8, 3, 9, 4}; - - for (uint16_t i = 0; i < 6; i++) - { - byte o = 10*i; - byte excl = 10; - if(_digitOut[i] < 10) excl = offsets[_digitOut[i]]; - excl += o; - - if (cronixieBacklight && _digitOut[i] <11) - { - uint32_t col = strip.gamma32(strip.getSegment(0).colors[1]); - for (uint16_t j=o; j< o+10; j++) { - if (j != excl) strip.setPixelColor(j, col); - } - } else - { - for (uint16_t j=o; j< o+10; j++) { - if (j != excl) strip.setPixelColor(j, 0); - } - } - } -} - -#else // WLED_DISABLE_CRONIXIE -byte getSameCodeLength(char code, int index, char const cronixieDisplay[]) {} -void setCronixie() {} -void _overlayCronixie() {} -void _drawOverlayCronixie() {} -#endif diff --git a/wled00/cronixie.h b/wled00/cronixie.h deleted file mode 100644 index f6eea6b43..000000000 --- a/wled00/cronixie.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef WLED_CRONIXIE_H -#define WLED_CRONIXIE_H -#include -/* - * Support for the Cronixie clock - */ - -byte getSameCodeLength(char code, int index, char const cronixieDisplay[]); -void setCronixie(); -void _overlayCronixie(); -void _drawOverlayCronixie(); - -#endif // WLED_CRONIXIE_H \ No newline at end of file diff --git a/wled00/dmx.h b/wled00/dmx.cpp similarity index 96% rename from wled00/dmx.h rename to wled00/dmx.cpp index 0ab2a4a20..596624a6e 100644 --- a/wled00/dmx.h +++ b/wled00/dmx.cpp @@ -1,6 +1,5 @@ -#ifndef WLED_DMX_H -#define WLED_DMX_H #include "wled.h" + /* * Support for DMX via MAX485. * Change the output pin in src/dependencies/ESPDMX.cpp if needed. @@ -61,5 +60,3 @@ void handleDMX() #else void handleDMX() {} #endif - -#endif //WLED_DMX_H \ No newline at end of file diff --git a/wled00/e131.cpp b/wled00/e131.cpp new file mode 100644 index 000000000..2034f84d9 --- /dev/null +++ b/wled00/e131.cpp @@ -0,0 +1,144 @@ +#include "wled.h" + +/* + * E1.31 handler + */ + +void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ + //E1.31 protocol support + + uint16_t uni = htons(p->universe); + uint8_t previousUniverses = uni - e131Universe; + uint16_t possibleLEDsInCurrentUniverse; + uint16_t dmxChannels = htons(p->property_value_count) -1; + + // only listen for universes we're handling & allocated memory + if (uni >= (e131Universe + E131_MAX_UNIVERSE_COUNT)) return; + + if (e131SkipOutOfSequence) + if (p->sequence_number < e131LastSequenceNumber[uni-e131Universe] && p->sequence_number > 20 && e131LastSequenceNumber[uni-e131Universe] < 250){ + DEBUG_PRINT("skipping E1.31 frame (last seq="); + DEBUG_PRINT(e131LastSequenceNumber[uni-e131Universe]); + DEBUG_PRINT(", current seq="); + DEBUG_PRINT(p->sequence_number); + DEBUG_PRINT(", universe="); + DEBUG_PRINT(uni); + DEBUG_PRINTLN(")"); + return; + } + e131LastSequenceNumber[uni-e131Universe] = p->sequence_number; + + // update status info + realtimeIP = clientIP; + + switch (DMXMode) { + case DMX_MODE_DISABLED: + return; // nothing to do + break; + + case DMX_MODE_SINGLE_RGB: + if (uni != e131Universe) return; + if (dmxChannels-DMXAddress+1 < 3) return; + arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); + for (uint16_t i = 0; i < ledCount; i++) + setRealtimePixel(i, p->property_values[DMXAddress+0], p->property_values[DMXAddress+1], p->property_values[DMXAddress+2], 0); + break; + + case DMX_MODE_SINGLE_DRGB: + if (uni != e131Universe) return; + if (dmxChannels-DMXAddress+1 < 4) return; + arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); + if (DMXOldDimmer != p->property_values[DMXAddress+0]) { + DMXOldDimmer = p->property_values[DMXAddress+0]; + bri = p->property_values[DMXAddress+0]; + strip.setBrightness(bri); + } + for (uint16_t i = 0; i < ledCount; i++) + setRealtimePixel(i, p->property_values[DMXAddress+1], p->property_values[DMXAddress+2], p->property_values[DMXAddress+3], 0); + break; + + case DMX_MODE_EFFECT: + if (uni != e131Universe) return; + if (dmxChannels-DMXAddress+1 < 11) return; + if (DMXOldDimmer != p->property_values[DMXAddress+0]) { + DMXOldDimmer = p->property_values[DMXAddress+0]; + bri = p->property_values[DMXAddress+0]; + } + if (p->property_values[DMXAddress+1] < MODE_COUNT) + effectCurrent = p->property_values[DMXAddress+ 1]; + effectSpeed = p->property_values[DMXAddress+ 2]; // flickers + effectIntensity = p->property_values[DMXAddress+ 3]; + effectPalette = p->property_values[DMXAddress+ 4]; + col[0] = p->property_values[DMXAddress+ 5]; + col[1] = p->property_values[DMXAddress+ 6]; + col[2] = p->property_values[DMXAddress+ 7]; + colSec[0] = p->property_values[DMXAddress+ 8]; + colSec[1] = p->property_values[DMXAddress+ 9]; + colSec[2] = p->property_values[DMXAddress+10]; + if (dmxChannels-DMXAddress+1 > 11) + { + col[3] = p->property_values[DMXAddress+11]; //white + colSec[3] = p->property_values[DMXAddress+12]; + } + transitionDelayTemp = 0; // act fast + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); // don't send UDP + return; // don't activate realtime live mode + break; + + case DMX_MODE_MULTIPLE_RGB: + arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); + if (previousUniverses == 0) { + // first universe of this fixture + possibleLEDsInCurrentUniverse = (dmxChannels - DMXAddress + 1) / 3; + for (uint16_t i = 0; i < ledCount; i++) { + if (i >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) + setRealtimePixel(i, p->property_values[DMXAddress+i*3+0], p->property_values[DMXAddress+i*3+1], p->property_values[DMXAddress+i*3+2], 0); + } + } else if (previousUniverses > 0 && uni < (e131Universe + E131_MAX_UNIVERSE_COUNT)) { + // additional universe(s) of this fixture + uint16_t numberOfLEDsInPreviousUniverses = ((512 - DMXAddress + 1) / 3); // first universe + if (previousUniverses > 1) numberOfLEDsInPreviousUniverses += (512 / 3) * (previousUniverses - 1); // extended universe(s) before current + possibleLEDsInCurrentUniverse = dmxChannels / 3; + for (uint16_t i = numberOfLEDsInPreviousUniverses; i < ledCount; i++) { + uint8_t j = i - numberOfLEDsInPreviousUniverses; + if (j >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) + setRealtimePixel(i, p->property_values[j*3+1], p->property_values[j*3+2], p->property_values[j*3+3], 0); + } + } + break; + + case DMX_MODE_MULTIPLE_DRGB: + arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); + if (previousUniverses == 0) { + // first universe of this fixture + if (DMXOldDimmer != p->property_values[DMXAddress+0]) { + DMXOldDimmer = p->property_values[DMXAddress+0]; + bri = p->property_values[DMXAddress+0]; + strip.setBrightness(bri); + } + possibleLEDsInCurrentUniverse = (dmxChannels - DMXAddress) / 3; + for (uint16_t i = 0; i < ledCount; i++) { + if (i >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) + setRealtimePixel(i, p->property_values[DMXAddress+i*3+1], p->property_values[DMXAddress+i*3+2], p->property_values[DMXAddress+i*3+3], 0); + } + } else if (previousUniverses > 0 && uni < (e131Universe + E131_MAX_UNIVERSE_COUNT)) { + // additional universe(s) of this fixture + uint16_t numberOfLEDsInPreviousUniverses = ((512 - DMXAddress + 1) / 3); // first universe + if (previousUniverses > 1) numberOfLEDsInPreviousUniverses += (512 / 3) * (previousUniverses - 1); // extended universe(s) before current + possibleLEDsInCurrentUniverse = dmxChannels / 3; + for (uint16_t i = numberOfLEDsInPreviousUniverses; i < ledCount; i++) { + uint8_t j = i - numberOfLEDsInPreviousUniverses; + if (j >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) + setRealtimePixel(i, p->property_values[j*3+1], p->property_values[j*3+2], p->property_values[j*3+3], 0); + } + } + break; + + default: + DEBUG_PRINTLN("unknown E1.31 DMX mode"); + return; // nothing to do + break; + } + + e131NewData = true; +} diff --git a/wled00/file.cpp b/wled00/file.cpp index dba27d4fe..eb0dcb931 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -1,7 +1,8 @@ -#include "file.h" #include "wled.h" -#include "led.h" -#include "notify.h" + +/* + * Utility for SPIFFS filesystem + */ //filesystem #ifndef WLED_DISABLE_FILESYSTEM @@ -12,85 +13,6 @@ #include "SPIFFSEditor.h" #endif -enum class AdaState { - Header_A, - Header_d, - Header_a, - Header_CountHi, - Header_CountLo, - Header_CountCheck, - Data_Red, - Data_Green, - Data_Blue -}; - -// Maybe Adalight should not be in filehandling? TODO -void handleSerial() -{ - #ifdef WLED_ENABLE_ADALIGHT - static auto state = AdaState::Header_A; - static uint16_t count = 0; - static uint16_t pixel = 0; - static byte check = 0x00; - static byte red = 0x00; - static byte green = 0x00; - - while (Serial.available() > 0) - { - yield(); - byte next = Serial.read(); - switch (state) { - case AdaState::Header_A: - if (next == 'A') state = AdaState::Header_d; - break; - case AdaState::Header_d: - if (next == 'd') state = AdaState::Header_a; - else state = AdaState::Header_A; - break; - case AdaState::Header_a: - if (next == 'a') state = AdaState::Header_CountHi; - else state = AdaState::Header_A; - break; - case AdaState::Header_CountHi: - pixel = 0; - count = next * 0x100; - check = next; - state = AdaState::Header_CountLo; - break; - case AdaState::Header_CountLo: - count += next + 1; - check = check ^ next ^ 0x55; - state = AdaState::Header_CountCheck; - break; - case AdaState::Header_CountCheck: - if (check == next) state = AdaState::Data_Red; - else state = AdaState::Header_A; - break; - case AdaState::Data_Red: - red = next; - state = AdaState::Data_Green; - break; - case AdaState::Data_Green: - green = next; - state = AdaState::Data_Blue; - break; - case AdaState::Data_Blue: - byte blue = next; - setRealtimePixel(pixel++, red, green, blue, 0); - if (--count > 0) state = AdaState::Data_Red; - else { - if (!realtimeMode && bri == 0) strip.setBrightness(briLast); - arlsLock(realtimeTimeoutMs, REALTIME_MODE_ADALIGHT); - - strip.show(); - state = AdaState::Header_A; - } - break; - } - } - #endif -} - #if !defined WLED_DISABLE_FILESYSTEM && defined WLED_ENABLE_FS_SERVING //Un-comment any file types you need diff --git a/wled00/file.h b/wled00/file.h deleted file mode 100644 index 90731db67..000000000 --- a/wled00/file.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef WLED_FILE_H -#define WLED_FILE_H -#include -#include -/* - * Utility for SPIFFS filesystem & Serial console - */ - -void handleSerial(); -bool handleFileRead(AsyncWebServerRequest*, String path); - -#endif // WLED_FILE_H \ No newline at end of file diff --git a/wled00/func_declare.h b/wled00/func_declare.h new file mode 100644 index 000000000..db3cb4bc4 --- /dev/null +++ b/wled00/func_declare.h @@ -0,0 +1,183 @@ +#ifndef WLED_FUNC_DECLARE_H +#define WLED_FUNC_DECLARE_H +#include +#include "src/dependencies/espalexa/EspalexaDevice.h" +#include "src/dependencies/e131/ESPAsyncE131.h" + +/* + * All globally accessible functions are declared here + */ + +//alexa.cpp +void onAlexaChange(EspalexaDevice* dev); +void alexaInit(); +void handleAlexa(); +void onAlexaChange(EspalexaDevice* dev); + +//blynk.cpp +void initBlynk(const char* auth); +void handleBlynk(); +void updateBlynk(); + +//button.cpp +void shortPressAction(); +void handleButton(); +void handleIO(); + +//colors.cpp +void colorFromUint32(uint32_t in, bool secondary = false); +void colorFromUint24(uint32_t in, bool secondary = false); +void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0); +void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb +void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb + +void colorXYtoRGB(float x, float y, byte* rgb); // only defined if huesync disabled TODO +void colorRGBtoXY(byte* rgb, float* xy); // only defined if huesync disabled TODO + +void colorFromDecOrHexString(byte* rgb, char* in); +void colorRGBtoRGBW(byte* rgb); //rgb to rgbw (http://codewelt.com/rgbw). (RGBW_MODE_LEGACY) + +//e131.cpp +void handleE131Packet(e131_packet_t* p, IPAddress clientIP); + +//file.cpp +bool handleFileRead(AsyncWebServerRequest*, String path); + +//dmx.cpp +void handleDMX(); + +//hue.cpp +void handleHue(); +void reconnectHue(); +void onHueError(void* arg, AsyncClient* client, int8_t error); +void onHueConnect(void* arg, AsyncClient* client); +void sendHuePoll(); +void onHueData(void* arg, AsyncClient* client, void *data, size_t len); + +//ir.cpp +bool decodeIRCustom(uint32_t code); +void relativeChange(byte* property, int8_t amount, byte lowerBoundary = 0, byte higherBoundary = 0xFF); +void changeEffectSpeed(int8_t amount); +void changeEffectIntensity(int8_t amount); +void decodeIR(uint32_t code); +void decodeIR24(uint32_t code); +void decodeIR24OLD(uint32_t code); +void decodeIR24CT(uint32_t code); +void decodeIR40(uint32_t code); +void decodeIR44(uint32_t code); +void decodeIR21(uint32_t code); +void decodeIR6(uint32_t code); + +void initIR(); +void handleIR(); + +//json.cpp +#include "ESPAsyncWebServer.h" +#include "src/dependencies/json/ArduinoJson-v6.h" +#include "src/dependencies/json/AsyncJson-v6.h" +#include "FX.h" +// TODO: AsynicWebServerRequest conflict? + +void deserializeSegment(JsonObject elem, byte it); +bool deserializeState(JsonObject root); +void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id); +void serializeState(JsonObject root); +void serializeInfo(JsonObject root); +void serveJson(AsyncWebServerRequest* request); +void serveLiveLeds(AsyncWebServerRequest* request); + +//led.cpp +void setValuesFromMainSeg(); +void resetTimebase(); +void toggleOnOff(); +void setAllLeds(); +void setLedsStandard(bool justColors = false); +bool colorChanged(); +void colorUpdated(int callMode); +void updateInterfaces(uint8_t callMode); +void handleTransitions(); +void handleNightlight(); + +//mqtt.cpp +bool initMqtt(); +void publishMqtt(); + +//notify.cpp +void notify(byte callMode, bool followUp=false); +void arlsLock(uint32_t timeoutMs, byte md = REALTIME_MODE_GENERIC); +void handleNotifications(); +void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w); + +//ntp.cpp +void handleNetworkTime(); +void sendNTPPacket(); +bool checkNTPResponse(); +void updateLocalTime(); +void getTimeString(char* out); +bool checkCountdown(); +void setCountdown(); +byte weekdayMondayFirst(); +void checkTimers(); + +//overlay.cpp +void initCronixie(); +void handleOverlays(); +void handleOverlayDraw(); +void _overlayAnalogCountdown(); +void _overlayAnalogClock(); + +byte getSameCodeLength(char code, int index, char const cronixieDisplay[]); +void setCronixie(); +void _overlayCronixie(); +void _drawOverlayCronixie(); + +//set.cpp +void _setRandomColor(bool _sec,bool fromButton=false); +bool isAsterisksOnly(const char* str, byte maxLen); +void handleSettingsSet(AsyncWebServerRequest *request, byte subPage); +bool handleSet(AsyncWebServerRequest *request, const String& req); +int getNumVal(const String* req, uint16_t pos); +bool updateVal(const String* req, const char* key, byte* val, byte minv=0, byte maxv=255); + +//usermod.cpp +void userSetup(); +void userConnected(); +void userLoop(); + +//wled_eeprom.cpp +void commit(); +void clearEEPROM(); +void writeStringToEEPROM(uint16_t pos, char* str, uint16_t len); +void readStringFromEEPROM(uint16_t pos, char* str, uint16_t len); +void saveSettingsToEEPROM(); +void loadSettingsFromEEPROM(bool first); +void savedToPresets(); +bool applyPreset(byte index, bool loadBri = true); +void savePreset(byte index, bool persist = true); +void loadMacro(byte index, char* m); +void applyMacro(byte index); +void saveMacro(byte index, String mc, bool persist = true); //only commit on single save, not in settings + +//wled_serial.cpp +void handleSerial(); + +//wled_server.cpp +bool isIp(String str); +bool captivePortal(AsyncWebServerRequest *request); +void initServer(); +void serveIndexOrWelcome(AsyncWebServerRequest *request); +void serveIndex(AsyncWebServerRequest* request); +String msgProcessor(const String& var); +void serveMessage(AsyncWebServerRequest* request, uint16_t code, String headl, String subl="", byte optionT=255); +String settingsProcessor(const String& var); +String dmxProcessor(const String& var); +void serveSettings(AsyncWebServerRequest* request); + +//xml.cpp +char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr); +char* URL_response(AsyncWebServerRequest *request); +void sappend(char stype, const char* key, int val); +void sappends(char stype, const char* key, char* val); +void getSettingsJS(byte subPage, char* dest); + +#endif diff --git a/wled00/hue.cpp b/wled00/hue.cpp index a186a3144..77091f63e 100644 --- a/wled00/hue.cpp +++ b/wled00/hue.cpp @@ -1,9 +1,8 @@ -#include "hue.h" #include "wled.h" -#include "colors.h" -#include "wled_eeprom.h" -#include "notify.h" -#include "led.h" + +/* + * Sync to Philips hue lights + */ #ifndef WLED_DISABLE_HUESYNC diff --git a/wled00/hue.h b/wled00/hue.h deleted file mode 100644 index 7ce629fbe..000000000 --- a/wled00/hue.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef WLED_HUE_H -#define WLED_HUE_H -/* - * Sync to Philips hue lights - */ -#include -class AsyncClient; - -void handleHue(); -void reconnectHue(); -void onHueError(void* arg, AsyncClient* client, int8_t error); -void onHueConnect(void* arg, AsyncClient* client); -void sendHuePoll(); -void onHueData(void* arg, AsyncClient* client, void *data, size_t len); - -#endif //WLED_HUE_H \ No newline at end of file diff --git a/wled00/ir.cpp b/wled00/ir.cpp index 32b0ee937..046991db5 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -1,8 +1,8 @@ -#include "ir.h" #include "wled.h" -#include "led.h" -#include "colors.h" -#include "wled_eeprom.h" + +/* + * Infrared sensor support for generic 24/40/44 key RGB remotes + */ #if defined(WLED_DISABLE_INFRARED) void handleIR(){} diff --git a/wled00/ir.h b/wled00/ir.h deleted file mode 100644 index e6ecb9668..000000000 --- a/wled00/ir.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef WLED_IR_H -#define WLED_IR_H -#include -/* - * Infrared sensor support for generic 24/40/44 key RGB remotes - */ - -bool decodeIRCustom(uint32_t code); -void relativeChange(byte* property, int8_t amount, byte lowerBoundary = 0, byte higherBoundary = 0xFF); -void changeEffectSpeed(int8_t amount); -void changeEffectIntensity(int8_t amount); -void decodeIR(uint32_t code); -void decodeIR24(uint32_t code); -void decodeIR24OLD(uint32_t code); -void decodeIR24CT(uint32_t code); -void decodeIR40(uint32_t code); -void decodeIR44(uint32_t code); -void decodeIR21(uint32_t code); -void decodeIR6(uint32_t code); - -void initIR(); -void handleIR(); - -#endif //WLED_IR_H \ No newline at end of file diff --git a/wled00/json.cpp b/wled00/json.cpp index e79737c43..31208bf5b 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1,7 +1,8 @@ -#include "json.h" #include "wled.h" -#include "wled_eeprom.h" -#include "led.h" + +/* + * JSON API (De)serialization + */ void deserializeSegment(JsonObject elem, byte it) { diff --git a/wled00/json.h b/wled00/json.h deleted file mode 100644 index 77d1b616f..000000000 --- a/wled00/json.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef WLED_JSON_H -#define WLED_JSON_H -/* - * JSON API (De)serialization - */ -#include -#include "ESPAsyncWebServer.h" -#include "src/dependencies/json/ArduinoJson-v6.h" -#include "src/dependencies/json/AsyncJson-v6.h" -#include "fx.h" -// TODO: AsynicWebServerRequest conflict? - -void deserializeSegment(JsonObject elem, byte it); -bool deserializeState(JsonObject root); -void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id); -void serializeState(JsonObject root); -void serializeInfo(JsonObject root); -void serveJson(AsyncWebServerRequest* request); -void serveLiveLeds(AsyncWebServerRequest* request); - -#endif //WLED_JSON_H \ No newline at end of file diff --git a/wled00/led.cpp b/wled00/led.cpp index 7f4d63095..c3f50cc22 100644 --- a/wled00/led.cpp +++ b/wled00/led.cpp @@ -1,10 +1,8 @@ -#include "led.h" #include "wled.h" -#include "notify.h" -#include "blynk.h" -#include "wled_eeprom.h" -#include "mqtt.h" -#include "colors.h" + +/* + * LED methods + */ void setValuesFromMainSeg() { diff --git a/wled00/led.h b/wled00/led.h deleted file mode 100644 index d5eb97a8d..000000000 --- a/wled00/led.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef WLED_LED_H -#define WLED_LED_H -#include -/* - * LED methods - */ - -void setValuesFromMainSeg(); -void resetTimebase(); -void toggleOnOff(); -void setAllLeds(); -void setLedsStandard(bool justColors = false); -bool colorChanged(); -void colorUpdated(int callMode); -void updateInterfaces(uint8_t callMode); -void handleTransitions(); -void handleNightlight(); - -#endif \ No newline at end of file diff --git a/wled00/mqtt.cpp b/wled00/mqtt.cpp index b84184af0..9c15f5bb3 100644 --- a/wled00/mqtt.cpp +++ b/wled00/mqtt.cpp @@ -1,10 +1,8 @@ -#include "mqtt.h" #include "wled.h" -#include "notify.h" -#include "led.h" -#include "colors.h" -#include "xml.h" -#include "set.h" + +/* + * MQTT communication protocol for home automation + */ #ifdef WLED_ENABLE_MQTT #define MQTT_KEEP_ALIVE_TIME 60 // contact the MQTT broker every 60 seconds diff --git a/wled00/mqtt.h b/wled00/mqtt.h deleted file mode 100644 index de602b981..000000000 --- a/wled00/mqtt.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WLED_MQTT_H -#define WLED_MQTT_H -/* - * MQTT communication protocol for home automation - */ -bool initMqtt(); -void publishMqtt(); - -#endif //WLED_MQTT_H \ No newline at end of file diff --git a/wled00/notify.h b/wled00/notify.h deleted file mode 100644 index a0fbfde2c..000000000 --- a/wled00/notify.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef WLED_NOTIFY_H -#define WLED_NOTIFY_H -#include -#include "src/dependencies/e131/ESPAsyncE131.h" -#include "const.h" -/* - * UDP notifier - */ -//union e131_packet_t; // Will this compile? -class IPAddress; - -void notify(byte callMode, bool followUp=false); -void arlsLock(uint32_t timeoutMs, byte md = REALTIME_MODE_GENERIC); -void handleE131Packet(e131_packet_t* p, IPAddress clientIP); -void handleNotifications(); -void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w); - -#endif // WLED_NOTIFY_H \ No newline at end of file diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index 206631097..d6332fd2c 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -1,7 +1,9 @@ -#include "ntp.h" #include "src/dependencies/timezone/Timezone.h" #include "wled.h" -#include "wled_eeprom.h" + +/* + * Acquires time from NTP server + */ TimeChangeRule UTCr = {Last, Sun, Mar, 1, 0}; // UTC Timezone tzUTC(UTCr, UTCr); diff --git a/wled00/ntp.h b/wled00/ntp.h deleted file mode 100644 index 9029661dd..000000000 --- a/wled00/ntp.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef WLED_NTP_H -#define WLED_NTP_H -#include -/* - * Acquires time from NTP server - */ - -void handleNetworkTime(); -void sendNTPPacket(); -bool checkNTPResponse(); -void updateLocalTime(); -void getTimeString(char* out); -bool checkCountdown(); -void setCountdown(); -byte weekdayMondayFirst(); -void checkTimers(); - -#endif // WLED_NTP_H \ No newline at end of file diff --git a/wled00/overlay.cpp b/wled00/overlay.cpp index ccdd3d0cd..ceb6fc209 100644 --- a/wled00/overlay.cpp +++ b/wled00/overlay.cpp @@ -1,7 +1,8 @@ -#include "overlay.h" #include "wled.h" -#include "cronixie.h" -#include "ntp.h" + +/* + * Used to draw clock overlays over the strip + */ void initCronixie() { @@ -127,3 +128,249 @@ void handleOverlayDraw() { case 3: _drawOverlayCronixie(); break; } } + + +/* + * Support for the Cronixie clock + */ + +#ifndef WLED_DISABLE_CRONIXIE +byte _digitOut[6] = {10,10,10,10,10,10}; + +byte getSameCodeLength(char code, int index, char const cronixieDisplay[]) +{ + byte counter = 0; + + for (int i = index+1; i < 6; i++) + { + if (cronixieDisplay[i] == code) + { + counter++; + } else { + return counter; + } + } + return counter; +} + +void setCronixie() +{ + /* + * digit purpose index + * 0-9 | 0-9 (incl. random) + * 10 | blank + * 11 | blank, bg off + * 12 | test upw. + * 13 | test dnw. + * 14 | binary AM/PM + * 15 | BB upper +50 for no trailing 0 + * 16 | BBB + * 17 | BBBB + * 18 | BBBBB + * 19 | BBBBBB + * 20 | H + * 21 | HH + * 22 | HHH + * 23 | HHHH + * 24 | M + * 25 | MM + * 26 | MMM + * 27 | MMMM + * 28 | MMMMM + * 29 | MMMMMM + * 30 | S + * 31 | SS + * 32 | SSS + * 33 | SSSS + * 34 | SSSSS + * 35 | SSSSSS + * 36 | Y + * 37 | YY + * 38 | YYYY + * 39 | I + * 40 | II + * 41 | W + * 42 | WW + * 43 | D + * 44 | DD + * 45 | DDD + * 46 | V + * 47 | VV + * 48 | VVV + * 49 | VVVV + * 50 | VVVVV + * 51 | VVVVVV + * 52 | v + * 53 | vv + * 54 | vvv + * 55 | vvvv + * 56 | vvvvv + * 57 | vvvvvv + */ + + //H HourLower | HH - Hour 24. | AH - Hour 12. | HHH Hour of Month | HHHH Hour of Year + //M MinuteUpper | MM Minute of Hour | MMM Minute of 12h | MMMM Minute of Day | MMMMM Minute of Month | MMMMMM Minute of Year + //S SecondUpper | SS Second of Minute | SSS Second of 10 Minute | SSSS Second of Hour | SSSSS Second of Day | SSSSSS Second of Week + //B AM/PM | BB 0-6/6-12/12-18/18-24 | BBB 0-3... | BBBB 0-1.5... | BBBBB 0-1 | BBBBBB 0-0.5 + + //Y YearLower | YY - Year LU | YYYY - Std. + //I MonthLower | II - Month of Year + //W Week of Month | WW Week of Year + //D Day of Week | DD Day Of Month | DDD Day Of Year + + DEBUG_PRINT("cset "); + DEBUG_PRINTLN(cronixieDisplay); + + overlayRefreshMs = 1997; //Only refresh every 2secs if no seconds are displayed + + for (int i = 0; i < 6; i++) + { + dP[i] = 10; + switch (cronixieDisplay[i]) + { + case '_': dP[i] = 10; break; + case '-': dP[i] = 11; break; + case 'r': dP[i] = random(1,7); break; //random btw. 1-6 + case 'R': dP[i] = random(0,10); break; //random btw. 0-9 + //case 't': break; //Test upw. + //case 'T': break; //Test dnw. + case 'b': dP[i] = 14 + getSameCodeLength('b',i,cronixieDisplay); i = i+dP[i]-14; break; + case 'B': dP[i] = 14 + getSameCodeLength('B',i,cronixieDisplay); i = i+dP[i]-14; break; + case 'h': dP[i] = 70 + getSameCodeLength('h',i,cronixieDisplay); i = i+dP[i]-70; break; + case 'H': dP[i] = 20 + getSameCodeLength('H',i,cronixieDisplay); i = i+dP[i]-20; break; + case 'A': dP[i] = 108; i++; break; + case 'a': dP[i] = 58; i++; break; + case 'm': dP[i] = 74 + getSameCodeLength('m',i,cronixieDisplay); i = i+dP[i]-74; break; + case 'M': dP[i] = 24 + getSameCodeLength('M',i,cronixieDisplay); i = i+dP[i]-24; break; + case 's': dP[i] = 80 + getSameCodeLength('s',i,cronixieDisplay); i = i+dP[i]-80; overlayRefreshMs = 497; break; //refresh more often bc. of secs + case 'S': dP[i] = 30 + getSameCodeLength('S',i,cronixieDisplay); i = i+dP[i]-30; overlayRefreshMs = 497; break; + case 'Y': dP[i] = 36 + getSameCodeLength('Y',i,cronixieDisplay); i = i+dP[i]-36; break; + case 'y': dP[i] = 86 + getSameCodeLength('y',i,cronixieDisplay); i = i+dP[i]-86; break; + case 'I': dP[i] = 39 + getSameCodeLength('I',i,cronixieDisplay); i = i+dP[i]-39; break; //Month. Don't ask me why month and minute both start with M. + case 'i': dP[i] = 89 + getSameCodeLength('i',i,cronixieDisplay); i = i+dP[i]-89; break; + //case 'W': break; + //case 'w': break; + case 'D': dP[i] = 43 + getSameCodeLength('D',i,cronixieDisplay); i = i+dP[i]-43; break; + case 'd': dP[i] = 93 + getSameCodeLength('d',i,cronixieDisplay); i = i+dP[i]-93; break; + case '0': dP[i] = 0; break; + case '1': dP[i] = 1; break; + case '2': dP[i] = 2; break; + case '3': dP[i] = 3; break; + case '4': dP[i] = 4; break; + case '5': dP[i] = 5; break; + case '6': dP[i] = 6; break; + case '7': dP[i] = 7; break; + case '8': dP[i] = 8; break; + case '9': dP[i] = 9; break; + //case 'V': break; //user var0 + //case 'v': break; //user var1 + } + } + DEBUG_PRINT("result "); + for (int i = 0; i < 5; i++) + { + DEBUG_PRINT((int)dP[i]); + DEBUG_PRINT(" "); + } + DEBUG_PRINTLN((int)dP[5]); + + _overlayCronixie(); //refresh +} + +void _overlayCronixie() +{ + byte h = hour(local); + byte h0 = h; + byte m = minute(local); + byte s = second(local); + byte d = day(local); + byte mi = month(local); + int y = year(local); + //this has to be changed in time for 22nd century + y -= 2000; if (y<0) y += 30; //makes countdown work + + if (useAMPM && !countdownMode) + { + if (h>12) h-=12; + else if (h==0) h+=12; + } + for (int i = 0; i < 6; i++) + { + if (dP[i] < 12) _digitOut[i] = dP[i]; + else { + if (dP[i] < 65) + { + switch(dP[i]) + { + case 21: _digitOut[i] = h/10; _digitOut[i+1] = h- _digitOut[i]*10; i++; break; //HH + case 25: _digitOut[i] = m/10; _digitOut[i+1] = m- _digitOut[i]*10; i++; break; //MM + case 31: _digitOut[i] = s/10; _digitOut[i+1] = s- _digitOut[i]*10; i++; break; //SS + + case 20: _digitOut[i] = h- (h/10)*10; break; //H + case 24: _digitOut[i] = m/10; break; //M + case 30: _digitOut[i] = s/10; break; //S + + case 43: _digitOut[i] = weekday(local); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //D + case 44: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; i++; break; //DD + case 40: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; i++; break; //II + case 37: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //YY + case 39: _digitOut[i] = 2; _digitOut[i+1] = 0; _digitOut[i+2] = y/10; _digitOut[i+3] = y- _digitOut[i+2]*10; i+=3; break; //YYYY + + //case 16: _digitOut[i+2] = ((h0/3)&1)?1:0; i++; //BBB (BBBB NI) + //case 15: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:0; i++; //BB + case 14: _digitOut[i] = (h0>11)?1:0; break; //B + } + } else + { + switch(dP[i]) + { + case 71: _digitOut[i] = h/10; _digitOut[i+1] = h- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //hh + case 75: _digitOut[i] = m/10; _digitOut[i+1] = m- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //mm + case 81: _digitOut[i] = s/10; _digitOut[i+1] = s- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ss + //case 66: _digitOut[i+2] = ((h0/3)&1)?1:10; i++; //bbb (bbbb NI) + //case 65: _digitOut[i+1] = (h0>17 || (h0>5 && h0<12))?1:10; i++; //bb + case 64: _digitOut[i] = (h0>11)?1:10; break; //b + + case 93: _digitOut[i] = weekday(local); _digitOut[i]--; if (_digitOut[i]<1) _digitOut[i]= 7; break; //d + case 94: _digitOut[i] = d/10; _digitOut[i+1] = d- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //dd + case 90: _digitOut[i] = mi/10; _digitOut[i+1] = mi- _digitOut[i]*10; if(_digitOut[i] == 0) _digitOut[i]=10; i++; break; //ii + case 87: _digitOut[i] = y/10; _digitOut[i+1] = y- _digitOut[i]*10; i++; break; //yy + case 89: _digitOut[i] = 2; _digitOut[i+1] = 0; _digitOut[i+2] = y/10; _digitOut[i+3] = y- _digitOut[i+2]*10; i+=3; break; //yyyy + } + } + } + } +} + +void _drawOverlayCronixie() +{ + byte offsets[] = {5, 0, 6, 1, 7, 2, 8, 3, 9, 4}; + + for (uint16_t i = 0; i < 6; i++) + { + byte o = 10*i; + byte excl = 10; + if(_digitOut[i] < 10) excl = offsets[_digitOut[i]]; + excl += o; + + if (cronixieBacklight && _digitOut[i] <11) + { + uint32_t col = strip.gamma32(strip.getSegment(0).colors[1]); + for (uint16_t j=o; j< o+10; j++) { + if (j != excl) strip.setPixelColor(j, col); + } + } else + { + for (uint16_t j=o; j< o+10; j++) { + if (j != excl) strip.setPixelColor(j, 0); + } + } + } +} + +#else // WLED_DISABLE_CRONIXIE +byte getSameCodeLength(char code, int index, char const cronixieDisplay[]) {} +void setCronixie() {} +void _overlayCronixie() {} +void _drawOverlayCronixie() {} +#endif diff --git a/wled00/overlay.h b/wled00/overlay.h deleted file mode 100644 index f7b54d5db..000000000 --- a/wled00/overlay.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef WLED_OVERLAY_H -#define WLED_OVERLAY_H -#include -/* - * Used to draw clock overlays over the strip - */ - -void initCronixie(); -void handleOverlays(); -void handleOverlayDraw(); -void _overlayAnalogCountdown(); -void _overlayAnalogClock(); - -#endif // WLED_OVERLAY_H \ No newline at end of file diff --git a/wled00/set.cpp b/wled00/set.cpp index f26795c8e..7fa2a3276 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -1,14 +1,8 @@ -#include "set.h" #include "wled.h" -#include "colors.h" -#include "hue.h" -#include "led.h" -#include "blynk.h" -#include "wled_eeprom.h" -#include "alexa.h" -#include "cronixie.h" -#include "xml.h" -#include "wled_server.h" + +/* + * Receives client input + */ void _setRandomColor(bool _sec,bool fromButton) { diff --git a/wled00/set.h b/wled00/set.h deleted file mode 100644 index 6bc7dbd6c..000000000 --- a/wled00/set.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef WLED_SET_H -#define WLED_SET_H -#include -#include -/* - * Receives client input - */ - -void _setRandomColor(bool _sec,bool fromButton=false); -bool isAsterisksOnly(const char* str, byte maxLen); -void handleSettingsSet(AsyncWebServerRequest *request, byte subPage); -bool handleSet(AsyncWebServerRequest *request, const String& req); -int getNumVal(const String* req, uint16_t pos); -bool updateVal(const String* req, const char* key, byte* val, byte minv=0, byte maxv=255); - -#endif // WLED_SET_H \ No newline at end of file diff --git a/wled00/notify.cpp b/wled00/udp.cpp similarity index 55% rename from wled00/notify.cpp rename to wled00/udp.cpp index 30adfee01..528798034 100644 --- a/wled00/notify.cpp +++ b/wled00/udp.cpp @@ -1,12 +1,12 @@ -#include "notify.h" #include "wled.h" -#include "src/dependencies/e131/ESPAsyncE131.h" -#include "led.h" + +/* + * UDP sync notifier + */ #define WLEDPACKETSIZE 29 #define UDP_IN_MAXSIZE 1472 - void notify(byte callMode, bool followUp) { if (!udpConnected) return; @@ -87,146 +87,6 @@ void arlsLock(uint32_t timeoutMs, byte md) } -void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ - //E1.31 protocol support - - uint16_t uni = htons(p->universe); - uint8_t previousUniverses = uni - e131Universe; - uint16_t possibleLEDsInCurrentUniverse; - uint16_t dmxChannels = htons(p->property_value_count) -1; - - // only listen for universes we're handling & allocated memory - if (uni >= (e131Universe + E131_MAX_UNIVERSE_COUNT)) return; - - if (e131SkipOutOfSequence) - if (p->sequence_number < e131LastSequenceNumber[uni-e131Universe] && p->sequence_number > 20 && e131LastSequenceNumber[uni-e131Universe] < 250){ - DEBUG_PRINT("skipping E1.31 frame (last seq="); - DEBUG_PRINT(e131LastSequenceNumber[uni-e131Universe]); - DEBUG_PRINT(", current seq="); - DEBUG_PRINT(p->sequence_number); - DEBUG_PRINT(", universe="); - DEBUG_PRINT(uni); - DEBUG_PRINTLN(")"); - return; - } - e131LastSequenceNumber[uni-e131Universe] = p->sequence_number; - - // update status info - realtimeIP = clientIP; - - switch (DMXMode) { - case DMX_MODE_DISABLED: - return; // nothing to do - break; - - case DMX_MODE_SINGLE_RGB: - if (uni != e131Universe) return; - if (dmxChannels-DMXAddress+1 < 3) return; - arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); - for (uint16_t i = 0; i < ledCount; i++) - setRealtimePixel(i, p->property_values[DMXAddress+0], p->property_values[DMXAddress+1], p->property_values[DMXAddress+2], 0); - break; - - case DMX_MODE_SINGLE_DRGB: - if (uni != e131Universe) return; - if (dmxChannels-DMXAddress+1 < 4) return; - arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); - if (DMXOldDimmer != p->property_values[DMXAddress+0]) { - DMXOldDimmer = p->property_values[DMXAddress+0]; - bri = p->property_values[DMXAddress+0]; - strip.setBrightness(bri); - } - for (uint16_t i = 0; i < ledCount; i++) - setRealtimePixel(i, p->property_values[DMXAddress+1], p->property_values[DMXAddress+2], p->property_values[DMXAddress+3], 0); - break; - - case DMX_MODE_EFFECT: - if (uni != e131Universe) return; - if (dmxChannels-DMXAddress+1 < 11) return; - if (DMXOldDimmer != p->property_values[DMXAddress+0]) { - DMXOldDimmer = p->property_values[DMXAddress+0]; - bri = p->property_values[DMXAddress+0]; - } - if (p->property_values[DMXAddress+1] < MODE_COUNT) - effectCurrent = p->property_values[DMXAddress+ 1]; - effectSpeed = p->property_values[DMXAddress+ 2]; // flickers - effectIntensity = p->property_values[DMXAddress+ 3]; - effectPalette = p->property_values[DMXAddress+ 4]; - col[0] = p->property_values[DMXAddress+ 5]; - col[1] = p->property_values[DMXAddress+ 6]; - col[2] = p->property_values[DMXAddress+ 7]; - colSec[0] = p->property_values[DMXAddress+ 8]; - colSec[1] = p->property_values[DMXAddress+ 9]; - colSec[2] = p->property_values[DMXAddress+10]; - if (dmxChannels-DMXAddress+1 > 11) - { - col[3] = p->property_values[DMXAddress+11]; //white - colSec[3] = p->property_values[DMXAddress+12]; - } - transitionDelayTemp = 0; // act fast - colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); // don't send UDP - return; // don't activate realtime live mode - break; - - case DMX_MODE_MULTIPLE_RGB: - arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); - if (previousUniverses == 0) { - // first universe of this fixture - possibleLEDsInCurrentUniverse = (dmxChannels - DMXAddress + 1) / 3; - for (uint16_t i = 0; i < ledCount; i++) { - if (i >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) - setRealtimePixel(i, p->property_values[DMXAddress+i*3+0], p->property_values[DMXAddress+i*3+1], p->property_values[DMXAddress+i*3+2], 0); - } - } else if (previousUniverses > 0 && uni < (e131Universe + E131_MAX_UNIVERSE_COUNT)) { - // additional universe(s) of this fixture - uint16_t numberOfLEDsInPreviousUniverses = ((512 - DMXAddress + 1) / 3); // first universe - if (previousUniverses > 1) numberOfLEDsInPreviousUniverses += (512 / 3) * (previousUniverses - 1); // extended universe(s) before current - possibleLEDsInCurrentUniverse = dmxChannels / 3; - for (uint16_t i = numberOfLEDsInPreviousUniverses; i < ledCount; i++) { - uint8_t j = i - numberOfLEDsInPreviousUniverses; - if (j >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) - setRealtimePixel(i, p->property_values[j*3+1], p->property_values[j*3+2], p->property_values[j*3+3], 0); - } - } - break; - - case DMX_MODE_MULTIPLE_DRGB: - arlsLock(realtimeTimeoutMs, REALTIME_MODE_E131); - if (previousUniverses == 0) { - // first universe of this fixture - if (DMXOldDimmer != p->property_values[DMXAddress+0]) { - DMXOldDimmer = p->property_values[DMXAddress+0]; - bri = p->property_values[DMXAddress+0]; - strip.setBrightness(bri); - } - possibleLEDsInCurrentUniverse = (dmxChannels - DMXAddress) / 3; - for (uint16_t i = 0; i < ledCount; i++) { - if (i >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) - setRealtimePixel(i, p->property_values[DMXAddress+i*3+1], p->property_values[DMXAddress+i*3+2], p->property_values[DMXAddress+i*3+3], 0); - } - } else if (previousUniverses > 0 && uni < (e131Universe + E131_MAX_UNIVERSE_COUNT)) { - // additional universe(s) of this fixture - uint16_t numberOfLEDsInPreviousUniverses = ((512 - DMXAddress + 1) / 3); // first universe - if (previousUniverses > 1) numberOfLEDsInPreviousUniverses += (512 / 3) * (previousUniverses - 1); // extended universe(s) before current - possibleLEDsInCurrentUniverse = dmxChannels / 3; - for (uint16_t i = numberOfLEDsInPreviousUniverses; i < ledCount; i++) { - uint8_t j = i - numberOfLEDsInPreviousUniverses; - if (j >= possibleLEDsInCurrentUniverse) break; // more LEDs will follow in next universe(s) - setRealtimePixel(i, p->property_values[j*3+1], p->property_values[j*3+2], p->property_values[j*3+3], 0); - } - } - break; - - default: - DEBUG_PRINTLN("unknown E1.31 DMX mode"); - return; // nothing to do - break; - } - - e131NewData = true; -} - - void handleNotifications() { //send second notification if enabled diff --git a/wled00/usermod.cpp b/wled00/usermod.cpp index 96c1f8a6c..2c7c881f5 100644 --- a/wled00/usermod.cpp +++ b/wled00/usermod.cpp @@ -2,7 +2,7 @@ /* * This file allows you to add own functionality to WLED more easily * See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality - * EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in wled_eeprom.h) + * EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h) * bytes 2400+ are currently ununsed, but might be used for future wled features */ diff --git a/wled00/usermod.h b/wled00/usermod.h deleted file mode 100644 index 8269c6e92..000000000 --- a/wled00/usermod.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef WLED_USERMOD_H -#define WLED_USERMOD_H - -void userSetup(); -void userConnected(); -void userLoop(); - -#endif // WLED_USERMOD_H \ No newline at end of file diff --git a/wled00/wled.cpp b/wled00/wled.cpp index fdb607765..7579a9c5e 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -1,23 +1,8 @@ #include "wled.h" -#include "alexa.h" -#include "blynk.h" -#include "button.h" -#include "dmx.h" -#include "file.h" -#include "hue.h" -#include "ir.h" -#include "led.h" -#include "mqtt.h" -#include "notify.h" -#include "ntp.h" -#include "overlay.h" -#include "usermod.h" -#include "wled_eeprom.h" -#include "wled_server.h" #include // Global Variable definitions -char versionString[] = "0.9.1"; +char versionString[] = "0.9.1n"; // AP and OTA default passwords (for maximum change them!) char apPass[65] = DEFAULT_AP_PASS; diff --git a/wled00/wled.h b/wled00/wled.h index 70b197c8e..926fa0c81 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -3,10 +3,13 @@ /* Main sketch, global variable declarations @title WLED project sketch - @version 0.9.1 + @version 0.9.1n @author Christian Schwinne */ +// version code in format yymmddb (b = daily build) +#define VERSION 2003300 + // ESP8266-01 (blue) got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.4.2 and the setting 512K(No SPIFFS). // ESP8266-01 (black) has 1MB flash and can thus fit the whole program. Use 1M(64K SPIFFS). @@ -78,6 +81,7 @@ #include "src/dependencies/json/AsyncJson-v6.h" #include "src/dependencies/json/ArduinoJson-v6.h" +#include "func_declare.h" #include "html_ui.h" #include "html_settings.h" #include "html_other.h" @@ -117,9 +121,6 @@ #endif #endif -// version code in format yymmddb (b = daily build) -#define VERSION 2003301 - // Global external variable declaration. See wled.cpp for definitions and comments. extern char versionString[]; extern char apPass[65]; diff --git a/wled00/wled00.ino b/wled00/wled00.ino index e33348379..f806e5b34 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -1,6 +1,6 @@ /* - Arduino Studio support file. -*/ + * Arduino IDE compatibility file. + */ #include "wled.h" void setup() { @@ -9,4 +9,4 @@ void setup() { void loop() { WLED::instance().loop(); -} \ No newline at end of file +} diff --git a/wled00/wled_eeprom.cpp b/wled00/wled_eeprom.cpp index 0087641aa..ccb16ff56 100644 --- a/wled00/wled_eeprom.cpp +++ b/wled00/wled_eeprom.cpp @@ -1,11 +1,10 @@ -#include "wled_eeprom.h" #include #include "wled.h" -#include "cronixie.h" -#include "ntp.h" -#include "set.h" -#include "led.h" +/* + * Methods to handle saving and loading to non-volatile memory + * EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map + */ //eeprom Version code, enables default settings instead of 0 init on update #define EEPVER 18 diff --git a/wled00/wled_eeprom.h b/wled00/wled_eeprom.h deleted file mode 100644 index eae52b128..000000000 --- a/wled00/wled_eeprom.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef WLED_EPPROM_H -#define WLED_EPPROM_H -#include -/* - * Methods to handle saving and loading to non-volatile memory - * EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map - */ -#define EEPSIZE 2560 //Maximum is 4096 - -void commit(); -void clearEEPROM(); -void writeStringToEEPROM(uint16_t pos, char* str, uint16_t len); -void readStringFromEEPROM(uint16_t pos, char* str, uint16_t len); -void saveSettingsToEEPROM(); -void loadSettingsFromEEPROM(bool first); -void savedToPresets(); -bool applyPreset(byte index, bool loadBri = true); -void savePreset(byte index, bool persist = true); -void loadMacro(byte index, char* m); -void applyMacro(byte index); -void saveMacro(byte index, String mc, bool persist = true); //only commit on single save, not in settings - -#endif //WLED_EPPROM_H diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp new file mode 100644 index 000000000..a472729d1 --- /dev/null +++ b/wled00/wled_serial.cpp @@ -0,0 +1,83 @@ +#include "wled.h" + +/* + * Adalight handler + */ + +enum class AdaState { + Header_A, + Header_d, + Header_a, + Header_CountHi, + Header_CountLo, + Header_CountCheck, + Data_Red, + Data_Green, + Data_Blue +}; + +void handleSerial() +{ + #ifdef WLED_ENABLE_ADALIGHT + static auto state = AdaState::Header_A; + static uint16_t count = 0; + static uint16_t pixel = 0; + static byte check = 0x00; + static byte red = 0x00; + static byte green = 0x00; + + while (Serial.available() > 0) + { + yield(); + byte next = Serial.read(); + switch (state) { + case AdaState::Header_A: + if (next == 'A') state = AdaState::Header_d; + break; + case AdaState::Header_d: + if (next == 'd') state = AdaState::Header_a; + else state = AdaState::Header_A; + break; + case AdaState::Header_a: + if (next == 'a') state = AdaState::Header_CountHi; + else state = AdaState::Header_A; + break; + case AdaState::Header_CountHi: + pixel = 0; + count = next * 0x100; + check = next; + state = AdaState::Header_CountLo; + break; + case AdaState::Header_CountLo: + count += next + 1; + check = check ^ next ^ 0x55; + state = AdaState::Header_CountCheck; + break; + case AdaState::Header_CountCheck: + if (check == next) state = AdaState::Data_Red; + else state = AdaState::Header_A; + break; + case AdaState::Data_Red: + red = next; + state = AdaState::Data_Green; + break; + case AdaState::Data_Green: + green = next; + state = AdaState::Data_Blue; + break; + case AdaState::Data_Blue: + byte blue = next; + setRealtimePixel(pixel++, red, green, blue, 0); + if (--count > 0) state = AdaState::Data_Red; + else { + if (!realtimeMode && bri == 0) strip.setBrightness(briLast); + arlsLock(realtimeTimeoutMs, REALTIME_MODE_ADALIGHT); + + strip.show(); + state = AdaState::Header_A; + } + break; + } + } + #endif +} diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index d5b4eebce..cd623bc49 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -1,10 +1,8 @@ -#include "wled_server.h" #include "wled.h" -#include "file.h" -#include "set.h" -#include "json.h" -#include "xml.h" +/* + * Integrated HTTP web server page declarations + */ //Is this an IP? bool isIp(String str) { diff --git a/wled00/wled_server.h b/wled00/wled_server.h deleted file mode 100644 index ff7133d63..000000000 --- a/wled00/wled_server.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef WLED_SERVER_H -#define WLED_SERVER_H -#include -/* - * Server page declarations - */ -class AsyncWebServerRequest; - - -bool isIp(String str); -bool captivePortal(AsyncWebServerRequest *request); -void initServer(); -void serveIndexOrWelcome(AsyncWebServerRequest *request); -void serveIndex(AsyncWebServerRequest* request); -String msgProcessor(const String& var); -void serveMessage(AsyncWebServerRequest* request, uint16_t code, String headl, String subl="", byte optionT=255); -String settingsProcessor(const String& var); -String dmxProcessor(const String& var); -void serveSettings(AsyncWebServerRequest* request); - -#endif //WLED_SERVER_H \ No newline at end of file diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 09e42011d..3af1e54ce 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -1,8 +1,8 @@ -#include "xml.h" #include "wled.h" -#include "wled_eeprom.h" -#include "ntp.h" +/* + * Sending XML status files to client + */ //build XML response to HTTP /win API request char* XML_response(AsyncWebServerRequest *request, char* dest) diff --git a/wled00/xml.h b/wled00/xml.h deleted file mode 100644 index 022982959..000000000 --- a/wled00/xml.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef WLED_XML_H -#define WLED_XML_H -#include -#include - -/* - * Sending XML status files to client - */ -char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr); -char* URL_response(AsyncWebServerRequest *request); -void sappend(char stype, const char* key, int val); -void sappends(char stype, const char* key, char* val); -void getSettingsJS(byte subPage, char* dest); - -#endif // WLED_XML_H \ No newline at end of file