whitespace cleanup
This commit is contained in:
parent
98be19b29f
commit
506b6b51ce
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Alexa Voice On/Off/Brightness/Color Control. Emulates a Philips Hue bridge to Alexa.
|
* Alexa Voice On/Off/Brightness/Color Control. Emulates a Philips Hue bridge to Alexa.
|
||||||
*
|
*
|
||||||
* This was put together from these two excellent projects:
|
* This was put together from these two excellent projects:
|
||||||
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
|
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
|
||||||
* https://github.com/probonopd/ESP8266HueEmulator
|
* https://github.com/probonopd/ESP8266HueEmulator
|
||||||
@ -21,11 +21,11 @@ void alexaInit()
|
|||||||
espalexaDevice = new EspalexaDevice(alexaInvocationName, onAlexaChange, EspalexaDeviceType::extendedcolor);
|
espalexaDevice = new EspalexaDevice(alexaInvocationName, onAlexaChange, EspalexaDeviceType::extendedcolor);
|
||||||
espalexa.addDevice(espalexaDevice);
|
espalexa.addDevice(espalexaDevice);
|
||||||
|
|
||||||
// up to 9 devices (added second, third, ... i.e. index 1 to 9) serve for switching on up to nine presets (preset IDs 1 to 9 in WLED),
|
// up to 9 devices (added second, third, ... i.e. index 1 to 9) serve for switching on up to nine presets (preset IDs 1 to 9 in WLED),
|
||||||
// names are identical as the preset names, switching off can be done by switching off any of them
|
// names are identical as the preset names, switching off can be done by switching off any of them
|
||||||
if (alexaNumPresets) {
|
if (alexaNumPresets) {
|
||||||
String name = "";
|
String name = "";
|
||||||
for (byte presetIndex = 1; presetIndex <= alexaNumPresets; presetIndex++)
|
for (byte presetIndex = 1; presetIndex <= alexaNumPresets; presetIndex++)
|
||||||
{
|
{
|
||||||
if (!getPresetName(presetIndex, name)) break; // no more presets
|
if (!getPresetName(presetIndex, name)) break; // no more presets
|
||||||
EspalexaDevice* dev = new EspalexaDevice(name.c_str(), onAlexaChange, EspalexaDeviceType::extendedcolor);
|
EspalexaDevice* dev = new EspalexaDevice(name.c_str(), onAlexaChange, EspalexaDeviceType::extendedcolor);
|
||||||
@ -44,7 +44,7 @@ void handleAlexa()
|
|||||||
void onAlexaChange(EspalexaDevice* dev)
|
void onAlexaChange(EspalexaDevice* dev)
|
||||||
{
|
{
|
||||||
EspalexaDeviceProperty m = dev->getLastChangedProperty();
|
EspalexaDeviceProperty m = dev->getLastChangedProperty();
|
||||||
|
|
||||||
if (m == EspalexaDeviceProperty::on)
|
if (m == EspalexaDeviceProperty::on)
|
||||||
{
|
{
|
||||||
if (dev->getId() == 0) // Device 0 is for on/off or macros
|
if (dev->getId() == 0) // Device 0 is for on/off or macros
|
||||||
@ -56,7 +56,7 @@ void onAlexaChange(EspalexaDevice* dev)
|
|||||||
bri = briLast;
|
bri = briLast;
|
||||||
stateUpdated(CALL_MODE_ALEXA);
|
stateUpdated(CALL_MODE_ALEXA);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
applyPreset(macroAlexaOn, CALL_MODE_ALEXA);
|
applyPreset(macroAlexaOn, CALL_MODE_ALEXA);
|
||||||
if (bri == 0) dev->setValue(briLast); //stop Alexa from complaining if macroAlexaOn does not actually turn on
|
if (bri == 0) dev->setValue(briLast); //stop Alexa from complaining if macroAlexaOn does not actually turn on
|
||||||
@ -82,7 +82,7 @@ void onAlexaChange(EspalexaDevice* dev)
|
|||||||
bri = 0;
|
bri = 0;
|
||||||
stateUpdated(CALL_MODE_ALEXA);
|
stateUpdated(CALL_MODE_ALEXA);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
applyPreset(macroAlexaOff, CALL_MODE_ALEXA);
|
applyPreset(macroAlexaOff, CALL_MODE_ALEXA);
|
||||||
// below for loop stops Alexa from complaining if macroAlexaOff does not actually turn off
|
// below for loop stops Alexa from complaining if macroAlexaOff does not actually turn off
|
||||||
|
@ -217,7 +217,7 @@ class Bus {
|
|||||||
static uint8_t _gAWM; // definition in FX_fcn.cpp
|
static uint8_t _gAWM; // definition in FX_fcn.cpp
|
||||||
static int16_t _cct; // definition in FX_fcn.cpp
|
static int16_t _cct; // definition in FX_fcn.cpp
|
||||||
static uint8_t _cctBlend; // definition in FX_fcn.cpp
|
static uint8_t _cctBlend; // definition in FX_fcn.cpp
|
||||||
|
|
||||||
uint32_t autoWhiteCalc(uint32_t c) {
|
uint32_t autoWhiteCalc(uint32_t c) {
|
||||||
uint8_t aWM = _autoWhiteMode;
|
uint8_t aWM = _autoWhiteMode;
|
||||||
if (_gAWM < 255) aWM = _gAWM;
|
if (_gAWM < 255) aWM = _gAWM;
|
||||||
@ -271,7 +271,7 @@ class BusDigital : public Bus {
|
|||||||
//Fix for turning off onboard LED breaking bus
|
//Fix for turning off onboard LED breaking bus
|
||||||
#ifdef LED_BUILTIN
|
#ifdef LED_BUILTIN
|
||||||
if (_bri == 0 && b > 0) {
|
if (_bri == 0 && b > 0) {
|
||||||
if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN) PolyBus::begin(_busPtr, _iType, _pins);
|
if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN) PolyBus::begin(_busPtr, _iType, _pins);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Bus::setBrightness(b);
|
Bus::setBrightness(b);
|
||||||
@ -343,7 +343,7 @@ class BusDigital : public Bus {
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _colorOrder = COL_ORDER_GRB;
|
uint8_t _colorOrder = COL_ORDER_GRB;
|
||||||
uint8_t _pins[2] = {255, 255};
|
uint8_t _pins[2] = {255, 255};
|
||||||
uint8_t _iType = I_NONE;
|
uint8_t _iType = I_NONE;
|
||||||
@ -477,7 +477,7 @@ class BusPwm : public Bus {
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _pins[5] = {255, 255, 255, 255, 255};
|
uint8_t _pins[5] = {255, 255, 255, 255, 255};
|
||||||
uint8_t _data[5] = {0};
|
uint8_t _data[5] = {0};
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
@ -553,7 +553,7 @@ class BusOnOff : public Bus {
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _pin = 255;
|
uint8_t _pin = 255;
|
||||||
uint8_t _data = 0;
|
uint8_t _data = 0;
|
||||||
};
|
};
|
||||||
@ -717,7 +717,7 @@ class BusManager {
|
|||||||
//do not call this method from system context (network callback)
|
//do not call this method from system context (network callback)
|
||||||
void removeAll() {
|
void removeAll() {
|
||||||
DEBUG_PRINTLN(F("Removing all."));
|
DEBUG_PRINTLN(F("Removing all."));
|
||||||
//prevents crashes due to deleting busses while in use.
|
//prevents crashes due to deleting busses while in use.
|
||||||
while (!canAllShow()) yield();
|
while (!canAllShow()) yield();
|
||||||
for (uint8_t i = 0; i < numBusses; i++) delete busses[i];
|
for (uint8_t i = 0; i < numBusses; i++) delete busses[i];
|
||||||
numBusses = 0;
|
numBusses = 0;
|
||||||
|
@ -699,7 +699,7 @@ class PolyBus {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
static uint32_t getPixelColor(void* busPtr, uint8_t busType, uint16_t pix, uint8_t co) {
|
static uint32_t getPixelColor(void* busPtr, uint8_t busType, uint16_t pix, uint8_t co) {
|
||||||
RgbwColor col(0,0,0,0);
|
RgbwColor col(0,0,0,0);
|
||||||
switch (busType) {
|
switch (busType) {
|
||||||
case I_NONE: break;
|
case I_NONE: break;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -771,7 +771,7 @@ class PolyBus {
|
|||||||
case I_HS_P98_3: col = (static_cast<B_HS_P98_3*>(busPtr))->GetPixelColor(pix); break;
|
case I_HS_P98_3: col = (static_cast<B_HS_P98_3*>(busPtr))->GetPixelColor(pix); break;
|
||||||
case I_SS_P98_3: col = (static_cast<B_SS_P98_3*>(busPtr))->GetPixelColor(pix); break;
|
case I_SS_P98_3: col = (static_cast<B_SS_P98_3*>(busPtr))->GetPixelColor(pix); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// upper nibble contains W swap information
|
// upper nibble contains W swap information
|
||||||
uint8_t w = col.W;
|
uint8_t w = col.W;
|
||||||
switch (co >> 4) {
|
switch (co >> 4) {
|
||||||
@ -866,7 +866,7 @@ class PolyBus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//gives back the internal type index (I_XX_XXX_X above) for the input
|
//gives back the internal type index (I_XX_XXX_X above) for the input
|
||||||
static uint8_t getI(uint8_t busType, uint8_t* pins, uint8_t num = 0) {
|
static uint8_t getI(uint8_t busType, uint8_t* pins, uint8_t num = 0) {
|
||||||
if (!IS_DIGITAL(busType)) return I_NONE;
|
if (!IS_DIGITAL(busType)) return I_NONE;
|
||||||
if (IS_2PIN(busType)) { //SPI LED chips
|
if (IS_2PIN(busType)) { //SPI LED chips
|
||||||
|
@ -105,18 +105,18 @@ void handleSwitch(uint8_t b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buttonLongPressed[b] == buttonPressedBefore[b]) return;
|
if (buttonLongPressed[b] == buttonPressedBefore[b]) return;
|
||||||
|
|
||||||
if (millis() - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { //fire edge event only after 50ms without change (debounce)
|
if (millis() - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { //fire edge event only after 50ms without change (debounce)
|
||||||
if (!buttonPressedBefore[b]) { // on -> off
|
if (!buttonPressedBefore[b]) { // on -> off
|
||||||
if (macroButton[b]) applyPreset(macroButton[b], CALL_MODE_BUTTON_PRESET);
|
if (macroButton[b]) applyPreset(macroButton[b], CALL_MODE_BUTTON_PRESET);
|
||||||
else { //turn on
|
else { //turn on
|
||||||
if (!bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
|
if (!bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
|
||||||
}
|
}
|
||||||
} else { // off -> on
|
} else { // off -> on
|
||||||
if (macroLongPress[b]) applyPreset(macroLongPress[b], CALL_MODE_BUTTON_PRESET);
|
if (macroLongPress[b]) applyPreset(macroLongPress[b], CALL_MODE_BUTTON_PRESET);
|
||||||
else { //turn off
|
else { //turn off
|
||||||
if (bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
|
if (bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish MQTT message
|
// publish MQTT message
|
||||||
@ -132,7 +132,7 @@ void handleSwitch(uint8_t b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ANALOG_BTN_READ_CYCLE 250 // min time between two analog reading cycles
|
#define ANALOG_BTN_READ_CYCLE 250 // min time between two analog reading cycles
|
||||||
#define STRIP_WAIT_TIME 6 // max wait time in case of strip.isUpdating()
|
#define STRIP_WAIT_TIME 6 // max wait time in case of strip.isUpdating()
|
||||||
#define POT_SMOOTHING 0.25f // smoothing factor for raw potentiometer readings
|
#define POT_SMOOTHING 0.25f // smoothing factor for raw potentiometer readings
|
||||||
#define POT_SENSITIVITY 4 // changes below this amount are noise (POT scratching, or ADC noise)
|
#define POT_SENSITIVITY 4 // changes below this amount are noise (POT scratching, or ADC noise)
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ void handleAnalog(uint8_t b)
|
|||||||
//while(strip.isUpdating() && (millis() - wait_started < STRIP_WAIT_TIME)) {
|
//while(strip.isUpdating() && (millis() - wait_started < STRIP_WAIT_TIME)) {
|
||||||
// delay(1);
|
// delay(1);
|
||||||
//}
|
//}
|
||||||
//if (strip.isUpdating()) return; // give up
|
//if (strip.isUpdating()) return; // give up
|
||||||
|
|
||||||
oldRead[b] = aRead;
|
oldRead[b] = aRead;
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ void esp32RMTInvertIdle()
|
|||||||
void handleIO()
|
void handleIO()
|
||||||
{
|
{
|
||||||
handleButton();
|
handleButton();
|
||||||
|
|
||||||
//set relay when LEDs turn on
|
//set relay when LEDs turn on
|
||||||
if (strip.getBrightness())
|
if (strip.getBrightness())
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
if (apHide > 1) apHide = 1;
|
if (apHide > 1) apHide = 1;
|
||||||
|
|
||||||
CJSON(apBehavior, ap[F("behav")]);
|
CJSON(apBehavior, ap[F("behav")]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
JsonArray ap_ip = ap["ip"];
|
JsonArray ap_ip = ap["ip"];
|
||||||
for (byte i = 0; i < 4; i++) {
|
for (byte i = 0; i < 4; i++) {
|
||||||
@ -136,7 +136,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JsonArray ins = hw_led["ins"];
|
JsonArray ins = hw_led["ins"];
|
||||||
|
|
||||||
if (fromFS || !ins.isNull()) {
|
if (fromFS || !ins.isNull()) {
|
||||||
uint8_t s = 0; // bus iterator
|
uint8_t s = 0; // bus iterator
|
||||||
if (fromFS) busses.removeAll(); // can't safely manipulate busses directly in network callback
|
if (fromFS) busses.removeAll(); // can't safely manipulate busses directly in network callback
|
||||||
@ -210,14 +210,14 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
btnPin[s] = pin;
|
btnPin[s] = pin;
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
// ESP32 only: check that analog button pin is a valid ADC gpio
|
// ESP32 only: check that analog button pin is a valid ADC gpio
|
||||||
if (((buttonType[s] == BTN_TYPE_ANALOG) || (buttonType[s] == BTN_TYPE_ANALOG_INVERTED)) && (digitalPinToAnalogChannel(btnPin[s]) < 0))
|
if (((buttonType[s] == BTN_TYPE_ANALOG) || (buttonType[s] == BTN_TYPE_ANALOG_INVERTED)) && (digitalPinToAnalogChannel(btnPin[s]) < 0))
|
||||||
{
|
{
|
||||||
// not an ADC analog pin
|
// not an ADC analog pin
|
||||||
DEBUG_PRINTF("PIN ALLOC error: GPIO%d for analog button #%d is not an analog pin!\n", btnPin[s], s);
|
DEBUG_PRINTF("PIN ALLOC error: GPIO%d for analog button #%d is not an analog pin!\n", btnPin[s], s);
|
||||||
btnPin[s] = -1;
|
btnPin[s] = -1;
|
||||||
pinManager.deallocatePin(pin,PinOwner::Button);
|
pinManager.deallocatePin(pin,PinOwner::Button);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (disablePullUp) {
|
if (disablePullUp) {
|
||||||
@ -253,7 +253,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
// relies upon only being called once with fromFS == true, which is currently true.
|
// relies upon only being called once with fromFS == true, which is currently true.
|
||||||
uint8_t s = 0;
|
uint8_t s = 0;
|
||||||
if (pinManager.allocatePin(btnPin[0], false, PinOwner::Button)) { // initialized to #define value BTNPIN, or zero if not defined(!)
|
if (pinManager.allocatePin(btnPin[0], false, PinOwner::Button)) { // initialized to #define value BTNPIN, or zero if not defined(!)
|
||||||
++s; // do not clear default button if allocated successfully
|
++s; // do not clear default button if allocated successfully
|
||||||
}
|
}
|
||||||
for (; s<WLED_MAX_BUTTONS; s++) {
|
for (; s<WLED_MAX_BUTTONS; s++) {
|
||||||
btnPin[s] = -1;
|
btnPin[s] = -1;
|
||||||
@ -497,7 +497,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
uint8_t it = 0;
|
uint8_t it = 0;
|
||||||
for (JsonObject timer : timers) {
|
for (JsonObject timer : timers) {
|
||||||
if (it > 9) break;
|
if (it > 9) break;
|
||||||
if (it<8 && timer[F("hour")]==255) it=8; // hour==255 -> sunrise/sunset
|
if (it<8 && timer[F("hour")]==255) it=8; // hour==255 -> sunrise/sunset
|
||||||
CJSON(timerHours[it], timer[F("hour")]);
|
CJSON(timerHours[it], timer[F("hour")]);
|
||||||
CJSON(timerMinutes[it], timer["min"]);
|
CJSON(timerMinutes[it], timer["min"]);
|
||||||
CJSON(timerMacro[it], timer["macro"]);
|
CJSON(timerMacro[it], timer["macro"]);
|
||||||
|
@ -91,7 +91,7 @@ void colorKtoRGB(uint16_t kelvin, byte* rgb) //white spectrum to rgb, calc
|
|||||||
r = round(329.698727446 * pow((temp - 60), -0.1332047592));
|
r = round(329.698727446 * pow((temp - 60), -0.1332047592));
|
||||||
g = round(288.1221695283 * pow((temp - 60), -0.0755148492));
|
g = round(288.1221695283 * pow((temp - 60), -0.0755148492));
|
||||||
b = 255;
|
b = 255;
|
||||||
}
|
}
|
||||||
//g += 12; //mod by Aircoookie, a bit less accurate but visibly less pinkish
|
//g += 12; //mod by Aircoookie, a bit less accurate but visibly less pinkish
|
||||||
rgb[0] = (uint8_t) constrain(r, 0, 255);
|
rgb[0] = (uint8_t) constrain(r, 0, 255);
|
||||||
rgb[1] = (uint8_t) constrain(g, 0, 255);
|
rgb[1] = (uint8_t) constrain(g, 0, 255);
|
||||||
@ -194,7 +194,7 @@ void colorFromDecOrHexString(byte* rgb, char* in)
|
|||||||
if (in[0] == 0) return;
|
if (in[0] == 0) return;
|
||||||
char first = in[0];
|
char first = in[0];
|
||||||
uint32_t c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
if (first == '#' || first == 'h' || first == 'H') //is HEX encoded
|
if (first == '#' || first == 'h' || first == 'H') //is HEX encoded
|
||||||
{
|
{
|
||||||
c = strtoul(in +1, NULL, 16);
|
c = strtoul(in +1, NULL, 16);
|
||||||
|
@ -309,7 +309,7 @@
|
|||||||
|
|
||||||
#define NTP_PACKET_SIZE 48
|
#define NTP_PACKET_SIZE 48
|
||||||
|
|
||||||
//maximum number of rendered LEDs - this does not have to match max. physical LEDs, e.g. if there are virtual busses
|
//maximum number of rendered LEDs - this does not have to match max. physical LEDs, e.g. if there are virtual busses
|
||||||
#ifndef MAX_LEDS
|
#ifndef MAX_LEDS
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#define MAX_LEDS 1664 //can't rely on memory limit to limit this to 1600 LEDs
|
#define MAX_LEDS 1664 //can't rely on memory limit to limit this to 1600 LEDs
|
||||||
@ -338,7 +338,7 @@
|
|||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#define SETTINGS_STACK_BUF_SIZE 2048
|
#define SETTINGS_STACK_BUF_SIZE 2048
|
||||||
#else
|
#else
|
||||||
#define SETTINGS_STACK_BUF_SIZE 3096
|
#define SETTINGS_STACK_BUF_SIZE 3096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WLED_USE_ETHERNET
|
#ifdef WLED_USE_ETHERNET
|
||||||
|
@ -73,7 +73,7 @@ void initDMX() {
|
|||||||
dmx.init(512); // initialize with bus length
|
dmx.init(512); // initialize with bus length
|
||||||
#else
|
#else
|
||||||
dmx.initWrite(512); // initialize with bus length
|
dmx.initWrite(512); // initialize with bus length
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
//handles RGB data only
|
//handles RGB data only
|
||||||
void handleDDPPacket(e131_packet_t* p) {
|
void handleDDPPacket(e131_packet_t* p) {
|
||||||
int lastPushSeq = e131LastSequenceNumber[0];
|
int lastPushSeq = e131LastSequenceNumber[0];
|
||||||
|
|
||||||
//reject late packets belonging to previous frame (assuming 4 packets max. before push)
|
//reject late packets belonging to previous frame (assuming 4 packets max. before push)
|
||||||
if (e131SkipOutOfSequence && lastPushSeq) {
|
if (e131SkipOutOfSequence && lastPushSeq) {
|
||||||
int sn = p->sequenceNum & 0xF;
|
int sn = p->sequenceNum & 0xF;
|
||||||
@ -35,7 +35,7 @@ void handleDDPPacket(e131_packet_t* p) {
|
|||||||
if (p->flags & DDP_TIMECODE_FLAG) c = 4; //packet has timecode flag, we do not support it, but data starts 4 bytes later
|
if (p->flags & DDP_TIMECODE_FLAG) c = 4; //packet has timecode flag, we do not support it, but data starts 4 bytes later
|
||||||
|
|
||||||
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP);
|
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP);
|
||||||
|
|
||||||
if (!realtimeOverride || (realtimeMode && useMainSegmentOnly)) {
|
if (!realtimeOverride || (realtimeMode && useMainSegmentOnly)) {
|
||||||
for (uint16_t i = start; i < stop; i++) {
|
for (uint16_t i = start; i < stop; i++) {
|
||||||
setRealtimePixel(i, data[c], data[c+1], data[c+2], ddpChannelsPerLed >3 ? data[c+3] : 0);
|
setRealtimePixel(i, data[c], data[c+1], data[c+2], ddpChannelsPerLed >3 ? data[c+3] : 0);
|
||||||
@ -242,7 +242,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
|
|||||||
strip.setBrightness(bri, true);
|
strip.setBrightness(bri, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is4Chan) {
|
if (!is4Chan) {
|
||||||
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
|
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
|
||||||
setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], 0);
|
setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], 0);
|
||||||
@ -445,7 +445,7 @@ void sendArtnetPollReply(ArtPollReply *reply, IPAddress ipAddress, uint16_t port
|
|||||||
reply->reply_sw_out[0] = (uint8_t)(portAddress & 0x000F);
|
reply->reply_sw_out[0] = (uint8_t)(portAddress & 0x000F);
|
||||||
|
|
||||||
snprintf_P((char *)reply->reply_node_report, sizeof(reply->reply_node_report)-1, PSTR("#0001 [%04u] OK - WLED v" TOSTRING(WLED_VERSION)), pollReplyCount);
|
snprintf_P((char *)reply->reply_node_report, sizeof(reply->reply_node_report)-1, PSTR("#0001 [%04u] OK - WLED v" TOSTRING(WLED_VERSION)), pollReplyCount);
|
||||||
|
|
||||||
if (pollReplyCount < 9999) {
|
if (pollReplyCount < 9999) {
|
||||||
pollReplyCount++;
|
pollReplyCount++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -172,7 +172,7 @@ void publishMqtt();
|
|||||||
void handleTime();
|
void handleTime();
|
||||||
void handleNetworkTime();
|
void handleNetworkTime();
|
||||||
void sendNTPPacket();
|
void sendNTPPacket();
|
||||||
bool checkNTPResponse();
|
bool checkNTPResponse();
|
||||||
void updateLocalTime();
|
void updateLocalTime();
|
||||||
void getTimeString(char* out);
|
void getTimeString(char* out);
|
||||||
bool checkCountdown();
|
bool checkCountdown();
|
||||||
@ -202,7 +202,7 @@ inline bool applyTemporaryPreset() {return applyPreset(255);};
|
|||||||
void savePreset(byte index, const char* pname = nullptr, JsonObject saveobj = JsonObject());
|
void savePreset(byte index, const char* pname = nullptr, JsonObject saveobj = JsonObject());
|
||||||
inline void saveTemporaryPreset() {savePreset(255);};
|
inline void saveTemporaryPreset() {savePreset(255);};
|
||||||
void deletePreset(byte index);
|
void deletePreset(byte index);
|
||||||
bool getPresetName(byte index, String& name);
|
bool getPresetName(byte index, String& name);
|
||||||
|
|
||||||
//set.cpp
|
//set.cpp
|
||||||
bool isAsterisksOnly(const char* str, byte maxLen);
|
bool isAsterisksOnly(const char* str, byte maxLen);
|
||||||
|
@ -102,7 +102,7 @@ bool bufferedFindSpace(uint16_t targetLen, bool fromStart = true) {
|
|||||||
while (f.position() < f.size() -1) {
|
while (f.position() < f.size() -1) {
|
||||||
uint16_t bufsize = f.read(buf, FS_BUFSIZE);
|
uint16_t bufsize = f.read(buf, FS_BUFSIZE);
|
||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
|
|
||||||
while (count < bufsize) {
|
while (count < bufsize) {
|
||||||
if(buf[count] == ' ') {
|
if(buf[count] == ' ') {
|
||||||
if(++index >= targetLen) { // return true if space long enough
|
if(++index >= targetLen) { // return true if space long enough
|
||||||
@ -144,7 +144,7 @@ bool bufferedFindObjectEnd() {
|
|||||||
while (f.position() < f.size() -1) {
|
while (f.position() < f.size() -1) {
|
||||||
uint16_t bufsize = f.read(buf, FS_BUFSIZE);
|
uint16_t bufsize = f.read(buf, FS_BUFSIZE);
|
||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
|
|
||||||
while (count < bufsize) {
|
while (count < bufsize) {
|
||||||
if (buf[count] == '{') objDepth++;
|
if (buf[count] == '{') objDepth++;
|
||||||
if (buf[count] == '}') objDepth--;
|
if (buf[count] == '}') objDepth--;
|
||||||
@ -194,7 +194,7 @@ bool appendObjectToFile(const char* key, JsonDocument* content, uint32_t s, uint
|
|||||||
doCloseFile = true;
|
doCloseFile = true;
|
||||||
return true; //nothing to append
|
return true; //nothing to append
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there is enough empty space in file, insert there instead of appending
|
//if there is enough empty space in file, insert there instead of appending
|
||||||
if (!contentLen) contentLen = measureJson(*content);
|
if (!contentLen) contentLen = measureJson(*content);
|
||||||
DEBUGFS_PRINTF("CLen %d\n", contentLen);
|
DEBUGFS_PRINTF("CLen %d\n", contentLen);
|
||||||
@ -211,18 +211,18 @@ bool appendObjectToFile(const char* key, JsonDocument* content, uint32_t s, uint
|
|||||||
|
|
||||||
//permitted space for presets exceeded
|
//permitted space for presets exceeded
|
||||||
updateFSInfo();
|
updateFSInfo();
|
||||||
|
|
||||||
if (f.size() + 9000 > (fsBytesTotal - fsBytesUsed)) { //make sure there is enough space to at least copy the file once
|
if (f.size() + 9000 > (fsBytesTotal - fsBytesUsed)) { //make sure there is enough space to at least copy the file once
|
||||||
errorFlag = ERR_FS_QUOTA;
|
errorFlag = ERR_FS_QUOTA;
|
||||||
doCloseFile = true;
|
doCloseFile = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if last character in file is '}' (typical)
|
//check if last character in file is '}' (typical)
|
||||||
uint32_t eof = f.size() -1;
|
uint32_t eof = f.size() -1;
|
||||||
f.seek(eof, SeekSet);
|
f.seek(eof, SeekSet);
|
||||||
if (f.read() == '}') pos = eof;
|
if (f.read() == '}') pos = eof;
|
||||||
|
|
||||||
if (pos == 0) //not found
|
if (pos == 0) //not found
|
||||||
{
|
{
|
||||||
DEBUGFS_PRINTLN("not }");
|
DEBUGFS_PRINTLN("not }");
|
||||||
@ -277,12 +277,12 @@ bool writeObjectToFile(const char* file, const char* key, JsonDocument* content)
|
|||||||
DEBUGFS_PRINTLN(F("Failed to open!"));
|
DEBUGFS_PRINTLN(F("Failed to open!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bufferedFind(key)) //key does not exist in file
|
if (!bufferedFind(key)) //key does not exist in file
|
||||||
{
|
{
|
||||||
return appendObjectToFile(key, content, s);
|
return appendObjectToFile(key, content, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
//an object with this key already exists, replace or delete it
|
//an object with this key already exists, replace or delete it
|
||||||
pos = f.position();
|
pos = f.position();
|
||||||
//measure out end of old object
|
//measure out end of old object
|
||||||
@ -297,7 +297,7 @@ bool writeObjectToFile(const char* file, const char* key, JsonDocument* content)
|
|||||||
//2. The new content is smaller than the old, overwrite and fill diff with spaces
|
//2. The new content is smaller than the old, overwrite and fill diff with spaces
|
||||||
//3. The new content is larger than the old, but smaller than old + trailing spaces, overwrite with new
|
//3. The new content is larger than the old, but smaller than old + trailing spaces, overwrite with new
|
||||||
//4. The new content is larger than old + trailing spaces, delete old and append
|
//4. The new content is larger than old + trailing spaces, delete old and append
|
||||||
|
|
||||||
uint32_t contentLen = 0;
|
uint32_t contentLen = 0;
|
||||||
if (!content->isNull()) contentLen = measureJson(*content);
|
if (!content->isNull()) contentLen = measureJson(*content);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ void handleHue()
|
|||||||
hueNewKey = false;
|
hueNewKey = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WLED_CONNECTED || hueClient == nullptr || millis() - hueLastRequestSent < huePollIntervalMs) return;
|
if (!WLED_CONNECTED || hueClient == nullptr || millis() - hueLastRequestSent < huePollIntervalMs) return;
|
||||||
|
|
||||||
hueLastRequestSent = millis();
|
hueLastRequestSent = millis();
|
||||||
@ -100,7 +100,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
|||||||
{
|
{
|
||||||
hueError = HUE_ERROR_JSON_PARSING; return;
|
hueError = HUE_ERROR_JSON_PARSING; return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hueErrorCode = root[0][F("error")]["type"];
|
int hueErrorCode = root[0][F("error")]["type"];
|
||||||
if (hueErrorCode)//hue bridge returned error
|
if (hueErrorCode)//hue bridge returned error
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hueAuthRequired)
|
if (hueAuthRequired)
|
||||||
{
|
{
|
||||||
const char* apikey = root[0][F("success")][F("username")];
|
const char* apikey = root[0][F("success")][F("username")];
|
||||||
@ -131,7 +131,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
|||||||
str = strstr(str,"state");
|
str = strstr(str,"state");
|
||||||
if (str == nullptr) return;
|
if (str == nullptr) return;
|
||||||
str = strstr(str,"{");
|
str = strstr(str,"{");
|
||||||
|
|
||||||
auto error = deserializeJson(root, str);
|
auto error = deserializeJson(root, str);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@ -176,7 +176,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hueError = HUE_ERROR_ACTIVE;
|
hueError = HUE_ERROR_ACTIVE;
|
||||||
|
|
||||||
//apply vals
|
//apply vals
|
||||||
if (hueBri != hueBriLast)
|
if (hueBri != hueBriLast)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ void handleImprovPacket() {
|
|||||||
uint8_t improvState = 0x02; //authorized
|
uint8_t improvState = 0x02; //authorized
|
||||||
if (WLED_WIFI_CONFIGURED) improvState = 0x03; //provisioning
|
if (WLED_WIFI_CONFIGURED) improvState = 0x03; //provisioning
|
||||||
if (Network.isConnected()) improvState = 0x04; //provisioned
|
if (Network.isConnected()) improvState = 0x04; //provisioned
|
||||||
sendImprovStateResponse(improvState, false);
|
sendImprovStateResponse(improvState, false);
|
||||||
if (improvState == 0x04) sendImprovRPCResponse(ImprovRPCType::Request_State);
|
if (improvState == 0x04) sendImprovRPCResponse(ImprovRPCType::Request_State);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ void sendImprovRPCResponse(byte commandId) {
|
|||||||
out[11] = len;
|
out[11] = len;
|
||||||
out[10] = 1 + len;
|
out[10] = 1 + len;
|
||||||
out[8] = 3 + len; //RPC command type + data len + url len + url
|
out[8] = 3 + len; //RPC command type + data len + url len + url
|
||||||
packetLen = 13 + len;
|
packetLen = 13 + len;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t checksum = 0;
|
uint8_t checksum = 0;
|
||||||
|
@ -71,11 +71,11 @@ void decBrightness()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply preset or fallback to a effect and palette if it doesn't exist
|
// apply preset or fallback to a effect and palette if it doesn't exist
|
||||||
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
||||||
{
|
{
|
||||||
applyPreset(presetID, CALL_MODE_BUTTON_PRESET);
|
applyPreset(presetID, CALL_MODE_BUTTON_PRESET);
|
||||||
//these two will be overwritten if preset exists in handlePresets()
|
//these two will be overwritten if preset exists in handlePresets()
|
||||||
effectCurrent = effectID;
|
effectCurrent = effectID;
|
||||||
effectPalette = paletteID;
|
effectPalette = paletteID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ void decodeIR(uint32_t code)
|
|||||||
if (code > 0xFFFFFF) return; //invalid code
|
if (code > 0xFFFFFF) return; //invalid code
|
||||||
|
|
||||||
switch (irEnabled) {
|
switch (irEnabled) {
|
||||||
case 1:
|
case 1:
|
||||||
if (code > 0xF80000) decodeIR24OLD(code); // white 24-key remote (old) - it sends 0xFF0000 values
|
if (code > 0xF80000) decodeIR24OLD(code); // white 24-key remote (old) - it sends 0xFF0000 values
|
||||||
else decodeIR24(code); // 24-key remote - 0xF70000 to 0xF80000
|
else decodeIR24(code); // 24-key remote - 0xF70000 to 0xF80000
|
||||||
break;
|
break;
|
||||||
@ -419,7 +419,7 @@ void decodeIR24CT(uint32_t code)
|
|||||||
case IR24_CT_CTPLUS : changeColor(COLOR_COLDWHITE, strip.getSegment(strip.getMainSegmentId()).cct+1); changeEffect(FX_MODE_STATIC); break;
|
case IR24_CT_CTPLUS : changeColor(COLOR_COLDWHITE, strip.getSegment(strip.getMainSegmentId()).cct+1); changeEffect(FX_MODE_STATIC); break;
|
||||||
case IR24_CT_CTMINUS : changeColor(COLOR_WARMWHITE, strip.getSegment(strip.getMainSegmentId()).cct-1); changeEffect(FX_MODE_STATIC); break;
|
case IR24_CT_CTMINUS : changeColor(COLOR_WARMWHITE, strip.getSegment(strip.getMainSegmentId()).cct-1); changeEffect(FX_MODE_STATIC); break;
|
||||||
case IR24_CT_MEMORY : changeColor(COLOR_NEUTRALWHITE, 127); changeEffect(FX_MODE_STATIC); break;
|
case IR24_CT_MEMORY : changeColor(COLOR_NEUTRALWHITE, 127); changeEffect(FX_MODE_STATIC); break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
lastValidCode = code;
|
lastValidCode = code;
|
||||||
}
|
}
|
||||||
@ -611,13 +611,13 @@ void decodeIR9(uint32_t code)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
This allows users to customize IR actions without the need to edit C code and compile.
|
This allows users to customize IR actions without the need to edit C code and compile.
|
||||||
From the https://github.com/Aircoookie/WLED/wiki/Infrared-Control page, download the starter
|
From the https://github.com/Aircoookie/WLED/wiki/Infrared-Control page, download the starter
|
||||||
ir.json file that corresponds to the number of buttons on your remote.
|
ir.json file that corresponds to the number of buttons on your remote.
|
||||||
Many of the remotes with the same number of buttons emit the same codes, but will have
|
Many of the remotes with the same number of buttons emit the same codes, but will have
|
||||||
different labels or colors. Once you edit the ir.json file, upload it to your controller
|
different labels or colors. Once you edit the ir.json file, upload it to your controller
|
||||||
using the /edit page.
|
using the /edit page.
|
||||||
|
|
||||||
Each key should be the hex encoded IR code. The "cmd" property should be the HTTP API
|
Each key should be the hex encoded IR code. The "cmd" property should be the HTTP API
|
||||||
or JSON API command to execute on button press. If the command contains a relative change (SI=~16),
|
or JSON API command to execute on button press. If the command contains a relative change (SI=~16),
|
||||||
it will register as a repeatable command. If the command doesn't contain a "~" but is repeatable, add "rpt" property
|
it will register as a repeatable command. If the command doesn't contain a "~" but is repeatable, add "rpt" property
|
||||||
set to true. Other properties are ignored but having labels and positions can assist with editing
|
set to true. Other properties are ignored but having labels and positions can assist with editing
|
||||||
@ -632,7 +632,7 @@ Sample:
|
|||||||
"label": "Preset 1, fallback to Saw - Party if not found"},
|
"label": "Preset 1, fallback to Saw - Party if not found"},
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void decodeIRJson(uint32_t code)
|
void decodeIRJson(uint32_t code)
|
||||||
{
|
{
|
||||||
char objKey[10];
|
char objKey[10];
|
||||||
String cmdStr;
|
String cmdStr;
|
||||||
@ -720,10 +720,10 @@ void handleIR()
|
|||||||
if (irEnabled > 0)
|
if (irEnabled > 0)
|
||||||
{
|
{
|
||||||
if (irrecv == NULL)
|
if (irrecv == NULL)
|
||||||
{
|
{
|
||||||
initIR(); return;
|
initIR(); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irrecv->decode(&results))
|
if (irrecv->decode(&results))
|
||||||
{
|
{
|
||||||
if (results.value != 0) // only print results if anything is received ( != 0 )
|
if (results.value != 0) // only print results if anything is received ( != 0 )
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
#define IR24_PINK 0xF76897
|
#define IR24_PINK 0xF76897
|
||||||
#define IR24_WHITE 0xF7E01F
|
#define IR24_WHITE 0xF7E01F
|
||||||
#define IR24_FLASH 0xF7D02F
|
#define IR24_FLASH 0xF7D02F
|
||||||
#define IR24_STROBE 0xF7F00F
|
#define IR24_STROBE 0xF7F00F
|
||||||
#define IR24_FADE 0xF7C837
|
#define IR24_FADE 0xF7C837
|
||||||
#define IR24_SMOOTH 0xF7E817
|
#define IR24_SMOOTH 0xF7E817
|
||||||
|
|
||||||
// 24-key defs for white remote control with CW / WW / CT+ and CT- keys (from ALDI LED pillar lamp)
|
// 24-key defs for white remote control with CW / WW / CT+ and CT- keys (from ALDI LED pillar lamp)
|
||||||
#define IR24_CT_BRIGHTER 0xF700FF // BRI +
|
#define IR24_CT_BRIGHTER 0xF700FF // BRI +
|
||||||
@ -75,7 +75,7 @@
|
|||||||
#define IR24_CT_CTMINUS 0xF7C837 // CT-
|
#define IR24_CT_CTMINUS 0xF7C837 // CT-
|
||||||
#define IR24_CT_MEMORY 0xF7E817 // MEMORY
|
#define IR24_CT_MEMORY 0xF7E817 // MEMORY
|
||||||
|
|
||||||
// 24-key defs for old remote control
|
// 24-key defs for old remote control
|
||||||
#define IR24_OLD_BRIGHTER 0xFF906F // Brightness Up
|
#define IR24_OLD_BRIGHTER 0xFF906F // Brightness Up
|
||||||
#define IR24_OLD_DARKER 0xFFB847 // Brightness Down
|
#define IR24_OLD_DARKER 0xFFB847 // Brightness Down
|
||||||
#define IR24_OLD_OFF 0xFFF807 // Power OFF
|
#define IR24_OLD_OFF 0xFFF807 // Power OFF
|
||||||
@ -101,30 +101,30 @@
|
|||||||
#define IR24_OLD_FADE 0xFF58A7 // FADE Mode
|
#define IR24_OLD_FADE 0xFF58A7 // FADE Mode
|
||||||
#define IR24_OLD_SMOOTH 0xFF30CF // SMOOTH Mode
|
#define IR24_OLD_SMOOTH 0xFF30CF // SMOOTH Mode
|
||||||
|
|
||||||
// 40-key defs for blue remote control
|
// 40-key defs for blue remote control
|
||||||
#define IR40_BPLUS 0xFF3AC5 //
|
#define IR40_BPLUS 0xFF3AC5 //
|
||||||
#define IR40_BMINUS 0xFFBA45 //
|
#define IR40_BMINUS 0xFFBA45 //
|
||||||
#define IR40_OFF 0xFF827D //
|
#define IR40_OFF 0xFF827D //
|
||||||
#define IR40_ON 0xFF02FD //
|
#define IR40_ON 0xFF02FD //
|
||||||
#define IR40_RED 0xFF1AE5 //
|
#define IR40_RED 0xFF1AE5 //
|
||||||
#define IR40_GREEN 0xFF9A65 //
|
#define IR40_GREEN 0xFF9A65 //
|
||||||
#define IR40_BLUE 0xFFA25D //
|
#define IR40_BLUE 0xFFA25D //
|
||||||
#define IR40_WHITE 0xFF22DD // natural white
|
#define IR40_WHITE 0xFF22DD // natural white
|
||||||
#define IR40_REDDISH 0xFF2AD5 //
|
#define IR40_REDDISH 0xFF2AD5 //
|
||||||
#define IR40_GREENISH 0xFFAA55 //
|
#define IR40_GREENISH 0xFFAA55 //
|
||||||
#define IR40_DEEPBLUE 0xFF926D //
|
#define IR40_DEEPBLUE 0xFF926D //
|
||||||
#define IR40_WARMWHITE2 0xFF12ED // warmest white
|
#define IR40_WARMWHITE2 0xFF12ED // warmest white
|
||||||
#define IR40_ORANGE 0xFF0AF5 //
|
#define IR40_ORANGE 0xFF0AF5 //
|
||||||
#define IR40_TURQUOISE 0xFF8A75 //
|
#define IR40_TURQUOISE 0xFF8A75 //
|
||||||
#define IR40_PURPLE 0xFFB24D //
|
#define IR40_PURPLE 0xFFB24D //
|
||||||
#define IR40_WARMWHITE 0xFF32CD // warm white
|
#define IR40_WARMWHITE 0xFF32CD // warm white
|
||||||
#define IR40_YELLOWISH 0xFF38C7 //
|
#define IR40_YELLOWISH 0xFF38C7 //
|
||||||
#define IR40_CYAN 0xFFB847 //
|
#define IR40_CYAN 0xFFB847 //
|
||||||
#define IR40_MAGENTA 0xFF7887 //
|
#define IR40_MAGENTA 0xFF7887 //
|
||||||
#define IR40_COLDWHITE 0xFFF807 // cold white
|
#define IR40_COLDWHITE 0xFFF807 // cold white
|
||||||
#define IR40_YELLOW 0xFF18E7 //
|
#define IR40_YELLOW 0xFF18E7 //
|
||||||
#define IR40_AQUA 0xFF9867 //
|
#define IR40_AQUA 0xFF9867 //
|
||||||
#define IR40_PINK 0xFF58A7 //
|
#define IR40_PINK 0xFF58A7 //
|
||||||
#define IR40_COLDWHITE2 0xFFD827 // coldest white
|
#define IR40_COLDWHITE2 0xFFD827 // coldest white
|
||||||
#define IR40_WPLUS 0xFF28D7 // white chanel bright plus
|
#define IR40_WPLUS 0xFF28D7 // white chanel bright plus
|
||||||
#define IR40_WMINUS 0xFFA857 // white chanel bright minus
|
#define IR40_WMINUS 0xFFA857 // white chanel bright minus
|
||||||
@ -144,50 +144,50 @@
|
|||||||
#define IR40_SLOW 0xFFD02F // SLOW
|
#define IR40_SLOW 0xFFD02F // SLOW
|
||||||
|
|
||||||
// 44-key defs
|
// 44-key defs
|
||||||
#define IR44_BPLUS 0xFF3AC5 //
|
#define IR44_BPLUS 0xFF3AC5 //
|
||||||
#define IR44_BMINUS 0xFFBA45 //
|
#define IR44_BMINUS 0xFFBA45 //
|
||||||
#define IR44_OFF 0xFF827D //
|
#define IR44_OFF 0xFF827D //
|
||||||
#define IR44_ON 0xFF02FD //
|
#define IR44_ON 0xFF02FD //
|
||||||
#define IR44_RED 0xFF1AE5 //
|
#define IR44_RED 0xFF1AE5 //
|
||||||
#define IR44_GREEN 0xFF9A65 //
|
#define IR44_GREEN 0xFF9A65 //
|
||||||
#define IR44_BLUE 0xFFA25D //
|
#define IR44_BLUE 0xFFA25D //
|
||||||
#define IR44_WHITE 0xFF22DD // natural white
|
#define IR44_WHITE 0xFF22DD // natural white
|
||||||
#define IR44_REDDISH 0xFF2AD5 //
|
#define IR44_REDDISH 0xFF2AD5 //
|
||||||
#define IR44_GREENISH 0xFFAA55 //
|
#define IR44_GREENISH 0xFFAA55 //
|
||||||
#define IR44_DEEPBLUE 0xFF926D //
|
#define IR44_DEEPBLUE 0xFF926D //
|
||||||
#define IR44_WARMWHITE2 0xFF12ED // warmest white
|
#define IR44_WARMWHITE2 0xFF12ED // warmest white
|
||||||
#define IR44_ORANGE 0xFF0AF5 //
|
#define IR44_ORANGE 0xFF0AF5 //
|
||||||
#define IR44_TURQUOISE 0xFF8A75 //
|
#define IR44_TURQUOISE 0xFF8A75 //
|
||||||
#define IR44_PURPLE 0xFFB24D //
|
#define IR44_PURPLE 0xFFB24D //
|
||||||
#define IR44_WARMWHITE 0xFF32CD // warm white
|
#define IR44_WARMWHITE 0xFF32CD // warm white
|
||||||
#define IR44_YELLOWISH 0xFF38C7 //
|
#define IR44_YELLOWISH 0xFF38C7 //
|
||||||
#define IR44_CYAN 0xFFB847 //
|
#define IR44_CYAN 0xFFB847 //
|
||||||
#define IR44_MAGENTA 0xFF7887 //
|
#define IR44_MAGENTA 0xFF7887 //
|
||||||
#define IR44_COLDWHITE 0xFFF807 // cold white
|
#define IR44_COLDWHITE 0xFFF807 // cold white
|
||||||
#define IR44_YELLOW 0xFF18E7 //
|
#define IR44_YELLOW 0xFF18E7 //
|
||||||
#define IR44_AQUA 0xFF9867 //
|
#define IR44_AQUA 0xFF9867 //
|
||||||
#define IR44_PINK 0xFF58A7 //
|
#define IR44_PINK 0xFF58A7 //
|
||||||
#define IR44_COLDWHITE2 0xFFD827 // coldest white
|
#define IR44_COLDWHITE2 0xFFD827 // coldest white
|
||||||
#define IR44_REDPLUS 0xFF28D7 //
|
#define IR44_REDPLUS 0xFF28D7 //
|
||||||
#define IR44_GREENPLUS 0xFFA857 //
|
#define IR44_GREENPLUS 0xFFA857 //
|
||||||
#define IR44_BLUEPLUS 0xFF6897 //
|
#define IR44_BLUEPLUS 0xFF6897 //
|
||||||
#define IR44_QUICK 0xFFE817 //
|
#define IR44_QUICK 0xFFE817 //
|
||||||
#define IR44_REDMINUS 0xFF08F7 //
|
#define IR44_REDMINUS 0xFF08F7 //
|
||||||
#define IR44_GREENMINUS 0xFF8877 //
|
#define IR44_GREENMINUS 0xFF8877 //
|
||||||
#define IR44_BLUEMINUS 0xFF48B7 //
|
#define IR44_BLUEMINUS 0xFF48B7 //
|
||||||
#define IR44_SLOW 0xFFC837 //
|
#define IR44_SLOW 0xFFC837 //
|
||||||
#define IR44_DIY1 0xFF30CF //
|
#define IR44_DIY1 0xFF30CF //
|
||||||
#define IR44_DIY2 0xFFB04F //
|
#define IR44_DIY2 0xFFB04F //
|
||||||
#define IR44_DIY3 0xFF708F //
|
#define IR44_DIY3 0xFF708F //
|
||||||
#define IR44_AUTO 0xFFF00F //
|
#define IR44_AUTO 0xFFF00F //
|
||||||
#define IR44_DIY4 0xFF10EF //
|
#define IR44_DIY4 0xFF10EF //
|
||||||
#define IR44_DIY5 0xFF906F //
|
#define IR44_DIY5 0xFF906F //
|
||||||
#define IR44_DIY6 0xFF50AF //
|
#define IR44_DIY6 0xFF50AF //
|
||||||
#define IR44_FLASH 0xFFD02F //
|
#define IR44_FLASH 0xFFD02F //
|
||||||
#define IR44_JUMP3 0xFF20DF //
|
#define IR44_JUMP3 0xFF20DF //
|
||||||
#define IR44_JUMP7 0xFFA05F //
|
#define IR44_JUMP7 0xFFA05F //
|
||||||
#define IR44_FADE3 0xFF609F //
|
#define IR44_FADE3 0xFF609F //
|
||||||
#define IR44_FADE7 0xFFE01F //
|
#define IR44_FADE7 0xFFE01F //
|
||||||
|
|
||||||
//Infrared codes for 21-key remote https://images-na.ssl-images-amazon.com/images/I/51NMA0XucnL.jpg
|
//Infrared codes for 21-key remote https://images-na.ssl-images-amazon.com/images/I/51NMA0XucnL.jpg
|
||||||
#define IR21_BRIGHTER 0xFFE01F
|
#define IR21_BRIGHTER 0xFFE01F
|
||||||
|
@ -201,7 +201,7 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
|||||||
seg.check1 = elem["o1"] | seg.check1;
|
seg.check1 = elem["o1"] | seg.check1;
|
||||||
seg.check2 = elem["o2"] | seg.check2;
|
seg.check2 = elem["o2"] | seg.check2;
|
||||||
seg.check3 = elem["o3"] | seg.check3;
|
seg.check3 = elem["o3"] | seg.check3;
|
||||||
|
|
||||||
JsonArray iarr = elem[F("i")]; //set individual LEDs
|
JsonArray iarr = elem[F("i")]; //set individual LEDs
|
||||||
if (!iarr.isNull()) {
|
if (!iarr.isNull()) {
|
||||||
// set brightness immediately and disable transition
|
// set brightness immediately and disable transition
|
||||||
@ -477,15 +477,17 @@ void serializeSegment(JsonObject& root, Segment& seg, byte id, bool forPreset, b
|
|||||||
root["sel"] = seg.isSelected();
|
root["sel"] = seg.isSelected();
|
||||||
root["rev"] = seg.reverse;
|
root["rev"] = seg.reverse;
|
||||||
root["mi"] = seg.mirror;
|
root["mi"] = seg.mirror;
|
||||||
|
#ifndef WLED_DISABLE_2D
|
||||||
if (strip.isMatrix) {
|
if (strip.isMatrix) {
|
||||||
root["rY"] = seg.reverse_y;
|
root["rY"] = seg.reverse_y;
|
||||||
root["mY"] = seg.mirror_y;
|
root["mY"] = seg.mirror_y;
|
||||||
root[F("tp")] = seg.transpose;
|
root[F("tp")] = seg.transpose;
|
||||||
}
|
}
|
||||||
root["o1"] = seg.check1;
|
#endif
|
||||||
root["o2"] = seg.check2;
|
root["o1"] = seg.check1;
|
||||||
root["o3"] = seg.check3;
|
root["o2"] = seg.check2;
|
||||||
root["si"] = seg.soundSim;
|
root["o3"] = seg.check3;
|
||||||
|
root["si"] = seg.soundSim;
|
||||||
root["m12"] = seg.map1D2D;
|
root["m12"] = seg.map1D2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +652,7 @@ void serializeInfo(JsonObject root)
|
|||||||
fs_info[F("pmt")] = presetsModifiedTime;
|
fs_info[F("pmt")] = presetsModifiedTime;
|
||||||
|
|
||||||
root[F("ndc")] = nodeListEnabled ? (int)Nodes.size() : -1;
|
root[F("ndc")] = nodeListEnabled ? (int)Nodes.size() : -1;
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#ifdef WLED_DEBUG
|
#ifdef WLED_DEBUG
|
||||||
wifi_info[F("txPower")] = (int) WiFi.getTxPower();
|
wifi_info[F("txPower")] = (int) WiFi.getTxPower();
|
||||||
@ -800,7 +802,7 @@ void serializePalettes(JsonObject root, AsyncWebServerRequest* request)
|
|||||||
JsonArray curPalette = palettes.createNestedArray(String(i>=palettesCount ? 255 - i + palettesCount : i));
|
JsonArray curPalette = palettes.createNestedArray(String(i>=palettesCount ? 255 - i + palettesCount : i));
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0: //default palette
|
case 0: //default palette
|
||||||
setPaletteColors(curPalette, PartyColors_p);
|
setPaletteColors(curPalette, PartyColors_p);
|
||||||
break;
|
break;
|
||||||
case 1: //random
|
case 1: //random
|
||||||
curPalette.add("r");
|
curPalette.add("r");
|
||||||
|
@ -102,19 +102,19 @@ void stateUpdated(byte callMode) {
|
|||||||
|
|
||||||
if (bri != briOld || stateChanged) {
|
if (bri != briOld || stateChanged) {
|
||||||
if (stateChanged) currentPreset = 0; //something changed, so we are no longer in the preset
|
if (stateChanged) currentPreset = 0; //something changed, so we are no longer in the preset
|
||||||
|
|
||||||
if (callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) notify(callMode);
|
if (callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) notify(callMode);
|
||||||
|
|
||||||
//set flag to update blynk, ws and mqtt
|
//set flag to update blynk, ws and mqtt
|
||||||
interfaceUpdateCallMode = callMode;
|
interfaceUpdateCallMode = callMode;
|
||||||
stateChanged = false;
|
stateChanged = false;
|
||||||
} else {
|
} else {
|
||||||
if (nightlightActive && !nightlightActiveOld && callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) {
|
if (nightlightActive && !nightlightActiveOld && callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) {
|
||||||
notify(CALL_MODE_NIGHTLIGHT);
|
notify(CALL_MODE_NIGHTLIGHT);
|
||||||
interfaceUpdateCallMode = CALL_MODE_NIGHTLIGHT;
|
interfaceUpdateCallMode = CALL_MODE_NIGHTLIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callMode != CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE)) {
|
if (callMode != CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE)) {
|
||||||
briNlT = bri;
|
briNlT = bri;
|
||||||
nightlightDelayMs -= (millis() - nightlightStartTime);
|
nightlightDelayMs -= (millis() - nightlightStartTime);
|
||||||
@ -128,7 +128,7 @@ void stateUpdated(byte callMode) {
|
|||||||
|
|
||||||
//deactivate nightlight if target brightness is reached
|
//deactivate nightlight if target brightness is reached
|
||||||
if (bri == nightlightTargetBri && callMode != CALL_MODE_NO_NOTIFY && nightlightMode != NL_MODE_SUN) nightlightActive = false;
|
if (bri == nightlightTargetBri && callMode != CALL_MODE_NO_NOTIFY && nightlightMode != NL_MODE_SUN) nightlightActive = false;
|
||||||
|
|
||||||
if (fadeTransition) {
|
if (fadeTransition) {
|
||||||
//set correct delay if not using notification delay
|
//set correct delay if not using notification delay
|
||||||
if (callMode != CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay; // load actual transition duration
|
if (callMode != CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay; // load actual transition duration
|
||||||
@ -160,7 +160,7 @@ void updateInterfaces(uint8_t callMode)
|
|||||||
sendDataWs();
|
sendDataWs();
|
||||||
lastInterfaceUpdate = millis();
|
lastInterfaceUpdate = millis();
|
||||||
if (callMode == CALL_MODE_WS_SEND) return;
|
if (callMode == CALL_MODE_WS_SEND) return;
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_ALEXA
|
#ifndef WLED_DISABLE_ALEXA
|
||||||
if (espalexaDevice != nullptr && callMode != CALL_MODE_ALEXA) {
|
if (espalexaDevice != nullptr && callMode != CALL_MODE_ALEXA) {
|
||||||
espalexaDevice->setValue(bri);
|
espalexaDevice->setValue(bri);
|
||||||
@ -168,7 +168,7 @@ void updateInterfaces(uint8_t callMode)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef WLED_DISABLE_BLYNK
|
#ifndef WLED_DISABLE_BLYNK
|
||||||
if (callMode != CALL_MODE_BLYNK &&
|
if (callMode != CALL_MODE_BLYNK &&
|
||||||
callMode != CALL_MODE_NO_NOTIFY) updateBlynk();
|
callMode != CALL_MODE_NO_NOTIFY) updateBlynk();
|
||||||
#endif
|
#endif
|
||||||
doPublishMqtt = true;
|
doPublishMqtt = true;
|
||||||
@ -181,7 +181,7 @@ void handleTransitions()
|
|||||||
//handle still pending interface update
|
//handle still pending interface update
|
||||||
if (interfaceUpdateCallMode && millis() - lastInterfaceUpdate > INTERFACE_UPDATE_COOLDOWN) updateInterfaces(interfaceUpdateCallMode);
|
if (interfaceUpdateCallMode && millis() - lastInterfaceUpdate > INTERFACE_UPDATE_COOLDOWN) updateInterfaces(interfaceUpdateCallMode);
|
||||||
if (doPublishMqtt) publishMqtt();
|
if (doPublishMqtt) publishMqtt();
|
||||||
|
|
||||||
if (transitionActive && transitionDelayTemp > 0)
|
if (transitionActive && transitionDelayTemp > 0)
|
||||||
{
|
{
|
||||||
float tper = (millis() - transitionStartTime)/(float)transitionDelayTemp;
|
float tper = (millis() - transitionStartTime)/(float)transitionDelayTemp;
|
||||||
@ -196,7 +196,7 @@ void handleTransitions()
|
|||||||
if (tper - tperLast < 0.004) return;
|
if (tper - tperLast < 0.004) return;
|
||||||
tperLast = tper;
|
tperLast = tper;
|
||||||
briT = briOld + ((bri - briOld) * tper);
|
briT = briOld + ((bri - briOld) * tper);
|
||||||
|
|
||||||
applyBri();
|
applyBri();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@ bool parseLx(int lxValue, byte rgbw[4])
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
float lxRed = 0, lxGreen = 0, lxBlue = 0;
|
float lxRed = 0, lxGreen = 0, lxBlue = 0;
|
||||||
|
|
||||||
if (lxValue < 200000000) {
|
if (lxValue < 200000000) {
|
||||||
// Loxone RGB
|
// Loxone RGB
|
||||||
ok = true;
|
ok = true;
|
||||||
lxRed = round((lxValue % 1000) * 2.55);
|
lxRed = round((lxValue % 1000) * 2.55);
|
||||||
lxGreen = round(((lxValue / 1000) % 1000) * 2.55);
|
lxGreen = round(((lxValue / 1000) % 1000) * 2.55);
|
||||||
lxBlue = round(((lxValue / 1000000) % 1000) * 2.55);
|
lxBlue = round(((lxValue / 1000000) % 1000) * 2.55);
|
||||||
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
|
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
|
||||||
// Loxone Lumitech
|
// Loxone Lumitech
|
||||||
ok = true;
|
ok = true;
|
||||||
float tmpBri = floor((lxValue - 200000000) / 10000); ;
|
float tmpBri = floor((lxValue - 200000000) / 10000); ;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Welcome!
|
* Welcome!
|
||||||
* You can use the file "my_config.h" to make changes to the way WLED is compiled!
|
* You can use the file "my_config.h" to make changes to the way WLED is compiled!
|
||||||
* It is possible to enable and disable certain features as well as set defaults for some runtime changeable settings.
|
* It is possible to enable and disable certain features as well as set defaults for some runtime changeable settings.
|
||||||
*
|
*
|
||||||
* How to use:
|
* How to use:
|
||||||
* PlatformIO: Just compile the unmodified code once! The file "my_config.h" will be generated automatically and now you can make your changes.
|
* PlatformIO: Just compile the unmodified code once! The file "my_config.h" will be generated automatically and now you can make your changes.
|
||||||
*
|
*
|
||||||
* ArduinoIDE: Make a copy of this file and name it "my_config.h". Go to wled.h and uncomment "#define WLED_USE_MY_CONFIG" in the top of the file.
|
* ArduinoIDE: Make a copy of this file and name it "my_config.h". Go to wled.h and uncomment "#define WLED_USE_MY_CONFIG" in the top of the file.
|
||||||
*
|
*
|
||||||
* DO NOT make changes to the "my_config_sample.h" file directly! Your changes will not be applied.
|
* DO NOT make changes to the "my_config_sample.h" file directly! Your changes will not be applied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -20,27 +20,27 @@ const ethernet_settings ethernetBoards[] = {
|
|||||||
// None
|
// None
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
|
|
||||||
// WT32-EHT01
|
// WT32-EHT01
|
||||||
// Please note, from my testing only these pins work for LED outputs:
|
// Please note, from my testing only these pins work for LED outputs:
|
||||||
// IO2, IO4, IO12, IO14, IO15
|
// IO2, IO4, IO12, IO14, IO15
|
||||||
// These pins do not appear to work from my testing:
|
// These pins do not appear to work from my testing:
|
||||||
// IO35, IO36, IO39
|
// IO35, IO36, IO39
|
||||||
{
|
{
|
||||||
1, // eth_address,
|
1, // eth_address,
|
||||||
16, // eth_power,
|
16, // eth_power,
|
||||||
23, // eth_mdc,
|
23, // eth_mdc,
|
||||||
18, // eth_mdio,
|
18, // eth_mdio,
|
||||||
ETH_PHY_LAN8720, // eth_type,
|
ETH_PHY_LAN8720, // eth_type,
|
||||||
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
||||||
},
|
},
|
||||||
|
|
||||||
// ESP32-POE
|
// ESP32-POE
|
||||||
{
|
{
|
||||||
0, // eth_address,
|
0, // eth_address,
|
||||||
12, // eth_power,
|
12, // eth_power,
|
||||||
23, // eth_mdc,
|
23, // eth_mdc,
|
||||||
18, // eth_mdio,
|
18, // eth_mdio,
|
||||||
ETH_PHY_LAN8720, // eth_type,
|
ETH_PHY_LAN8720, // eth_type,
|
||||||
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
||||||
},
|
},
|
||||||
@ -77,20 +77,20 @@ const ethernet_settings ethernetBoards[] = {
|
|||||||
|
|
||||||
// ESP3DEUXQuattro
|
// ESP3DEUXQuattro
|
||||||
{
|
{
|
||||||
1, // eth_address,
|
1, // eth_address,
|
||||||
-1, // eth_power,
|
-1, // eth_power,
|
||||||
23, // eth_mdc,
|
23, // eth_mdc,
|
||||||
18, // eth_mdio,
|
18, // eth_mdio,
|
||||||
ETH_PHY_LAN8720, // eth_type,
|
ETH_PHY_LAN8720, // eth_type,
|
||||||
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
||||||
},
|
},
|
||||||
|
|
||||||
// ESP32-ETHERNET-KIT-VE
|
// ESP32-ETHERNET-KIT-VE
|
||||||
{
|
{
|
||||||
0, // eth_address,
|
0, // eth_address,
|
||||||
5, // eth_power,
|
5, // eth_power,
|
||||||
23, // eth_mdc,
|
23, // eth_mdc,
|
||||||
18, // eth_mdio,
|
18, // eth_mdio,
|
||||||
ETH_PHY_IP101, // eth_type,
|
ETH_PHY_IP101, // eth_type,
|
||||||
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
||||||
},
|
},
|
||||||
@ -135,7 +135,7 @@ void WiFiEvent(WiFiEvent_t event)
|
|||||||
#ifdef WLED_USE_ETHERNET
|
#ifdef WLED_USE_ETHERNET
|
||||||
char hostname[25];
|
char hostname[25];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
|
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
|
||||||
case SYSTEM_EVENT_ETH_START:
|
case SYSTEM_EVENT_ETH_START:
|
||||||
|
@ -162,7 +162,7 @@ void updateTimezone() {
|
|||||||
|
|
||||||
void handleTime() {
|
void handleTime() {
|
||||||
handleNetworkTime();
|
handleNetworkTime();
|
||||||
|
|
||||||
toki.millisecond();
|
toki.millisecond();
|
||||||
toki.setTick();
|
toki.setTick();
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ void checkTimers()
|
|||||||
{
|
{
|
||||||
if (timerMacro[i] != 0
|
if (timerMacro[i] != 0
|
||||||
&& (timerWeekday[i] & 0x01) //timer is enabled
|
&& (timerWeekday[i] & 0x01) //timer is enabled
|
||||||
&& (timerHours[i] == hour(localTime) || timerHours[i] == 24) //if hour is set to 24, activate every hour
|
&& (timerHours[i] == hour(localTime) || timerHours[i] == 24) //if hour is set to 24, activate every hour
|
||||||
&& timerMinutes[i] == minute(localTime)
|
&& timerMinutes[i] == minute(localTime)
|
||||||
&& ((timerWeekday[i] >> weekdayMondayFirst()) & 0x01) //timer should activate at current day of week
|
&& ((timerWeekday[i] >> weekdayMondayFirst()) & 0x01) //timer should activate at current day of week
|
||||||
&& isTodayInDateRange(((timerMonth[i] >> 4) & 0x0F), timerDay[i], timerMonth[i] & 0x0F, timerDayEnd[i])
|
&& isTodayInDateRange(((timerMonth[i] >> 4) & 0x0F), timerDay[i], timerMonth[i] & 0x0F, timerDayEnd[i])
|
||||||
@ -416,24 +416,24 @@ int getSunriseUTC(int year, int month, int day, float lat, float lon, bool sunse
|
|||||||
float N = N1 - (N2 * N3) + day - 30;
|
float N = N1 - (N2 * N3) + day - 30;
|
||||||
|
|
||||||
//2. convert the longitude to hour value and calculate an approximate time
|
//2. convert the longitude to hour value and calculate an approximate time
|
||||||
float lngHour = lon / 15.0f;
|
float lngHour = lon / 15.0f;
|
||||||
float t = N + (((sunset ? 18 : 6) - lngHour) / 24);
|
float t = N + (((sunset ? 18 : 6) - lngHour) / 24);
|
||||||
|
|
||||||
//3. calculate the Sun's mean anomaly
|
//3. calculate the Sun's mean anomaly
|
||||||
float M = (0.9856f * t) - 3.289f;
|
float M = (0.9856f * t) - 3.289f;
|
||||||
|
|
||||||
//4. calculate the Sun's true longitude
|
//4. calculate the Sun's true longitude
|
||||||
float L = fmod_t(M + (1.916f * sin_t(DEG_TO_RAD*M)) + (0.02f * sin_t(2*DEG_TO_RAD*M)) + 282.634f, 360.0f);
|
float L = fmod_t(M + (1.916f * sin_t(DEG_TO_RAD*M)) + (0.02f * sin_t(2*DEG_TO_RAD*M)) + 282.634f, 360.0f);
|
||||||
|
|
||||||
//5a. calculate the Sun's right ascension
|
//5a. calculate the Sun's right ascension
|
||||||
float RA = fmod_t(RAD_TO_DEG*atan_t(0.91764f * tan_t(DEG_TO_RAD*L)), 360.0f);
|
float RA = fmod_t(RAD_TO_DEG*atan_t(0.91764f * tan_t(DEG_TO_RAD*L)), 360.0f);
|
||||||
|
|
||||||
//5b. right ascension value needs to be in the same quadrant as L
|
//5b. right ascension value needs to be in the same quadrant as L
|
||||||
float Lquadrant = floor_t( L/90) * 90;
|
float Lquadrant = floor_t( L/90) * 90;
|
||||||
float RAquadrant = floor_t(RA/90) * 90;
|
float RAquadrant = floor_t(RA/90) * 90;
|
||||||
RA = RA + (Lquadrant - RAquadrant);
|
RA = RA + (Lquadrant - RAquadrant);
|
||||||
|
|
||||||
//5c. right ascension value needs to be converted into hours
|
//5c. right ascension value needs to be converted into hours
|
||||||
RA /= 15.0f;
|
RA /= 15.0f;
|
||||||
|
|
||||||
//6. calculate the Sun's declination
|
//6. calculate the Sun's declination
|
||||||
@ -449,7 +449,7 @@ int getSunriseUTC(int year, int month, int day, float lat, float lon, bool sunse
|
|||||||
float H = sunset ? RAD_TO_DEG*acos_t(cosH) : 360 - RAD_TO_DEG*acos_t(cosH);
|
float H = sunset ? RAD_TO_DEG*acos_t(cosH) : 360 - RAD_TO_DEG*acos_t(cosH);
|
||||||
H /= 15.0f;
|
H /= 15.0f;
|
||||||
|
|
||||||
//8. calculate local mean time of rising/setting
|
//8. calculate local mean time of rising/setting
|
||||||
float T = H + RA - (0.06571f * t) - 6.622f;
|
float T = H + RA - (0.06571f * t) - 6.622f;
|
||||||
|
|
||||||
//9. adjust back to UTC
|
//9. adjust back to UTC
|
||||||
|
@ -18,7 +18,7 @@ void _overlayAnalogClock()
|
|||||||
int hourPixel = floor(analogClock12pixel + overlaySize*hourP);
|
int hourPixel = floor(analogClock12pixel + overlaySize*hourP);
|
||||||
if (hourPixel > overlayMax) hourPixel = overlayMin -1 + hourPixel - overlayMax;
|
if (hourPixel > overlayMax) hourPixel = overlayMin -1 + hourPixel - overlayMax;
|
||||||
int minutePixel = floor(analogClock12pixel + overlaySize*minuteP);
|
int minutePixel = floor(analogClock12pixel + overlaySize*minuteP);
|
||||||
if (minutePixel > overlayMax) minutePixel = overlayMin -1 + minutePixel - overlayMax;
|
if (minutePixel > overlayMax) minutePixel = overlayMin -1 + minutePixel - overlayMax;
|
||||||
int secondPixel = floor(analogClock12pixel + overlaySize*secondP);
|
int secondPixel = floor(analogClock12pixel + overlaySize*secondP);
|
||||||
if (secondPixel > overlayMax) secondPixel = overlayMin -1 + secondPixel - overlayMax;
|
if (secondPixel > overlayMax) secondPixel = overlayMin -1 + secondPixel - overlayMax;
|
||||||
if (analogClockSecondsTrail)
|
if (analogClockSecondsTrail)
|
||||||
|
@ -514,7 +514,7 @@ const byte Tiamat_gp[] PROGMEM = {
|
|||||||
220, 39,252,135, //gc from 177,254,255
|
220, 39,252,135, //gc from 177,254,255
|
||||||
240, 193,213,253, //gc from 203,239,253
|
240, 193,213,253, //gc from 203,239,253
|
||||||
255, 255,249,255};
|
255, 255,249,255};
|
||||||
|
|
||||||
//Custom palette by Aircoookie
|
//Custom palette by Aircoookie
|
||||||
|
|
||||||
const byte April_Night_gp[] PROGMEM = {
|
const byte April_Night_gp[] PROGMEM = {
|
||||||
@ -598,16 +598,16 @@ const byte Atlantica_gp[] PROGMEM = {
|
|||||||
0, 255, 5, 0, //red
|
0, 255, 5, 0, //red
|
||||||
60, 255, 5, 0,
|
60, 255, 5, 0,
|
||||||
60, 196, 57, 2, //amber (start 61?)
|
60, 196, 57, 2, //amber (start 61?)
|
||||||
120, 196, 57, 2,
|
120, 196, 57, 2,
|
||||||
120, 6, 126, 2, //green (start 126?)
|
120, 6, 126, 2, //green (start 126?)
|
||||||
180, 6, 126, 2,
|
180, 6, 126, 2,
|
||||||
180, 4, 30, 114, //blue (start 191?)
|
180, 4, 30, 114, //blue (start 191?)
|
||||||
255, 4, 30, 114};
|
255, 4, 30, 114};
|
||||||
|
|
||||||
// Gradient palette "temperature_gp", originally from
|
// Gradient palette "temperature_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/arendal/tn/temperature.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/arendal/tn/temperature.png.index.html
|
||||||
// converted for FastLED with gammas (2.6, 2.2, 2.5)
|
// converted for FastLED with gammas (2.6, 2.2, 2.5)
|
||||||
// Size: 144 bytes of program space.
|
// Size: 144 bytes of program space.
|
||||||
|
|
||||||
const byte temperature_gp[] PROGMEM = {
|
const byte temperature_gp[] PROGMEM = {
|
||||||
0, 1, 27,105,
|
0, 1, 27,105,
|
||||||
|
@ -31,7 +31,7 @@ bool PinManagerClass::deallocatePin(byte gpio, PinOwner tag)
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte by = gpio >> 3;
|
byte by = gpio >> 3;
|
||||||
byte bi = gpio - 8*by;
|
byte bi = gpio - 8*by;
|
||||||
bitWrite(pinAlloc[by], bi, false);
|
bitWrite(pinAlloc[by], bi, false);
|
||||||
@ -119,7 +119,7 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by
|
|||||||
continue;
|
continue;
|
||||||
} else if (isPinAllocated(gpio)) {
|
} else if (isPinAllocated(gpio)) {
|
||||||
#ifdef WLED_DEBUG
|
#ifdef WLED_DEBUG
|
||||||
DEBUG_PRINT(F("PIN ALLOC: FAIL: IO "));
|
DEBUG_PRINT(F("PIN ALLOC: FAIL: IO "));
|
||||||
DEBUG_PRINT(gpio);
|
DEBUG_PRINT(gpio);
|
||||||
DEBUG_PRINT(F(" already allocated by "));
|
DEBUG_PRINT(F(" already allocated by "));
|
||||||
DebugPrintOwnerTag(ownerTag[gpio]);
|
DebugPrintOwnerTag(ownerTag[gpio]);
|
||||||
@ -143,7 +143,7 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by
|
|||||||
// as this can greatly simplify configuration arrays
|
// as this can greatly simplify configuration arrays
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (gpio >= WLED_NUM_PINS)
|
if (gpio >= WLED_NUM_PINS)
|
||||||
continue; // other unexpected GPIO => avoid array bounds violation
|
continue; // other unexpected GPIO => avoid array bounds violation
|
||||||
|
|
||||||
byte by = gpio >> 3;
|
byte by = gpio >> 3;
|
||||||
@ -151,7 +151,7 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by
|
|||||||
bitWrite(pinAlloc[by], bi, true);
|
bitWrite(pinAlloc[by], bi, true);
|
||||||
ownerTag[gpio] = tag;
|
ownerTag[gpio] = tag;
|
||||||
#ifdef WLED_DEBUG
|
#ifdef WLED_DEBUG
|
||||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||||
DEBUG_PRINT(gpio);
|
DEBUG_PRINT(gpio);
|
||||||
DEBUG_PRINT(F(" allocated by "));
|
DEBUG_PRINT(F(" allocated by "));
|
||||||
DebugPrintOwnerTag(tag);
|
DebugPrintOwnerTag(tag);
|
||||||
@ -183,7 +183,7 @@ bool PinManagerClass::allocatePin(byte gpio, bool output, PinOwner tag)
|
|||||||
}
|
}
|
||||||
if (isPinAllocated(gpio)) {
|
if (isPinAllocated(gpio)) {
|
||||||
#ifdef WLED_DEBUG
|
#ifdef WLED_DEBUG
|
||||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||||
DEBUG_PRINT(gpio);
|
DEBUG_PRINT(gpio);
|
||||||
DEBUG_PRINT(F(" already allocated by "));
|
DEBUG_PRINT(F(" already allocated by "));
|
||||||
DebugPrintOwnerTag(ownerTag[gpio]);
|
DebugPrintOwnerTag(ownerTag[gpio]);
|
||||||
@ -197,12 +197,12 @@ bool PinManagerClass::allocatePin(byte gpio, bool output, PinOwner tag)
|
|||||||
bitWrite(pinAlloc[by], bi, true);
|
bitWrite(pinAlloc[by], bi, true);
|
||||||
ownerTag[gpio] = tag;
|
ownerTag[gpio] = tag;
|
||||||
#ifdef WLED_DEBUG
|
#ifdef WLED_DEBUG
|
||||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||||
DEBUG_PRINT(gpio);
|
DEBUG_PRINT(gpio);
|
||||||
DEBUG_PRINT(F(" successfully allocated by "));
|
DEBUG_PRINT(F(" successfully allocated by "));
|
||||||
DebugPrintOwnerTag(tag);
|
DebugPrintOwnerTag(tag);
|
||||||
DEBUG_PRINTLN(F(""));
|
DEBUG_PRINTLN(F(""));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -224,9 +224,9 @@ bool PinManagerClass::isPinAllocated(byte gpio, PinOwner tag)
|
|||||||
* Strapping pins: GPIO0, GPIO3, GPIO45 and GPIO46 are strapping pins. For more infomation, please refer to ESP32-S3 datasheet.
|
* Strapping pins: GPIO0, GPIO3, GPIO45 and GPIO46 are strapping pins. For more infomation, please refer to ESP32-S3 datasheet.
|
||||||
* Serial TX = GPIO43, RX = GPIO44; LED BUILTIN is usually GPIO39
|
* Serial TX = GPIO43, RX = GPIO44; LED BUILTIN is usually GPIO39
|
||||||
* USB-JTAG: GPIO 19 and 20 are used by USB-JTAG by default. In order to use them as GPIOs, USB-JTAG will be disabled by the drivers.
|
* USB-JTAG: GPIO 19 and 20 are used by USB-JTAG by default. In order to use them as GPIOs, USB-JTAG will be disabled by the drivers.
|
||||||
* SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses.
|
* SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses.
|
||||||
* When using Octal Flash or Octal PSRAM or both, GPIO33~37 are connected to SPIIO4 ~ SPIIO7 and SPIDQS. Therefore, on boards embedded with ESP32-S3R8 / ESP32-S3R8V chip, GPIO33~37 are also not recommended for other uses.
|
* When using Octal Flash or Octal PSRAM or both, GPIO33~37 are connected to SPIIO4 ~ SPIIO7 and SPIDQS. Therefore, on boards embedded with ESP32-S3R8 / ESP32-S3R8V chip, GPIO33~37 are also not recommended for other uses.
|
||||||
*
|
*
|
||||||
* see https://docs.espressif.com/projects/esp-idf/en/v4.4.2/esp32s3/api-reference/peripherals/adc.html
|
* see https://docs.espressif.com/projects/esp-idf/en/v4.4.2/esp32s3/api-reference/peripherals/adc.html
|
||||||
* https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/adc_oneshot.html
|
* https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/adc_oneshot.html
|
||||||
* ADC1: GPIO1 - GPIO10 (channel 0..9)
|
* ADC1: GPIO1 - GPIO10 (channel 0..9)
|
||||||
|
@ -15,7 +15,7 @@ typedef struct PinManagerPinType {
|
|||||||
* Allows PinManager to "lock" an allocation to a specific
|
* Allows PinManager to "lock" an allocation to a specific
|
||||||
* owner, so someone else doesn't accidentally de-allocate
|
* owner, so someone else doesn't accidentally de-allocate
|
||||||
* a pin it hasn't allocated. Also enhances debugging.
|
* a pin it hasn't allocated. Also enhances debugging.
|
||||||
*
|
*
|
||||||
* RAM Cost:
|
* RAM Cost:
|
||||||
* 17 bytes on ESP8266
|
* 17 bytes on ESP8266
|
||||||
* 40 bytes on ESP32
|
* 40 bytes on ESP32
|
||||||
@ -51,7 +51,7 @@ enum struct PinOwner : uint8_t {
|
|||||||
UM_MultiRelay = USERMOD_ID_MULTI_RELAY, // 0x0D // Usermod "usermod_multi_relay.h"
|
UM_MultiRelay = USERMOD_ID_MULTI_RELAY, // 0x0D // Usermod "usermod_multi_relay.h"
|
||||||
UM_AnimatedStaircase = USERMOD_ID_ANIMATED_STAIRCASE, // 0x0E // Usermod "Animated_Staircase.h"
|
UM_AnimatedStaircase = USERMOD_ID_ANIMATED_STAIRCASE, // 0x0E // Usermod "Animated_Staircase.h"
|
||||||
UM_Battery = USERMOD_ID_BATTERY, //
|
UM_Battery = USERMOD_ID_BATTERY, //
|
||||||
// #define USERMOD_ID_RTC // 0x0F // Usermod "usermod_rtc.h" -- Uses "standard" HW_I2C pins
|
// #define USERMOD_ID_RTC // 0x0F // Usermod "usermod_rtc.h" -- Uses "standard" HW_I2C pins
|
||||||
// #define USERMOD_ID_ELEKSTUBE_IPS // 0x10 // Usermod "usermod_elekstube_ips.h" -- Uses quite a few pins ... see Hardware.h and User_Setup.h
|
// #define USERMOD_ID_ELEKSTUBE_IPS // 0x10 // Usermod "usermod_elekstube_ips.h" -- Uses quite a few pins ... see Hardware.h and User_Setup.h
|
||||||
// #define USERMOD_ID_SN_PHOTORESISTOR // 0x11 // Usermod "usermod_sn_photoresistor.h" -- Uses hard-coded pin (PHOTORESISTOR_PIN == A0), but could be easily updated to use pinManager
|
// #define USERMOD_ID_SN_PHOTORESISTOR // 0x11 // Usermod "usermod_sn_photoresistor.h" -- Uses hard-coded pin (PHOTORESISTOR_PIN == A0), but could be easily updated to use pinManager
|
||||||
UM_BH1750 = USERMOD_ID_BH1750, // 0x14 // Usermod "usermod_bme280.h -- Uses "standard" HW_I2C pins
|
UM_BH1750 = USERMOD_ID_BH1750, // 0x14 // Usermod "usermod_bme280.h -- Uses "standard" HW_I2C pins
|
||||||
@ -92,7 +92,7 @@ class PinManagerClass {
|
|||||||
// De-allocation requires the same owner tag (or override)
|
// De-allocation requires the same owner tag (or override)
|
||||||
bool allocatePin(byte gpio, bool output, PinOwner tag);
|
bool allocatePin(byte gpio, bool output, PinOwner tag);
|
||||||
// Allocates all the pins, or allocates none of the pins, with owner tag.
|
// Allocates all the pins, or allocates none of the pins, with owner tag.
|
||||||
// Provided to simplify error condition handling in clients
|
// Provided to simplify error condition handling in clients
|
||||||
// using more than one pin, such as I2C, SPI, rotary encoders,
|
// using more than one pin, such as I2C, SPI, rotary encoders,
|
||||||
// ethernet, etc..
|
// ethernet, etc..
|
||||||
bool allocateMultiplePins(const managed_pin_type * mptArray, byte arrayElementCount, PinOwner tag );
|
bool allocateMultiplePins(const managed_pin_type * mptArray, byte arrayElementCount, PinOwner tag );
|
||||||
|
@ -55,7 +55,7 @@ void unloadPlaylist() {
|
|||||||
|
|
||||||
int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
|
int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
|
||||||
unloadPlaylist();
|
unloadPlaylist();
|
||||||
|
|
||||||
JsonArray presets = playlistObj["ps"];
|
JsonArray presets = playlistObj["ps"];
|
||||||
playlistLen = presets.size();
|
playlistLen = presets.size();
|
||||||
if (playlistLen == 0) return -1;
|
if (playlistLen == 0) return -1;
|
||||||
|
@ -79,12 +79,12 @@ static void doSaveState() {
|
|||||||
playlistSave = false;
|
playlistSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getPresetName(byte index, String& name)
|
bool getPresetName(byte index, String& name)
|
||||||
{
|
{
|
||||||
if (!requestJSONBufferLock(9)) return false;
|
if (!requestJSONBufferLock(9)) return false;
|
||||||
bool presetExists = false;
|
bool presetExists = false;
|
||||||
if (readObjectFromFileUsingId(getFileName(), index, &doc))
|
if (readObjectFromFileUsingId(getFileName(), index, &doc))
|
||||||
{
|
{
|
||||||
JsonObject fdo = doc.as<JsonObject>();
|
JsonObject fdo = doc.as<JsonObject>();
|
||||||
if (fdo["n"]) {
|
if (fdo["n"]) {
|
||||||
name = (const char*)(fdo["n"]);
|
name = (const char*)(fdo["n"]);
|
||||||
|
@ -171,14 +171,14 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
buttonType[i] = request->arg(be).toInt();
|
buttonType[i] = request->arg(be).toInt();
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
// ESP32 only: check that analog button pin is a valid ADC gpio
|
// ESP32 only: check that analog button pin is a valid ADC gpio
|
||||||
if (((buttonType[i] == BTN_TYPE_ANALOG) || (buttonType[i] == BTN_TYPE_ANALOG_INVERTED)) && (digitalPinToAnalogChannel(btnPin[i]) < 0))
|
if (((buttonType[i] == BTN_TYPE_ANALOG) || (buttonType[i] == BTN_TYPE_ANALOG_INVERTED)) && (digitalPinToAnalogChannel(btnPin[i]) < 0))
|
||||||
{
|
{
|
||||||
// not an ADC analog pin
|
// not an ADC analog pin
|
||||||
if (btnPin[i] >= 0) DEBUG_PRINTF("PIN ALLOC error: GPIO%d for analog button #%d is not an analog pin!\n", btnPin[i], i);
|
if (btnPin[i] >= 0) DEBUG_PRINTF("PIN ALLOC error: GPIO%d for analog button #%d is not an analog pin!\n", btnPin[i], i);
|
||||||
btnPin[i] = -1;
|
btnPin[i] = -1;
|
||||||
pinManager.deallocatePin(hw_btn_pin,PinOwner::Button);
|
pinManager.deallocatePin(hw_btn_pin,PinOwner::Button);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (disablePullUp) {
|
if (disablePullUp) {
|
||||||
@ -200,7 +200,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
|
|
||||||
strip.ablMilliampsMax = request->arg(F("MA")).toInt();
|
strip.ablMilliampsMax = request->arg(F("MA")).toInt();
|
||||||
strip.milliampsPerLed = request->arg(F("LA")).toInt();
|
strip.milliampsPerLed = request->arg(F("LA")).toInt();
|
||||||
|
|
||||||
briS = request->arg(F("CA")).toInt();
|
briS = request->arg(F("CA")).toInt();
|
||||||
|
|
||||||
turnOnAtBoot = request->hasArg(F("BO"));
|
turnOnAtBoot = request->hasArg(F("BO"));
|
||||||
@ -362,7 +362,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
longitude = request->arg(F("LN")).toFloat();
|
longitude = request->arg(F("LN")).toFloat();
|
||||||
latitude = request->arg(F("LT")).toFloat();
|
latitude = request->arg(F("LT")).toFloat();
|
||||||
// force a sunrise/sunset re-calculation
|
// force a sunrise/sunset re-calculation
|
||||||
calculateSunriseAndSunset();
|
calculateSunriseAndSunset();
|
||||||
|
|
||||||
overlayCurrent = request->hasArg(F("OL")) ? 1 : 0;
|
overlayCurrent = request->hasArg(F("OL")) ? 1 : 0;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ void notify(byte callMode, bool followUp)
|
|||||||
udpOut[8] = mainseg.mode;
|
udpOut[8] = mainseg.mode;
|
||||||
udpOut[9] = mainseg.speed;
|
udpOut[9] = mainseg.speed;
|
||||||
udpOut[10] = W(col);
|
udpOut[10] = W(col);
|
||||||
//compatibilityVersionByte:
|
//compatibilityVersionByte:
|
||||||
//0: old 1: supports white 2: supports secondary color
|
//0: old 1: supports white 2: supports secondary color
|
||||||
//3: supports FX intensity, 24 byte packet 4: supports transitionDelay 5: sup palette
|
//3: supports FX intensity, 24 byte packet 4: supports transitionDelay 5: sup palette
|
||||||
//6: supports timebase syncing, 29 byte packet 7: supports tertiary color 8: supports sys time sync, 36 byte packet
|
//6: supports timebase syncing, 29 byte packet 7: supports tertiary color 8: supports sys time sync, 36 byte packet
|
||||||
@ -62,7 +62,7 @@ void notify(byte callMode, bool followUp)
|
|||||||
udpOut[21] = G(col);
|
udpOut[21] = G(col);
|
||||||
udpOut[22] = B(col);
|
udpOut[22] = B(col);
|
||||||
udpOut[23] = W(col);
|
udpOut[23] = W(col);
|
||||||
|
|
||||||
udpOut[24] = followUp;
|
udpOut[24] = followUp;
|
||||||
uint32_t t = millis() + strip.timebase;
|
uint32_t t = millis() + strip.timebase;
|
||||||
udpOut[25] = (t >> 24) & 0xFF;
|
udpOut[25] = (t >> 24) & 0xFF;
|
||||||
@ -219,7 +219,7 @@ void handleNotifications()
|
|||||||
if(udpConnected && (notificationCount < udpNumRetries) && ((millis()-notificationSentTime) > 250)){
|
if(udpConnected && (notificationCount < udpNumRetries) && ((millis()-notificationSentTime) > 250)){
|
||||||
notify(notificationSentCallMode,true);
|
notify(notificationSentCallMode,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e131NewData && millis() - strip.getLastShow() > 15)
|
if (e131NewData && millis() - strip.getLastShow() > 15)
|
||||||
{
|
{
|
||||||
e131NewData = false;
|
e131NewData = false;
|
||||||
@ -231,7 +231,7 @@ void handleNotifications()
|
|||||||
|
|
||||||
//receive UDP notifications
|
//receive UDP notifications
|
||||||
if (!udpConnected) return;
|
if (!udpConnected) return;
|
||||||
|
|
||||||
bool isSupp = false;
|
bool isSupp = false;
|
||||||
size_t packetSize = notifierUdp.parsePacket();
|
size_t packetSize = notifierUdp.parsePacket();
|
||||||
if (!packetSize && udp2Connected) {
|
if (!packetSize && udp2Connected) {
|
||||||
@ -260,11 +260,11 @@ void handleNotifications()
|
|||||||
}
|
}
|
||||||
if (!(realtimeMode && useMainSegmentOnly)) strip.show();
|
if (!(realtimeMode && useMainSegmentOnly)) strip.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(receiveNotifications || receiveDirect)) return;
|
if (!(receiveNotifications || receiveDirect)) return;
|
||||||
|
|
||||||
localIP = Network.localIP();
|
localIP = Network.localIP();
|
||||||
//notifier and UDP realtime
|
//notifier and UDP realtime
|
||||||
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
||||||
@ -313,7 +313,7 @@ void handleNotifications()
|
|||||||
if (millis() - notificationSentTime < 1000) return;
|
if (millis() - notificationSentTime < 1000) return;
|
||||||
if (udpIn[1] > 199) return; //do not receive custom versions
|
if (udpIn[1] > 199) return; //do not receive custom versions
|
||||||
|
|
||||||
//compatibilityVersionByte:
|
//compatibilityVersionByte:
|
||||||
byte version = udpIn[11];
|
byte version = udpIn[11];
|
||||||
|
|
||||||
// if we are not part of any sync group ignore message
|
// if we are not part of any sync group ignore message
|
||||||
@ -321,7 +321,7 @@ void handleNotifications()
|
|||||||
// legacy senders are treated as if sending in sync group 1 only
|
// legacy senders are treated as if sending in sync group 1 only
|
||||||
if (!(receiveGroups & 0x01)) return;
|
if (!(receiveGroups & 0x01)) return;
|
||||||
} else if (!(receiveGroups & udpIn[36])) return;
|
} else if (!(receiveGroups & udpIn[36])) return;
|
||||||
|
|
||||||
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||||
|
|
||||||
//apply colors from notification to main segment, only if not syncing full segments
|
//apply colors from notification to main segment, only if not syncing full segments
|
||||||
@ -336,7 +336,7 @@ void handleNotifications()
|
|||||||
if (version > 9 && version < 200 && udpIn[37] < 255) { // valid CCT/Kelvin value
|
if (version > 9 && version < 200 && udpIn[37] < 255) { // valid CCT/Kelvin value
|
||||||
uint16_t cct = udpIn[38];
|
uint16_t cct = udpIn[38];
|
||||||
if (udpIn[37] > 0) { //Kelvin
|
if (udpIn[37] > 0) { //Kelvin
|
||||||
cct |= (udpIn[37] << 8);
|
cct |= (udpIn[37] << 8);
|
||||||
}
|
}
|
||||||
strip.setCCT(cct);
|
strip.setCCT(cct);
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ void handleNotifications()
|
|||||||
}
|
}
|
||||||
stateChanged = true;
|
stateChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// simple effect sync, applies to all selected segments
|
// simple effect sync, applies to all selected segments
|
||||||
if (applyEffects && (version < 11 || !receiveSegmentOptions)) {
|
if (applyEffects && (version < 11 || !receiveSegmentOptions)) {
|
||||||
for (size_t i = 0; i < strip.getSegmentsNum(); i++) {
|
for (size_t i = 0; i < strip.getSegmentsNum(); i++) {
|
||||||
@ -450,7 +450,7 @@ void handleNotifications()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version > 3)
|
if (version > 3)
|
||||||
{
|
{
|
||||||
transitionDelayTemp = ((udpIn[17] << 0) & 0xFF) + ((udpIn[18] << 8) & 0xFF00);
|
transitionDelayTemp = ((udpIn[17] << 0) & 0xFF) + ((udpIn[18] << 8) & 0xFF00);
|
||||||
@ -458,14 +458,14 @@ void handleNotifications()
|
|||||||
|
|
||||||
nightlightActive = udpIn[6];
|
nightlightActive = udpIn[6];
|
||||||
if (nightlightActive) nightlightDelayMins = udpIn[7];
|
if (nightlightActive) nightlightDelayMins = udpIn[7];
|
||||||
|
|
||||||
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
||||||
stateUpdated(CALL_MODE_NOTIFICATION);
|
stateUpdated(CALL_MODE_NOTIFICATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!receiveDirect) return;
|
if (!receiveDirect) return;
|
||||||
|
|
||||||
//TPM2.NET
|
//TPM2.NET
|
||||||
if (udpIn[0] == 0x9c)
|
if (udpIn[0] == 0x9c)
|
||||||
{
|
{
|
||||||
@ -543,7 +543,7 @@ void handleNotifications()
|
|||||||
for (size_t i = 2; i < packetSize -3; i += 4)
|
for (size_t i = 2; i < packetSize -3; i += 4)
|
||||||
{
|
{
|
||||||
setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], udpIn[i+3]);
|
setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], udpIn[i+3]);
|
||||||
|
|
||||||
id++; if (id >= totalLen) break;
|
id++; if (id >= totalLen) break;
|
||||||
}
|
}
|
||||||
} else if (udpIn[0] == 4) //dnrgb
|
} else if (udpIn[0] == 4) //dnrgb
|
||||||
@ -652,7 +652,7 @@ void sendSysInfoUDP()
|
|||||||
uint8_t data[44] = {0};
|
uint8_t data[44] = {0};
|
||||||
data[0] = 255;
|
data[0] = 255;
|
||||||
data[1] = 1;
|
data[1] = 1;
|
||||||
|
|
||||||
for (size_t x = 0; x < 4; x++) {
|
for (size_t x = 0; x < 4; x++) {
|
||||||
data[x + 2] = ip[x];
|
data[x + 2] = ip[x];
|
||||||
}
|
}
|
||||||
@ -717,7 +717,7 @@ void sendSysInfoUDP()
|
|||||||
uint8_t sequenceNumber = 0; // this needs to be shared across all outputs
|
uint8_t sequenceNumber = 0; // this needs to be shared across all outputs
|
||||||
|
|
||||||
uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8_t *buffer, uint8_t bri, bool isRGBW) {
|
uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8_t *buffer, uint8_t bri, bool isRGBW) {
|
||||||
if (!(apActive || interfacesInited) || !client[0] || !length) return 1; // network not initialised or dummy/unset IP address 031522 ajn added check for ap
|
if (!(apActive || interfacesInited) || !client[0] || !length) return 1; // network not initialised or dummy/unset IP address 031522 ajn added check for ap
|
||||||
|
|
||||||
WiFiUDP ddpUdp;
|
WiFiUDP ddpUdp;
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
|
|||||||
|
|
||||||
// there are 3 channels per RGB pixel
|
// there are 3 channels per RGB pixel
|
||||||
uint32_t channel = 0; // TODO: allow specifying the start channel
|
uint32_t channel = 0; // TODO: allow specifying the start channel
|
||||||
// the current position in the buffer
|
// the current position in the buffer
|
||||||
size_t bufferOffset = 0;
|
size_t bufferOffset = 0;
|
||||||
|
|
||||||
for (size_t currentPacket = 0; currentPacket < packetCount; currentPacket++) {
|
for (size_t currentPacket = 0; currentPacket < packetCount; currentPacket++) {
|
||||||
@ -768,7 +768,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
|
|||||||
/*8*/ddpUdp.write(0xFF & (packetSize >> 8));
|
/*8*/ddpUdp.write(0xFF & (packetSize >> 8));
|
||||||
/*9*/ddpUdp.write(0xFF & (packetSize ));
|
/*9*/ddpUdp.write(0xFF & (packetSize ));
|
||||||
|
|
||||||
// write the colors, the write write(const uint8_t *buffer, size_t size)
|
// write the colors, the write write(const uint8_t *buffer, size_t size)
|
||||||
// function is just a loop internally too
|
// function is just a loop internally too
|
||||||
for (size_t i = 0; i < packetSize; i += 3) {
|
for (size_t i = 0; i < packetSize; i += 3) {
|
||||||
ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // R
|
ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // R
|
||||||
@ -777,7 +777,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
|
|||||||
if (isRGBW) ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // W
|
if (isRGBW) ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // W
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ddpUdp.endPacket()) {
|
if (!ddpUdp.endPacket()) {
|
||||||
DEBUG_PRINTLN(F("WiFiUDP.endPacket returned an error"));
|
DEBUG_PRINTLN(F("WiFiUDP.endPacket returned an error"));
|
||||||
return 1; // problem
|
return 1; // problem
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ void UsermodManager::connected() { for (byte i = 0; i < numMods; i++) um
|
|||||||
void UsermodManager::loop() { for (byte i = 0; i < numMods; i++) ums[i]->loop(); }
|
void UsermodManager::loop() { for (byte i = 0; i < numMods; i++) ums[i]->loop(); }
|
||||||
void UsermodManager::handleOverlayDraw() { for (byte i = 0; i < numMods; i++) ums[i]->handleOverlayDraw(); }
|
void UsermodManager::handleOverlayDraw() { for (byte i = 0; i < numMods; i++) ums[i]->handleOverlayDraw(); }
|
||||||
void UsermodManager::appendConfigData() { for (byte i = 0; i < numMods; i++) ums[i]->appendConfigData(); }
|
void UsermodManager::appendConfigData() { for (byte i = 0; i < numMods; i++) ums[i]->appendConfigData(); }
|
||||||
bool UsermodManager::handleButton(uint8_t b) {
|
bool UsermodManager::handleButton(uint8_t b) {
|
||||||
bool overrideIO = false;
|
bool overrideIO = false;
|
||||||
for (byte i = 0; i < numMods; i++) {
|
for (byte i = 0; i < numMods; i++) {
|
||||||
if (ums[i]->handleButton(b)) overrideIO = true;
|
if (ums[i]->handleButton(b)) overrideIO = true;
|
||||||
}
|
}
|
||||||
return overrideIO;
|
return overrideIO;
|
||||||
}
|
}
|
||||||
bool UsermodManager::getUMData(um_data_t **data, uint8_t mod_id) {
|
bool UsermodManager::getUMData(um_data_t **data, uint8_t mod_id) {
|
||||||
for (byte i = 0; i < numMods; i++) {
|
for (byte i = 0; i < numMods; i++) {
|
||||||
if (mod_id > 0 && ums[i]->getId() != mod_id) continue; // only get data form requested usermod if provided
|
if (mod_id > 0 && ums[i]->getId() != mod_id) continue; // only get data form requested usermod if provided
|
||||||
if (ums[i]->getUMData(data)) return true; // if usermod does provide data return immediately (only one usermod can povide data at one time)
|
if (ums[i]->getUMData(data)) return true; // if usermod does provide data return immediately (only one usermod can povide data at one time)
|
||||||
@ -27,7 +27,7 @@ void UsermodManager::addToJsonState(JsonObject& obj) { for (byte i = 0; i < n
|
|||||||
void UsermodManager::addToJsonInfo(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToJsonInfo(obj); }
|
void UsermodManager::addToJsonInfo(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToJsonInfo(obj); }
|
||||||
void UsermodManager::readFromJsonState(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromJsonState(obj); }
|
void UsermodManager::readFromJsonState(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromJsonState(obj); }
|
||||||
void UsermodManager::addToConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToConfig(obj); }
|
void UsermodManager::addToConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToConfig(obj); }
|
||||||
bool UsermodManager::readFromConfig(JsonObject& obj) {
|
bool UsermodManager::readFromConfig(JsonObject& obj) {
|
||||||
bool allComplete = true;
|
bool allComplete = true;
|
||||||
for (byte i = 0; i < numMods; i++) {
|
for (byte i = 0; i < numMods; i++) {
|
||||||
if (!ums[i]->readFromConfig(obj)) allComplete = false;
|
if (!ums[i]->readFromConfig(obj)) allComplete = false;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality
|
* 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 const.h)
|
* EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h)
|
||||||
* If you just need 8 bytes, use 2551-2559 (you do not need to increase EEPSIZE)
|
* If you just need 8 bytes, use 2551-2559 (you do not need to increase EEPSIZE)
|
||||||
*
|
*
|
||||||
* Consider the v2 usermod API if you need a more advanced feature set!
|
* Consider the v2 usermod API if you need a more advanced feature set!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
//gets called once at boot. Do all initialization that doesn't depend on network here
|
//gets called once at boot. Do all initialization that doesn't depend on network here
|
||||||
void userSetup()
|
void userSetup()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here
|
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here
|
||||||
@ -25,5 +25,5 @@ void userConnected()
|
|||||||
//loop. You can use "if (WLED_CONNECTED)" to check for successful connection
|
//loop. You can use "if (WLED_CONNECTED)" to check for successful connection
|
||||||
void userLoop()
|
void userLoop()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
class UsermodRenameMe : public Usermod {
|
class UsermodRenameMe : public Usermod {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -55,7 +55,7 @@
|
|||||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||||
#ifdef USE_ALT_DISPlAY
|
#ifdef USE_ALT_DISPlAY
|
||||||
#include "../usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h"
|
#include "../usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h"
|
||||||
#else
|
#else
|
||||||
#include "../usermods/usermod_v2_four_line_display/usermod_v2_four_line_display.h"
|
#include "../usermods/usermod_v2_four_line_display/usermod_v2_four_line_display.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -169,7 +169,7 @@
|
|||||||
// resolved correctly (when included in mod's header only)
|
// resolved correctly (when included in mod's header only)
|
||||||
#ifdef WLED_USE_SD_MMC
|
#ifdef WLED_USE_SD_MMC
|
||||||
#include "SD_MMC.h"
|
#include "SD_MMC.h"
|
||||||
#elif defined(WLED_USE_SD_SPI)
|
#elif defined(WLED_USE_SD_SPI)
|
||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
#endif
|
#endif
|
||||||
@ -196,119 +196,119 @@ void registerUsermods()
|
|||||||
#ifdef USERMOD_BATTERY
|
#ifdef USERMOD_BATTERY
|
||||||
usermods.add(new UsermodBattery());
|
usermods.add(new UsermodBattery());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_DALLASTEMPERATURE
|
#ifdef USERMOD_DALLASTEMPERATURE
|
||||||
usermods.add(new UsermodTemperature());
|
usermods.add(new UsermodTemperature());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_SN_PHOTORESISTOR
|
#ifdef USERMOD_SN_PHOTORESISTOR
|
||||||
usermods.add(new Usermod_SN_Photoresistor());
|
usermods.add(new Usermod_SN_Photoresistor());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_PWM_FAN
|
#ifdef USERMOD_PWM_FAN
|
||||||
usermods.add(new PWMFanUsermod());
|
usermods.add(new PWMFanUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_BUZZER
|
#ifdef USERMOD_BUZZER
|
||||||
usermods.add(new BuzzerUsermod());
|
usermods.add(new BuzzerUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_BH1750
|
#ifdef USERMOD_BH1750
|
||||||
usermods.add(new Usermod_BH1750());
|
usermods.add(new Usermod_BH1750());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_BME280
|
#ifdef USERMOD_BME280
|
||||||
usermods.add(new UsermodBME280());
|
usermods.add(new UsermodBME280());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_SENSORSTOMQTT
|
#ifdef USERMOD_SENSORSTOMQTT
|
||||||
usermods.add(new UserMod_SensorsToMQTT());
|
usermods.add(new UserMod_SensorsToMQTT());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_PIRSWITCH
|
#ifdef USERMOD_PIRSWITCH
|
||||||
usermods.add(new PIRsensorSwitch());
|
usermods.add(new PIRsensorSwitch());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_MODE_SORT
|
#ifdef USERMOD_MODE_SORT
|
||||||
usermods.add(new ModeSortUsermod());
|
usermods.add(new ModeSortUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||||
usermods.add(new FourLineDisplayUsermod());
|
usermods.add(new FourLineDisplayUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_ROTARY_ENCODER_UI
|
#ifdef USERMOD_ROTARY_ENCODER_UI
|
||||||
usermods.add(new RotaryEncoderUIUsermod()); // can use USERMOD_FOUR_LINE_DISPLAY
|
usermods.add(new RotaryEncoderUIUsermod()); // can use USERMOD_FOUR_LINE_DISPLAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_AUTO_SAVE
|
#ifdef USERMOD_AUTO_SAVE
|
||||||
usermods.add(new AutoSaveUsermod()); // can use USERMOD_FOUR_LINE_DISPLAY
|
usermods.add(new AutoSaveUsermod()); // can use USERMOD_FOUR_LINE_DISPLAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_DHT
|
#ifdef USERMOD_DHT
|
||||||
usermods.add(new UsermodDHT());
|
usermods.add(new UsermodDHT());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_VL53L0X_GESTURES
|
#ifdef USERMOD_VL53L0X_GESTURES
|
||||||
usermods.add(new UsermodVL53L0XGestures());
|
usermods.add(new UsermodVL53L0XGestures());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_ANIMATED_STAIRCASE
|
#ifdef USERMOD_ANIMATED_STAIRCASE
|
||||||
usermods.add(new Animated_Staircase());
|
usermods.add(new Animated_Staircase());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_MULTI_RELAY
|
#ifdef USERMOD_MULTI_RELAY
|
||||||
usermods.add(new MultiRelay());
|
usermods.add(new MultiRelay());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_RTC
|
#ifdef USERMOD_RTC
|
||||||
usermods.add(new RTCUsermod());
|
usermods.add(new RTCUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_ELEKSTUBE_IPS
|
#ifdef USERMOD_ELEKSTUBE_IPS
|
||||||
usermods.add(new ElekstubeIPSUsermod());
|
usermods.add(new ElekstubeIPSUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_ROTARY_ENCODER_BRIGHTNESS_COLOR
|
#ifdef USERMOD_ROTARY_ENCODER_BRIGHTNESS_COLOR
|
||||||
usermods.add(new RotaryEncoderBrightnessColor());
|
usermods.add(new RotaryEncoderBrightnessColor());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGB_ROTARY_ENCODER
|
#ifdef RGB_ROTARY_ENCODER
|
||||||
usermods.add(new RgbRotaryEncoderUsermod());
|
usermods.add(new RgbRotaryEncoderUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_ST7789_DISPLAY
|
#ifdef USERMOD_ST7789_DISPLAY
|
||||||
usermods.add(new St7789DisplayUsermod());
|
usermods.add(new St7789DisplayUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_SEVEN_SEGMENT
|
#ifdef USERMOD_SEVEN_SEGMENT
|
||||||
usermods.add(new SevenSegmentDisplay());
|
usermods.add(new SevenSegmentDisplay());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_SSDR
|
#ifdef USERMOD_SSDR
|
||||||
usermods.add(new UsermodSSDR());
|
usermods.add(new UsermodSSDR());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_CRONIXIE
|
#ifdef USERMOD_CRONIXIE
|
||||||
usermods.add(new UsermodCronixie());
|
usermods.add(new UsermodCronixie());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QUINLED_AN_PENTA
|
#ifdef QUINLED_AN_PENTA
|
||||||
usermods.add(new QuinLEDAnPentaUsermod());
|
usermods.add(new QuinLEDAnPentaUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_WIZLIGHTS
|
#ifdef USERMOD_WIZLIGHTS
|
||||||
usermods.add(new WizLightsUsermod());
|
usermods.add(new WizLightsUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_WORDCLOCK
|
#ifdef USERMOD_WORDCLOCK
|
||||||
usermods.add(new WordClockUsermod());
|
usermods.add(new WordClockUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_MY9291
|
#ifdef USERMOD_MY9291
|
||||||
usermods.add(new MY9291Usermod());
|
usermods.add(new MY9291Usermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_SI7021_MQTT_HA
|
#ifdef USERMOD_SI7021_MQTT_HA
|
||||||
usermods.add(new Si7021_MQTT_HA());
|
usermods.add(new Si7021_MQTT_HA());
|
||||||
#endif
|
#endif
|
||||||
@ -316,7 +316,7 @@ void registerUsermods()
|
|||||||
#ifdef USERMOD_SMARTNEST
|
#ifdef USERMOD_SMARTNEST
|
||||||
usermods.add(new Smartnest());
|
usermods.add(new Smartnest());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_AUDIOREACTIVE
|
#ifdef USERMOD_AUDIOREACTIVE
|
||||||
usermods.add(new AudioReactive());
|
usermods.add(new AudioReactive());
|
||||||
#endif
|
#endif
|
||||||
@ -324,15 +324,15 @@ void registerUsermods()
|
|||||||
#ifdef USERMOD_ANALOG_CLOCK
|
#ifdef USERMOD_ANALOG_CLOCK
|
||||||
usermods.add(new AnalogClockUsermod());
|
usermods.add(new AnalogClockUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_PING_PONG_CLOCK
|
#ifdef USERMOD_PING_PONG_CLOCK
|
||||||
usermods.add(new PingPongClockUsermod());
|
usermods.add(new PingPongClockUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_ADS1115
|
#ifdef USERMOD_ADS1115
|
||||||
usermods.add(new ADS1115Usermod());
|
usermods.add(new ADS1115Usermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_BOBLIGHT
|
#ifdef USERMOD_BOBLIGHT
|
||||||
usermods.add(new BobLightUsermod());
|
usermods.add(new BobLightUsermod());
|
||||||
#endif
|
#endif
|
||||||
@ -340,7 +340,7 @@ void registerUsermods()
|
|||||||
#ifdef SD_ADAPTER
|
#ifdef SD_ADAPTER
|
||||||
usermods.add(new UsermodSdCard());
|
usermods.add(new UsermodSdCard());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USERMOD_PWM_OUTPUTS
|
#ifdef USERMOD_PWM_OUTPUTS
|
||||||
usermods.add(new PwmOutputsUsermod());
|
usermods.add(new PwmOutputsUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ void parseNumber(const char* str, byte* val, byte minv, byte maxv)
|
|||||||
} else {
|
} else {
|
||||||
if (wrap && *val == maxv && out > 0) out = minv;
|
if (wrap && *val == maxv && out > 0) out = minv;
|
||||||
else if (wrap && *val == minv && out < 0) out = maxv;
|
else if (wrap && *val == minv && out < 0) out = maxv;
|
||||||
else {
|
else {
|
||||||
out += *val;
|
out += *val;
|
||||||
if (out > maxv) out = maxv;
|
if (out > maxv) out = maxv;
|
||||||
if (out < minv) out = minv;
|
if (out < minv) out = minv;
|
||||||
@ -335,7 +335,7 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
|
|||||||
}
|
}
|
||||||
// we have slider name (including default value) in the dest buffer
|
// we have slider name (including default value) in the dest buffer
|
||||||
for (size_t i=0; i<strlen(dest); i++) if (dest[i]=='=') { dest[i]='\0'; break; } // truncate default value
|
for (size_t i=0; i<strlen(dest); i++) if (dest[i]=='=') { dest[i]='\0'; break; } // truncate default value
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// defaults to just speed and intensity since there is no slider data
|
// defaults to just speed and intensity since there is no slider data
|
||||||
switch (slider) {
|
switch (slider) {
|
||||||
@ -397,7 +397,7 @@ typedef enum UM_SoundSimulations {
|
|||||||
UMS_14_3
|
UMS_14_3
|
||||||
} um_soundSimulations_t;
|
} um_soundSimulations_t;
|
||||||
|
|
||||||
um_data_t* simulateSound(uint8_t simulationId)
|
um_data_t* simulateSound(uint8_t simulationId)
|
||||||
{
|
{
|
||||||
static uint8_t samplePeak;
|
static uint8_t samplePeak;
|
||||||
static float FFT_MajorPeak;
|
static float FFT_MajorPeak;
|
||||||
@ -426,7 +426,7 @@ um_data_t* simulateSound(uint8_t simulationId)
|
|||||||
um_data->u_data = new void*[um_data->u_size];
|
um_data->u_data = new void*[um_data->u_size];
|
||||||
um_data->u_data[0] = &volumeSmth;
|
um_data->u_data[0] = &volumeSmth;
|
||||||
um_data->u_data[1] = &volumeRaw;
|
um_data->u_data[1] = &volumeRaw;
|
||||||
um_data->u_data[2] = fftResult;
|
um_data->u_data[2] = fftResult;
|
||||||
um_data->u_data[3] = &samplePeak;
|
um_data->u_data[3] = &samplePeak;
|
||||||
um_data->u_data[4] = &FFT_MajorPeak;
|
um_data->u_data[4] = &FFT_MajorPeak;
|
||||||
um_data->u_data[5] = &my_magnitude;
|
um_data->u_data[5] = &my_magnitude;
|
||||||
|
@ -150,7 +150,7 @@ void WLED::loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//LED settings have been saved, re-init busses
|
//LED settings have been saved, re-init busses
|
||||||
//This code block causes severe FPS drop on ESP32 with the original "if (busConfigs[0] != nullptr)" conditional. Investigate!
|
//This code block causes severe FPS drop on ESP32 with the original "if (busConfigs[0] != nullptr)" conditional. Investigate!
|
||||||
if (doInitBusses) {
|
if (doInitBusses) {
|
||||||
doInitBusses = false;
|
doInitBusses = false;
|
||||||
DEBUG_PRINTLN(F("Re-init busses."));
|
DEBUG_PRINTLN(F("Re-init busses."));
|
||||||
@ -364,7 +364,7 @@ void WLED::setup()
|
|||||||
if (!fsinit) {
|
if (!fsinit) {
|
||||||
DEBUGFS_PRINTLN(F("FS failed!"));
|
DEBUGFS_PRINTLN(F("FS failed!"));
|
||||||
errorFlag = ERR_FS_BEGIN;
|
errorFlag = ERR_FS_BEGIN;
|
||||||
}
|
}
|
||||||
#ifdef WLED_ADD_EEPROM_SUPPORT
|
#ifdef WLED_ADD_EEPROM_SUPPORT
|
||||||
else deEEP();
|
else deEEP();
|
||||||
#else
|
#else
|
||||||
@ -579,10 +579,10 @@ bool WLED::initEthernet()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ETH.begin(
|
if (!ETH.begin(
|
||||||
(uint8_t) es.eth_address,
|
(uint8_t) es.eth_address,
|
||||||
(int) es.eth_power,
|
(int) es.eth_power,
|
||||||
(int) es.eth_mdc,
|
(int) es.eth_mdc,
|
||||||
(int) es.eth_mdio,
|
(int) es.eth_mdio,
|
||||||
(eth_phy_type_t) es.eth_type,
|
(eth_phy_type_t) es.eth_type,
|
||||||
(eth_clock_mode_t) es.eth_clk_mode
|
(eth_clock_mode_t) es.eth_clk_mode
|
||||||
)) {
|
)) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
/*
|
/*
|
||||||
* DEPRECATED, do not use for new settings
|
* DEPRECATED, do not use for new settings
|
||||||
* Only used to restore config from pre-0.11 installations using the deEEP() methods
|
* Only used to restore config from pre-0.11 installations using the deEEP() methods
|
||||||
*
|
*
|
||||||
* Methods to handle saving and loading to non-volatile memory
|
* Methods to handle saving and loading to non-volatile memory
|
||||||
* EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map
|
* EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map
|
||||||
*/
|
*/
|
||||||
@ -154,9 +154,9 @@ void loadSettingsFromEEPROM()
|
|||||||
turnOnAtBoot = EEPROM.read(369);
|
turnOnAtBoot = EEPROM.read(369);
|
||||||
//strip.isRgbw = EEPROM.read(372);
|
//strip.isRgbw = EEPROM.read(372);
|
||||||
//374 - strip.paletteFade
|
//374 - strip.paletteFade
|
||||||
|
|
||||||
apBehavior = EEPROM.read(376);
|
apBehavior = EEPROM.read(376);
|
||||||
|
|
||||||
//377 = lastEEPROMversion
|
//377 = lastEEPROMversion
|
||||||
if (lastEEPROMversion > 3) {
|
if (lastEEPROMversion > 3) {
|
||||||
aOtaEnabled = EEPROM.read(390);
|
aOtaEnabled = EEPROM.read(390);
|
||||||
@ -164,7 +164,7 @@ void loadSettingsFromEEPROM()
|
|||||||
receiveNotificationEffects = EEPROM.read(392);
|
receiveNotificationEffects = EEPROM.read(392);
|
||||||
}
|
}
|
||||||
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||||
|
|
||||||
if (lastEEPROMversion > 4) {
|
if (lastEEPROMversion > 4) {
|
||||||
#ifndef WLED_DISABLE_HUESYNC
|
#ifndef WLED_DISABLE_HUESYNC
|
||||||
huePollingEnabled = EEPROM.read(2048);
|
huePollingEnabled = EEPROM.read(2048);
|
||||||
@ -232,7 +232,7 @@ void loadSettingsFromEEPROM()
|
|||||||
timerMacro[i] = EEPROM.read(2290 + i);
|
timerMacro[i] = EEPROM.read(2290 + i);
|
||||||
if (timerMacro[i] > 0) timerMacro[i] += 16; //add 16 to work with macro --> preset mapping
|
if (timerMacro[i] > 0) timerMacro[i] += 16; //add 16 to work with macro --> preset mapping
|
||||||
if (timerWeekday[i] == 0) timerWeekday[i] = 255;
|
if (timerWeekday[i] == 0) timerWeekday[i] = 255;
|
||||||
if (timerMacro[i] == 0) timerWeekday[i] = timerWeekday[i] & 0b11111110;
|
if (timerMacro[i] == 0) timerWeekday[i] = timerWeekday[i] & 0b11111110;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,8 +319,8 @@ void loadSettingsFromEEPROM()
|
|||||||
|
|
||||||
if (lastEEPROMversion > 21) {
|
if (lastEEPROMversion > 21) {
|
||||||
udpPort2 = EEPROM.read(378) + ((EEPROM.read(379) << 8) & 0xFF00);
|
udpPort2 = EEPROM.read(378) + ((EEPROM.read(379) << 8) & 0xFF00);
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveDirect = !EEPROM.read(2200);
|
receiveDirect = !EEPROM.read(2200);
|
||||||
notifyMacro = EEPROM.read(2201);
|
notifyMacro = EEPROM.read(2201);
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ void loadSettingsFromEEPROM()
|
|||||||
DMXChannels = EEPROM.read(2530);
|
DMXChannels = EEPROM.read(2530);
|
||||||
DMXGap = EEPROM.read(2531) + ((EEPROM.read(2532) << 8) & 0xFF00);
|
DMXGap = EEPROM.read(2531) + ((EEPROM.read(2532) << 8) & 0xFF00);
|
||||||
DMXStart = EEPROM.read(2533) + ((EEPROM.read(2534) << 8) & 0xFF00);
|
DMXStart = EEPROM.read(2533) + ((EEPROM.read(2534) << 8) & 0xFF00);
|
||||||
|
|
||||||
for (int i=0;i<15;i++) {
|
for (int i=0;i<15;i++) {
|
||||||
DMXFixtureMap[i] = EEPROM.read(2535+i);
|
DMXFixtureMap[i] = EEPROM.read(2535+i);
|
||||||
} //last used: 2549
|
} //last used: 2549
|
||||||
@ -372,7 +372,7 @@ void applyMacro(byte index) {
|
|||||||
// De-EEPROM routine, upgrade from previous versions to v0.11
|
// De-EEPROM routine, upgrade from previous versions to v0.11
|
||||||
void deEEP() {
|
void deEEP() {
|
||||||
if (WLED_FS.exists("/presets.json")) return;
|
if (WLED_FS.exists("/presets.json")) return;
|
||||||
|
|
||||||
DEBUG_PRINTLN(F("Preset file not found, attempting to load from EEPROM"));
|
DEBUG_PRINTLN(F("Preset file not found, attempting to load from EEPROM"));
|
||||||
DEBUGFS_PRINTLN(F("Allocating saving buffer for dEEP"));
|
DEBUGFS_PRINTLN(F("Allocating saving buffer for dEEP"));
|
||||||
if (!requestJSONBufferLock(8)) return;
|
if (!requestJSONBufferLock(8)) return;
|
||||||
@ -413,7 +413,7 @@ void deEEP() {
|
|||||||
|
|
||||||
for (byte j = 0; j < numChannels; j++) colX.add(EEPROM.read(memloc + j));
|
for (byte j = 0; j < numChannels; j++) colX.add(EEPROM.read(memloc + j));
|
||||||
}
|
}
|
||||||
|
|
||||||
segObj["fx"] = EEPROM.read(i+10);
|
segObj["fx"] = EEPROM.read(i+10);
|
||||||
segObj["sx"] = EEPROM.read(i+11);
|
segObj["sx"] = EEPROM.read(i+11);
|
||||||
segObj["ix"] = EEPROM.read(i+16);
|
segObj["ix"] = EEPROM.read(i+16);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Contains some trigonometric functions.
|
* Contains some trigonometric functions.
|
||||||
* The ANSI C equivalents are likely faster, but using any sin/cos/tan function incurs a memory penalty of 460 bytes on ESP8266, likely for lookup tables.
|
* The ANSI C equivalents are likely faster, but using any sin/cos/tan function incurs a memory penalty of 460 bytes on ESP8266, likely for lookup tables.
|
||||||
* This implementation has no extra static memory usage.
|
* This implementation has no extra static memory usage.
|
||||||
*
|
*
|
||||||
* Source of the cos_t() function: https://web.eecs.utk.edu/~azh/blog/cosine.html (cos_taylor_literal_6terms)
|
* Source of the cos_t() function: https://web.eecs.utk.edu/~azh/blog/cosine.html (cos_taylor_literal_6terms)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void sendJSON(){
|
|||||||
if (i != used-1) Serial.write(',');
|
if (i != used-1) Serial.write(',');
|
||||||
}
|
}
|
||||||
Serial.println("]");
|
Serial.println("]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RGB LED data returned as bytes in TPM2 format. Faster, and slightly less easy to use on the other end.
|
// RGB LED data returned as bytes in TPM2 format. Faster, and slightly less easy to use on the other end.
|
||||||
@ -64,13 +64,13 @@ void sendBytes(){
|
|||||||
Serial.write(qadd8(W(c), B(c))); //B
|
Serial.write(qadd8(W(c), B(c))); //B
|
||||||
}
|
}
|
||||||
Serial.write(0x36); Serial.write('\n');
|
Serial.write(0x36); Serial.write('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleSerial()
|
void handleSerial()
|
||||||
{
|
{
|
||||||
if (pinManager.isPinAllocated(hardwareRX)) return;
|
if (pinManager.isPinAllocated(hardwareRX)) return;
|
||||||
|
|
||||||
#ifdef WLED_ENABLE_ADALIGHT
|
#ifdef WLED_ENABLE_ADALIGHT
|
||||||
static auto state = AdaState::Header_A;
|
static auto state = AdaState::Header_A;
|
||||||
static uint16_t count = 0;
|
static uint16_t count = 0;
|
||||||
@ -94,7 +94,7 @@ void handleSerial()
|
|||||||
return;
|
return;
|
||||||
} else if (next == 'v') {
|
} else if (next == 'v') {
|
||||||
Serial.print("WLED"); Serial.write(' '); Serial.println(VERSION);
|
Serial.print("WLED"); Serial.write(' '); Serial.println(VERSION);
|
||||||
|
|
||||||
} else if (next == 0xB0) {updateBaudRate( 115200);
|
} else if (next == 0xB0) {updateBaudRate( 115200);
|
||||||
} else if (next == 0xB1) {updateBaudRate( 230400);
|
} else if (next == 0xB1) {updateBaudRate( 230400);
|
||||||
} else if (next == 0xB2) {updateBaudRate( 460800);
|
} else if (next == 0xB2) {updateBaudRate( 460800);
|
||||||
@ -103,11 +103,11 @@ void handleSerial()
|
|||||||
} else if (next == 0xB5) {updateBaudRate( 921600);
|
} else if (next == 0xB5) {updateBaudRate( 921600);
|
||||||
} else if (next == 0xB6) {updateBaudRate(1000000);
|
} else if (next == 0xB6) {updateBaudRate(1000000);
|
||||||
} else if (next == 0xB7) {updateBaudRate(1500000);
|
} else if (next == 0xB7) {updateBaudRate(1500000);
|
||||||
|
|
||||||
} else if (next == 'l') {sendJSON(); // Send LED data as JSON Array
|
} else if (next == 'l') {sendJSON(); // Send LED data as JSON Array
|
||||||
} else if (next == 'L') {sendBytes(); // Send LED data as TPM2 Data Packet
|
} else if (next == 'L') {sendBytes(); // Send LED data as TPM2 Data Packet
|
||||||
|
|
||||||
} else if (next == 'o') {continuousSendLED = false; // Disable Continuous Serial Streaming
|
} else if (next == 'o') {continuousSendLED = false; // Disable Continuous Serial Streaming
|
||||||
} else if (next == 'O') {continuousSendLED = true; // Enable Continuous Serial Streaming
|
} else if (next == 'O') {continuousSendLED = true; // Enable Continuous Serial Streaming
|
||||||
|
|
||||||
} else if (next == '{') { //JSON API
|
} else if (next == '{') { //JSON API
|
||||||
@ -195,8 +195,8 @@ void handleSerial()
|
|||||||
// All other received bytes will disable Continuous Serial Streaming
|
// All other received bytes will disable Continuous Serial Streaming
|
||||||
if (continuousSendLED && next != 'O'){
|
if (continuousSendLED && next != 'O'){
|
||||||
continuousSendLED = false;
|
continuousSendLED = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.read(); //discard the byte
|
Serial.read(); //discard the byte
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,7 +88,7 @@ bool captivePortal(AsyncWebServerRequest *request)
|
|||||||
String hostH;
|
String hostH;
|
||||||
if (!request->hasHeader("Host")) return false;
|
if (!request->hasHeader("Host")) return false;
|
||||||
hostH = request->getHeader("Host")->value();
|
hostH = request->getHeader("Host")->value();
|
||||||
|
|
||||||
if (!isIp(hostH) && hostH.indexOf("wled.me") < 0 && hostH.indexOf(cmDNS) < 0) {
|
if (!isIp(hostH) && hostH.indexOf("wled.me") < 0 && hostH.indexOf(cmDNS) < 0) {
|
||||||
DEBUG_PRINTLN("Captive portal");
|
DEBUG_PRINTLN("Captive portal");
|
||||||
AsyncWebServerResponse *response = request->beginResponse(302);
|
AsyncWebServerResponse *response = request->beginResponse(302);
|
||||||
@ -135,14 +135,14 @@ void initServer()
|
|||||||
//request->send_P(200, "text/html", PAGE_liveview);
|
//request->send_P(200, "text/html", PAGE_liveview);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//settings page
|
//settings page
|
||||||
server.on("/settings", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/settings", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveSettings(request);
|
serveSettings(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
// "/settings/settings.js&p=x" request also handled by serveSettings()
|
// "/settings/settings.js&p=x" request also handled by serveSettings()
|
||||||
|
|
||||||
server.on("/style.css", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/style.css", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/css", PAGE_settingsCss, PAGE_settingsCss_length);
|
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/css", PAGE_settingsCss, PAGE_settingsCss_length);
|
||||||
@ -150,27 +150,27 @@ void initServer()
|
|||||||
setStaticContentCacheHeaders(response);
|
setStaticContentCacheHeaders(response);
|
||||||
request->send(response);
|
request->send(response);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
if(!handleFileRead(request, "/favicon.ico"))
|
if(!handleFileRead(request, "/favicon.ico"))
|
||||||
{
|
{
|
||||||
request->send_P(200, "image/x-icon", favicon, 156);
|
request->send_P(200, "image/x-icon", favicon, 156);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/sliders", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/sliders", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveIndex(request);
|
serveIndex(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/welcome", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/welcome", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveSettings(request);
|
serveSettings(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/reset", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/reset", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(request, 200,F("Rebooting now..."),F("Please wait ~10 seconds..."),129);
|
serveMessage(request, 200,F("Rebooting now..."),F("Please wait ~10 seconds..."),129);
|
||||||
doReboot = true;
|
doReboot = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/settings", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/settings", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
serveSettings(request, true);
|
serveSettings(request, true);
|
||||||
});
|
});
|
||||||
@ -214,7 +214,7 @@ void initServer()
|
|||||||
} else {
|
} else {
|
||||||
doSerializeConfig = true; //serializeConfig(); //Save new settings to FS
|
doSerializeConfig = true; //serializeConfig(); //Save new settings to FS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request->send(200, "application/json", F("{\"success\":true}"));
|
request->send(200, "application/json", F("{\"success\":true}"));
|
||||||
});
|
});
|
||||||
server.addHandler(handler);
|
server.addHandler(handler);
|
||||||
@ -222,15 +222,15 @@ void initServer()
|
|||||||
server.on("/version", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/version", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(200, "text/plain", (String)VERSION);
|
request->send(200, "text/plain", (String)VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/uptime", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/uptime", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(200, "text/plain", (String)millis());
|
request->send(200, "text/plain", (String)millis());
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_usermod, PAGE_usermod_length);
|
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_usermod, PAGE_usermod_length);
|
||||||
@ -239,12 +239,12 @@ void initServer()
|
|||||||
request->send(response);
|
request->send(response);
|
||||||
//request->send_P(200, "text/html", PAGE_usermod);
|
//request->send_P(200, "text/html", PAGE_usermod);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Deprecated, use of /json/state and presets recommended instead
|
//Deprecated, use of /json/state and presets recommended instead
|
||||||
server.on("/url", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/url", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
URL_response(request);
|
URL_response(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/teapot", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/teapot", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(request, 418, F("418. I'm a teapot."), F("(Tangible Embedded Advanced Project Of Twinkling)"), 254);
|
serveMessage(request, 418, F("418. I'm a teapot."), F("(Tangible Embedded Advanced Project Of Twinkling)"), 254);
|
||||||
});
|
});
|
||||||
@ -271,14 +271,14 @@ void initServer()
|
|||||||
setStaticContentCacheHeaders(response);
|
setStaticContentCacheHeaders(response);
|
||||||
request->send(response);
|
request->send(response);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/rangetouch.js", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/rangetouch.js", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "application/javascript", rangetouchJs, rangetouchJs_length);
|
AsyncWebServerResponse *response = request->beginResponse_P(200, "application/javascript", rangetouchJs, rangetouchJs_length);
|
||||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||||
setStaticContentCacheHeaders(response);
|
setStaticContentCacheHeaders(response);
|
||||||
request->send(response);
|
request->send(response);
|
||||||
});
|
});
|
||||||
|
|
||||||
createEditHandler(correctPIN);
|
createEditHandler(correctPIN);
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_OTA
|
#ifndef WLED_DISABLE_OTA
|
||||||
@ -289,7 +289,7 @@ void initServer()
|
|||||||
} else
|
} else
|
||||||
serveSettings(request); // checks for "upd" in URL and handles PIN
|
serveSettings(request); // checks for "upd" in URL and handles PIN
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
|
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
if (!correctPIN) {
|
if (!correctPIN) {
|
||||||
serveSettings(request, true); // handle PIN page POST request
|
serveSettings(request, true); // handle PIN page POST request
|
||||||
@ -298,7 +298,7 @@ void initServer()
|
|||||||
if (Update.hasError() || otaLock) {
|
if (Update.hasError() || otaLock) {
|
||||||
serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry!"), 254);
|
serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry!"), 254);
|
||||||
} else {
|
} else {
|
||||||
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
|
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
|
||||||
doReboot = true;
|
doReboot = true;
|
||||||
}
|
}
|
||||||
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
|
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
|
||||||
@ -348,7 +348,7 @@ void initServer()
|
|||||||
#ifdef WLED_ENABLE_WEBSOCKETS
|
#ifdef WLED_ENABLE_WEBSOCKETS
|
||||||
server.addHandler(&ws);
|
server.addHandler(&ws);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//called when the url is not defined here, ajax-in; get-settings
|
//called when the url is not defined here, ajax-in; get-settings
|
||||||
server.onNotFound([](AsyncWebServerRequest *request){
|
server.onNotFound([](AsyncWebServerRequest *request){
|
||||||
DEBUG_PRINTLN("Not-Found HTTP call:");
|
DEBUG_PRINTLN("Not-Found HTTP call:");
|
||||||
@ -363,7 +363,7 @@ void initServer()
|
|||||||
request->send(response);
|
request->send(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(handleSet(request, request->url())) return;
|
if(handleSet(request, request->url())) return;
|
||||||
#ifndef WLED_DISABLE_ALEXA
|
#ifndef WLED_DISABLE_ALEXA
|
||||||
if(espalexa.handleAlexaApiCall(request)) return;
|
if(espalexa.handleAlexaApiCall(request)) return;
|
||||||
@ -471,7 +471,7 @@ void serveMessage(AsyncWebServerRequest* request, uint16_t code, const String& h
|
|||||||
messageHead = headl;
|
messageHead = headl;
|
||||||
messageSub = subl;
|
messageSub = subl;
|
||||||
optionType = optionT;
|
optionType = optionT;
|
||||||
|
|
||||||
request->send_P(code, "text/html", PAGE_msg, msgProcessor);
|
request->send_P(code, "text/html", PAGE_msg, msgProcessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ String dmxProcessor(const String& var)
|
|||||||
mapJS += "0];";
|
mapJS += "0];";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mapJS;
|
return mapJS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -526,7 +526,7 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
|||||||
byte subPage = 0, originalSubPage = 0;
|
byte subPage = 0, originalSubPage = 0;
|
||||||
const String& url = request->url();
|
const String& url = request->url();
|
||||||
|
|
||||||
if (url.indexOf("sett") >= 0)
|
if (url.indexOf("sett") >= 0)
|
||||||
{
|
{
|
||||||
if (url.indexOf(".js") > 0) subPage = 254;
|
if (url.indexOf(".js") > 0) subPage = 254;
|
||||||
else if (url.indexOf(".css") > 0) subPage = 253;
|
else if (url.indexOf(".css") > 0) subPage = 253;
|
||||||
@ -589,7 +589,7 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncWebServerResponse *response;
|
AsyncWebServerResponse *response;
|
||||||
switch (subPage)
|
switch (subPage)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ void URL_response(AsyncWebServerRequest *request)
|
|||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
sprintf(s,"%02X", col[i]);
|
sprintf(s,"%02X", col[i]);
|
||||||
oappend(s);
|
oappend(s);
|
||||||
}
|
}
|
||||||
oappend(SET_F("&C2=h"));
|
oappend(SET_F("&C2=h"));
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
@ -115,7 +115,7 @@ void URL_response(AsyncWebServerRequest *request)
|
|||||||
oappend(SET_F("<html><body><a href=\""));
|
oappend(SET_F("<html><body><a href=\""));
|
||||||
oappend(s2buf);
|
oappend(s2buf);
|
||||||
oappend(SET_F("\" target=\"_blank\">"));
|
oappend(SET_F("\" target=\"_blank\">"));
|
||||||
oappend(s2buf);
|
oappend(s2buf);
|
||||||
oappend(SET_F("</a></body></html>"));
|
oappend(SET_F("</a></body></html>"));
|
||||||
|
|
||||||
if (request != nullptr) request->send(200, "text/html", obuf);
|
if (request != nullptr) request->send(200, "text/html", obuf);
|
||||||
@ -566,7 +566,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
case HUE_ERROR_TIMEOUT : strcpy_P(hueErrorString,PSTR("Timeout")); break;
|
case HUE_ERROR_TIMEOUT : strcpy_P(hueErrorString,PSTR("Timeout")); break;
|
||||||
default: sprintf_P(hueErrorString,PSTR("Bridge Error %i"),hueError);
|
default: sprintf_P(hueErrorString,PSTR("Bridge Error %i"),hueError);
|
||||||
}
|
}
|
||||||
|
|
||||||
sappends('m',SET_F("(\"sip\")[0]"),hueErrorString);
|
sappends('m',SET_F("(\"sip\")[0]"),hueErrorString);
|
||||||
#else
|
#else
|
||||||
oappend(SET_F("toggle('Hue');")); // hide Hue Sync settings
|
oappend(SET_F("toggle('Hue');")); // hide Hue Sync settings
|
||||||
@ -658,17 +658,17 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
oappend(serverDescription);
|
oappend(serverDescription);
|
||||||
oappend(SET_F("\";"));
|
oappend(SET_F("\";"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
|
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
|
||||||
if (subPage == 7)
|
if (subPage == 7)
|
||||||
{
|
{
|
||||||
sappend('v',SET_F("PU"),e131ProxyUniverse);
|
sappend('v',SET_F("PU"),e131ProxyUniverse);
|
||||||
|
|
||||||
sappend('v',SET_F("CN"),DMXChannels);
|
sappend('v',SET_F("CN"),DMXChannels);
|
||||||
sappend('v',SET_F("CG"),DMXGap);
|
sappend('v',SET_F("CG"),DMXGap);
|
||||||
sappend('v',SET_F("CS"),DMXStart);
|
sappend('v',SET_F("CS"),DMXStart);
|
||||||
sappend('v',SET_F("SL"),DMXStartLED);
|
sappend('v',SET_F("SL"),DMXStartLED);
|
||||||
|
|
||||||
sappend('i',SET_F("CH1"),DMXFixtureMap[0]);
|
sappend('i',SET_F("CH1"),DMXFixtureMap[0]);
|
||||||
sappend('i',SET_F("CH2"),DMXFixtureMap[1]);
|
sappend('i',SET_F("CH2"),DMXFixtureMap[1]);
|
||||||
sappend('i',SET_F("CH3"),DMXFixtureMap[2]);
|
sappend('i',SET_F("CH3"),DMXFixtureMap[2]);
|
||||||
|
Loading…
Reference in New Issue
Block a user