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.
|
||||
*
|
||||
*
|
||||
* This was put together from these two excellent projects:
|
||||
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
|
||||
* https://github.com/probonopd/ESP8266HueEmulator
|
||||
@ -21,11 +21,11 @@ void alexaInit()
|
||||
espalexaDevice = new EspalexaDevice(alexaInvocationName, onAlexaChange, EspalexaDeviceType::extendedcolor);
|
||||
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
|
||||
if (alexaNumPresets) {
|
||||
String name = "";
|
||||
for (byte presetIndex = 1; presetIndex <= alexaNumPresets; presetIndex++)
|
||||
for (byte presetIndex = 1; presetIndex <= alexaNumPresets; presetIndex++)
|
||||
{
|
||||
if (!getPresetName(presetIndex, name)) break; // no more presets
|
||||
EspalexaDevice* dev = new EspalexaDevice(name.c_str(), onAlexaChange, EspalexaDeviceType::extendedcolor);
|
||||
@ -44,7 +44,7 @@ void handleAlexa()
|
||||
void onAlexaChange(EspalexaDevice* dev)
|
||||
{
|
||||
EspalexaDeviceProperty m = dev->getLastChangedProperty();
|
||||
|
||||
|
||||
if (m == EspalexaDeviceProperty::on)
|
||||
{
|
||||
if (dev->getId() == 0) // Device 0 is for on/off or macros
|
||||
@ -56,7 +56,7 @@ void onAlexaChange(EspalexaDevice* dev)
|
||||
bri = briLast;
|
||||
stateUpdated(CALL_MODE_ALEXA);
|
||||
}
|
||||
} else
|
||||
} else
|
||||
{
|
||||
applyPreset(macroAlexaOn, CALL_MODE_ALEXA);
|
||||
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;
|
||||
stateUpdated(CALL_MODE_ALEXA);
|
||||
}
|
||||
} else
|
||||
} else
|
||||
{
|
||||
applyPreset(macroAlexaOff, CALL_MODE_ALEXA);
|
||||
// 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 int16_t _cct; // definition in FX_fcn.cpp
|
||||
static uint8_t _cctBlend; // definition in FX_fcn.cpp
|
||||
|
||||
|
||||
uint32_t autoWhiteCalc(uint32_t c) {
|
||||
uint8_t aWM = _autoWhiteMode;
|
||||
if (_gAWM < 255) aWM = _gAWM;
|
||||
@ -271,7 +271,7 @@ class BusDigital : public Bus {
|
||||
//Fix for turning off onboard LED breaking bus
|
||||
#ifdef LED_BUILTIN
|
||||
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
|
||||
Bus::setBrightness(b);
|
||||
@ -343,7 +343,7 @@ class BusDigital : public Bus {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t _colorOrder = COL_ORDER_GRB;
|
||||
uint8_t _pins[2] = {255, 255};
|
||||
uint8_t _iType = I_NONE;
|
||||
@ -477,7 +477,7 @@ class BusPwm : public Bus {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t _pins[5] = {255, 255, 255, 255, 255};
|
||||
uint8_t _data[5] = {0};
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
@ -553,7 +553,7 @@ class BusOnOff : public Bus {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t _pin = 255;
|
||||
uint8_t _data = 0;
|
||||
};
|
||||
@ -717,7 +717,7 @@ class BusManager {
|
||||
//do not call this method from system context (network callback)
|
||||
void removeAll() {
|
||||
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();
|
||||
for (uint8_t i = 0; i < numBusses; i++) delete busses[i];
|
||||
numBusses = 0;
|
||||
|
@ -699,7 +699,7 @@ class PolyBus {
|
||||
}
|
||||
};
|
||||
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) {
|
||||
case I_NONE: break;
|
||||
#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_SS_P98_3: col = (static_cast<B_SS_P98_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
}
|
||||
|
||||
|
||||
// upper nibble contains W swap information
|
||||
uint8_t w = col.W;
|
||||
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) {
|
||||
if (!IS_DIGITAL(busType)) return I_NONE;
|
||||
if (IS_2PIN(busType)) { //SPI LED chips
|
||||
|
@ -105,18 +105,18 @@ void handleSwitch(uint8_t b)
|
||||
}
|
||||
|
||||
if (buttonLongPressed[b] == buttonPressedBefore[b]) return;
|
||||
|
||||
|
||||
if (millis() - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { //fire edge event only after 50ms without change (debounce)
|
||||
if (!buttonPressedBefore[b]) { // on -> off
|
||||
if (macroButton[b]) applyPreset(macroButton[b], CALL_MODE_BUTTON_PRESET);
|
||||
else { //turn on
|
||||
if (!bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
|
||||
}
|
||||
}
|
||||
} else { // off -> on
|
||||
if (macroLongPress[b]) applyPreset(macroLongPress[b], CALL_MODE_BUTTON_PRESET);
|
||||
else { //turn off
|
||||
if (bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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 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_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)) {
|
||||
// delay(1);
|
||||
//}
|
||||
//if (strip.isUpdating()) return; // give up
|
||||
//if (strip.isUpdating()) return; // give up
|
||||
|
||||
oldRead[b] = aRead;
|
||||
|
||||
@ -326,7 +326,7 @@ void esp32RMTInvertIdle()
|
||||
void handleIO()
|
||||
{
|
||||
handleButton();
|
||||
|
||||
|
||||
//set relay when LEDs turn on
|
||||
if (strip.getBrightness())
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
if (apHide > 1) apHide = 1;
|
||||
|
||||
CJSON(apBehavior, ap[F("behav")]);
|
||||
|
||||
|
||||
/*
|
||||
JsonArray ap_ip = ap["ip"];
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
@ -136,7 +136,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
#endif
|
||||
|
||||
JsonArray ins = hw_led["ins"];
|
||||
|
||||
|
||||
if (fromFS || !ins.isNull()) {
|
||||
uint8_t s = 0; // bus iterator
|
||||
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;
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
// 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
|
||||
DEBUG_PRINTF("PIN ALLOC error: GPIO%d for analog button #%d is not an analog pin!\n", btnPin[s], s);
|
||||
btnPin[s] = -1;
|
||||
pinManager.deallocatePin(pin,PinOwner::Button);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
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.
|
||||
uint8_t s = 0;
|
||||
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++) {
|
||||
btnPin[s] = -1;
|
||||
@ -497,7 +497,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
uint8_t it = 0;
|
||||
for (JsonObject timer : timers) {
|
||||
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(timerMinutes[it], timer["min"]);
|
||||
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));
|
||||
g = round(288.1221695283 * pow((temp - 60), -0.0755148492));
|
||||
b = 255;
|
||||
}
|
||||
}
|
||||
//g += 12; //mod by Aircoookie, a bit less accurate but visibly less pinkish
|
||||
rgb[0] = (uint8_t) constrain(r, 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;
|
||||
char first = in[0];
|
||||
uint32_t c = 0;
|
||||
|
||||
|
||||
if (first == '#' || first == 'h' || first == 'H') //is HEX encoded
|
||||
{
|
||||
c = strtoul(in +1, NULL, 16);
|
||||
|
@ -309,7 +309,7 @@
|
||||
|
||||
#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
|
||||
#ifdef ESP8266
|
||||
#define MAX_LEDS 1664 //can't rely on memory limit to limit this to 1600 LEDs
|
||||
@ -338,7 +338,7 @@
|
||||
#ifdef ESP8266
|
||||
#define SETTINGS_STACK_BUF_SIZE 2048
|
||||
#else
|
||||
#define SETTINGS_STACK_BUF_SIZE 3096
|
||||
#define SETTINGS_STACK_BUF_SIZE 3096
|
||||
#endif
|
||||
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
|
@ -73,7 +73,7 @@ void initDMX() {
|
||||
dmx.init(512); // initialize with bus length
|
||||
#else
|
||||
dmx.initWrite(512); // initialize with bus length
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -12,7 +12,7 @@
|
||||
//handles RGB data only
|
||||
void handleDDPPacket(e131_packet_t* p) {
|
||||
int lastPushSeq = e131LastSequenceNumber[0];
|
||||
|
||||
|
||||
//reject late packets belonging to previous frame (assuming 4 packets max. before push)
|
||||
if (e131SkipOutOfSequence && lastPushSeq) {
|
||||
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
|
||||
|
||||
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP);
|
||||
|
||||
|
||||
if (!realtimeOverride || (realtimeMode && useMainSegmentOnly)) {
|
||||
for (uint16_t i = start; i < stop; i++) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is4Chan) {
|
||||
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
|
||||
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);
|
||||
|
||||
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) {
|
||||
pollReplyCount++;
|
||||
} else {
|
||||
|
@ -172,7 +172,7 @@ void publishMqtt();
|
||||
void handleTime();
|
||||
void handleNetworkTime();
|
||||
void sendNTPPacket();
|
||||
bool checkNTPResponse();
|
||||
bool checkNTPResponse();
|
||||
void updateLocalTime();
|
||||
void getTimeString(char* out);
|
||||
bool checkCountdown();
|
||||
@ -202,7 +202,7 @@ inline bool applyTemporaryPreset() {return applyPreset(255);};
|
||||
void savePreset(byte index, const char* pname = nullptr, JsonObject saveobj = JsonObject());
|
||||
inline void saveTemporaryPreset() {savePreset(255);};
|
||||
void deletePreset(byte index);
|
||||
bool getPresetName(byte index, String& name);
|
||||
bool getPresetName(byte index, String& name);
|
||||
|
||||
//set.cpp
|
||||
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) {
|
||||
uint16_t bufsize = f.read(buf, FS_BUFSIZE);
|
||||
uint16_t count = 0;
|
||||
|
||||
|
||||
while (count < bufsize) {
|
||||
if(buf[count] == ' ') {
|
||||
if(++index >= targetLen) { // return true if space long enough
|
||||
@ -144,7 +144,7 @@ bool bufferedFindObjectEnd() {
|
||||
while (f.position() < f.size() -1) {
|
||||
uint16_t bufsize = f.read(buf, FS_BUFSIZE);
|
||||
uint16_t count = 0;
|
||||
|
||||
|
||||
while (count < bufsize) {
|
||||
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;
|
||||
return true; //nothing to append
|
||||
}
|
||||
|
||||
|
||||
//if there is enough empty space in file, insert there instead of appending
|
||||
if (!contentLen) contentLen = measureJson(*content);
|
||||
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
|
||||
updateFSInfo();
|
||||
|
||||
|
||||
if (f.size() + 9000 > (fsBytesTotal - fsBytesUsed)) { //make sure there is enough space to at least copy the file once
|
||||
errorFlag = ERR_FS_QUOTA;
|
||||
doCloseFile = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//check if last character in file is '}' (typical)
|
||||
uint32_t eof = f.size() -1;
|
||||
f.seek(eof, SeekSet);
|
||||
if (f.read() == '}') pos = eof;
|
||||
|
||||
|
||||
if (pos == 0) //not found
|
||||
{
|
||||
DEBUGFS_PRINTLN("not }");
|
||||
@ -277,12 +277,12 @@ bool writeObjectToFile(const char* file, const char* key, JsonDocument* content)
|
||||
DEBUGFS_PRINTLN(F("Failed to open!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!bufferedFind(key)) //key does not exist in file
|
||||
{
|
||||
return appendObjectToFile(key, content, s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//an object with this key already exists, replace or delete it
|
||||
pos = f.position();
|
||||
//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
|
||||
//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
|
||||
|
||||
|
||||
uint32_t contentLen = 0;
|
||||
if (!content->isNull()) contentLen = measureJson(*content);
|
||||
|
||||
|
@ -18,7 +18,7 @@ void handleHue()
|
||||
hueNewKey = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!WLED_CONNECTED || hueClient == nullptr || millis() - hueLastRequestSent < huePollIntervalMs) return;
|
||||
|
||||
hueLastRequestSent = millis();
|
||||
@ -100,7 +100,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
||||
{
|
||||
hueError = HUE_ERROR_JSON_PARSING; return;
|
||||
}
|
||||
|
||||
|
||||
int hueErrorCode = root[0][F("error")]["type"];
|
||||
if (hueErrorCode)//hue bridge returned error
|
||||
{
|
||||
@ -113,7 +113,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (hueAuthRequired)
|
||||
{
|
||||
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");
|
||||
if (str == nullptr) return;
|
||||
str = strstr(str,"{");
|
||||
|
||||
|
||||
auto error = deserializeJson(root, str);
|
||||
if (error)
|
||||
{
|
||||
@ -176,7 +176,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
||||
}
|
||||
|
||||
hueError = HUE_ERROR_ACTIVE;
|
||||
|
||||
|
||||
//apply vals
|
||||
if (hueBri != hueBriLast)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ void handleImprovPacket() {
|
||||
uint8_t improvState = 0x02; //authorized
|
||||
if (WLED_WIFI_CONFIGURED) improvState = 0x03; //provisioning
|
||||
if (Network.isConnected()) improvState = 0x04; //provisioned
|
||||
sendImprovStateResponse(improvState, false);
|
||||
sendImprovStateResponse(improvState, false);
|
||||
if (improvState == 0x04) sendImprovRPCResponse(ImprovRPCType::Request_State);
|
||||
break;
|
||||
}
|
||||
@ -166,7 +166,7 @@ void sendImprovRPCResponse(byte commandId) {
|
||||
out[11] = len;
|
||||
out[10] = 1 + len;
|
||||
out[8] = 3 + len; //RPC command type + data len + url len + url
|
||||
packetLen = 13 + len;
|
||||
packetLen = 13 + len;
|
||||
}
|
||||
|
||||
uint8_t checksum = 0;
|
||||
|
@ -71,11 +71,11 @@ void decBrightness()
|
||||
}
|
||||
|
||||
// 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);
|
||||
//these two will be overwritten if preset exists in handlePresets()
|
||||
effectCurrent = effectID;
|
||||
effectCurrent = effectID;
|
||||
effectPalette = paletteID;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ void decodeIR(uint32_t code)
|
||||
if (code > 0xFFFFFF) return; //invalid code
|
||||
|
||||
switch (irEnabled) {
|
||||
case 1:
|
||||
case 1:
|
||||
if (code > 0xF80000) decodeIR24OLD(code); // white 24-key remote (old) - it sends 0xFF0000 values
|
||||
else decodeIR24(code); // 24-key remote - 0xF70000 to 0xF80000
|
||||
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_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;
|
||||
default: return;
|
||||
default: return;
|
||||
}
|
||||
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.
|
||||
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.
|
||||
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
|
||||
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),
|
||||
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
|
||||
@ -632,7 +632,7 @@ Sample:
|
||||
"label": "Preset 1, fallback to Saw - Party if not found"},
|
||||
}
|
||||
*/
|
||||
void decodeIRJson(uint32_t code)
|
||||
void decodeIRJson(uint32_t code)
|
||||
{
|
||||
char objKey[10];
|
||||
String cmdStr;
|
||||
@ -720,10 +720,10 @@ void handleIR()
|
||||
if (irEnabled > 0)
|
||||
{
|
||||
if (irrecv == NULL)
|
||||
{
|
||||
{
|
||||
initIR(); return;
|
||||
}
|
||||
|
||||
|
||||
if (irrecv->decode(&results))
|
||||
{
|
||||
if (results.value != 0) // only print results if anything is received ( != 0 )
|
||||
|
@ -45,9 +45,9 @@
|
||||
#define IR24_PINK 0xF76897
|
||||
#define IR24_WHITE 0xF7E01F
|
||||
#define IR24_FLASH 0xF7D02F
|
||||
#define IR24_STROBE 0xF7F00F
|
||||
#define IR24_FADE 0xF7C837
|
||||
#define IR24_SMOOTH 0xF7E817
|
||||
#define IR24_STROBE 0xF7F00F
|
||||
#define IR24_FADE 0xF7C837
|
||||
#define IR24_SMOOTH 0xF7E817
|
||||
|
||||
// 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 +
|
||||
@ -75,7 +75,7 @@
|
||||
#define IR24_CT_CTMINUS 0xF7C837 // CT-
|
||||
#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_DARKER 0xFFB847 // Brightness Down
|
||||
#define IR24_OLD_OFF 0xFFF807 // Power OFF
|
||||
@ -101,30 +101,30 @@
|
||||
#define IR24_OLD_FADE 0xFF58A7 // FADE Mode
|
||||
#define IR24_OLD_SMOOTH 0xFF30CF // SMOOTH Mode
|
||||
|
||||
// 40-key defs for blue remote control
|
||||
#define IR40_BPLUS 0xFF3AC5 //
|
||||
#define IR40_BMINUS 0xFFBA45 //
|
||||
#define IR40_OFF 0xFF827D //
|
||||
#define IR40_ON 0xFF02FD //
|
||||
#define IR40_RED 0xFF1AE5 //
|
||||
#define IR40_GREEN 0xFF9A65 //
|
||||
#define IR40_BLUE 0xFFA25D //
|
||||
// 40-key defs for blue remote control
|
||||
#define IR40_BPLUS 0xFF3AC5 //
|
||||
#define IR40_BMINUS 0xFFBA45 //
|
||||
#define IR40_OFF 0xFF827D //
|
||||
#define IR40_ON 0xFF02FD //
|
||||
#define IR40_RED 0xFF1AE5 //
|
||||
#define IR40_GREEN 0xFF9A65 //
|
||||
#define IR40_BLUE 0xFFA25D //
|
||||
#define IR40_WHITE 0xFF22DD // natural white
|
||||
#define IR40_REDDISH 0xFF2AD5 //
|
||||
#define IR40_GREENISH 0xFFAA55 //
|
||||
#define IR40_DEEPBLUE 0xFF926D //
|
||||
#define IR40_REDDISH 0xFF2AD5 //
|
||||
#define IR40_GREENISH 0xFFAA55 //
|
||||
#define IR40_DEEPBLUE 0xFF926D //
|
||||
#define IR40_WARMWHITE2 0xFF12ED // warmest white
|
||||
#define IR40_ORANGE 0xFF0AF5 //
|
||||
#define IR40_TURQUOISE 0xFF8A75 //
|
||||
#define IR40_PURPLE 0xFFB24D //
|
||||
#define IR40_ORANGE 0xFF0AF5 //
|
||||
#define IR40_TURQUOISE 0xFF8A75 //
|
||||
#define IR40_PURPLE 0xFFB24D //
|
||||
#define IR40_WARMWHITE 0xFF32CD // warm white
|
||||
#define IR40_YELLOWISH 0xFF38C7 //
|
||||
#define IR40_CYAN 0xFFB847 //
|
||||
#define IR40_MAGENTA 0xFF7887 //
|
||||
#define IR40_YELLOWISH 0xFF38C7 //
|
||||
#define IR40_CYAN 0xFFB847 //
|
||||
#define IR40_MAGENTA 0xFF7887 //
|
||||
#define IR40_COLDWHITE 0xFFF807 // cold white
|
||||
#define IR40_YELLOW 0xFF18E7 //
|
||||
#define IR40_AQUA 0xFF9867 //
|
||||
#define IR40_PINK 0xFF58A7 //
|
||||
#define IR40_YELLOW 0xFF18E7 //
|
||||
#define IR40_AQUA 0xFF9867 //
|
||||
#define IR40_PINK 0xFF58A7 //
|
||||
#define IR40_COLDWHITE2 0xFFD827 // coldest white
|
||||
#define IR40_WPLUS 0xFF28D7 // white chanel bright plus
|
||||
#define IR40_WMINUS 0xFFA857 // white chanel bright minus
|
||||
@ -144,50 +144,50 @@
|
||||
#define IR40_SLOW 0xFFD02F // SLOW
|
||||
|
||||
// 44-key defs
|
||||
#define IR44_BPLUS 0xFF3AC5 //
|
||||
#define IR44_BMINUS 0xFFBA45 //
|
||||
#define IR44_OFF 0xFF827D //
|
||||
#define IR44_ON 0xFF02FD //
|
||||
#define IR44_RED 0xFF1AE5 //
|
||||
#define IR44_GREEN 0xFF9A65 //
|
||||
#define IR44_BLUE 0xFFA25D //
|
||||
#define IR44_BPLUS 0xFF3AC5 //
|
||||
#define IR44_BMINUS 0xFFBA45 //
|
||||
#define IR44_OFF 0xFF827D //
|
||||
#define IR44_ON 0xFF02FD //
|
||||
#define IR44_RED 0xFF1AE5 //
|
||||
#define IR44_GREEN 0xFF9A65 //
|
||||
#define IR44_BLUE 0xFFA25D //
|
||||
#define IR44_WHITE 0xFF22DD // natural white
|
||||
#define IR44_REDDISH 0xFF2AD5 //
|
||||
#define IR44_GREENISH 0xFFAA55 //
|
||||
#define IR44_DEEPBLUE 0xFF926D //
|
||||
#define IR44_REDDISH 0xFF2AD5 //
|
||||
#define IR44_GREENISH 0xFFAA55 //
|
||||
#define IR44_DEEPBLUE 0xFF926D //
|
||||
#define IR44_WARMWHITE2 0xFF12ED // warmest white
|
||||
#define IR44_ORANGE 0xFF0AF5 //
|
||||
#define IR44_TURQUOISE 0xFF8A75 //
|
||||
#define IR44_PURPLE 0xFFB24D //
|
||||
#define IR44_ORANGE 0xFF0AF5 //
|
||||
#define IR44_TURQUOISE 0xFF8A75 //
|
||||
#define IR44_PURPLE 0xFFB24D //
|
||||
#define IR44_WARMWHITE 0xFF32CD // warm white
|
||||
#define IR44_YELLOWISH 0xFF38C7 //
|
||||
#define IR44_CYAN 0xFFB847 //
|
||||
#define IR44_MAGENTA 0xFF7887 //
|
||||
#define IR44_YELLOWISH 0xFF38C7 //
|
||||
#define IR44_CYAN 0xFFB847 //
|
||||
#define IR44_MAGENTA 0xFF7887 //
|
||||
#define IR44_COLDWHITE 0xFFF807 // cold white
|
||||
#define IR44_YELLOW 0xFF18E7 //
|
||||
#define IR44_AQUA 0xFF9867 //
|
||||
#define IR44_PINK 0xFF58A7 //
|
||||
#define IR44_YELLOW 0xFF18E7 //
|
||||
#define IR44_AQUA 0xFF9867 //
|
||||
#define IR44_PINK 0xFF58A7 //
|
||||
#define IR44_COLDWHITE2 0xFFD827 // coldest white
|
||||
#define IR44_REDPLUS 0xFF28D7 //
|
||||
#define IR44_GREENPLUS 0xFFA857 //
|
||||
#define IR44_BLUEPLUS 0xFF6897 //
|
||||
#define IR44_QUICK 0xFFE817 //
|
||||
#define IR44_REDMINUS 0xFF08F7 //
|
||||
#define IR44_GREENMINUS 0xFF8877 //
|
||||
#define IR44_BLUEMINUS 0xFF48B7 //
|
||||
#define IR44_SLOW 0xFFC837 //
|
||||
#define IR44_DIY1 0xFF30CF //
|
||||
#define IR44_DIY2 0xFFB04F //
|
||||
#define IR44_DIY3 0xFF708F //
|
||||
#define IR44_AUTO 0xFFF00F //
|
||||
#define IR44_DIY4 0xFF10EF //
|
||||
#define IR44_DIY5 0xFF906F //
|
||||
#define IR44_DIY6 0xFF50AF //
|
||||
#define IR44_FLASH 0xFFD02F //
|
||||
#define IR44_JUMP3 0xFF20DF //
|
||||
#define IR44_JUMP7 0xFFA05F //
|
||||
#define IR44_FADE3 0xFF609F //
|
||||
#define IR44_FADE7 0xFFE01F //
|
||||
#define IR44_REDPLUS 0xFF28D7 //
|
||||
#define IR44_GREENPLUS 0xFFA857 //
|
||||
#define IR44_BLUEPLUS 0xFF6897 //
|
||||
#define IR44_QUICK 0xFFE817 //
|
||||
#define IR44_REDMINUS 0xFF08F7 //
|
||||
#define IR44_GREENMINUS 0xFF8877 //
|
||||
#define IR44_BLUEMINUS 0xFF48B7 //
|
||||
#define IR44_SLOW 0xFFC837 //
|
||||
#define IR44_DIY1 0xFF30CF //
|
||||
#define IR44_DIY2 0xFFB04F //
|
||||
#define IR44_DIY3 0xFF708F //
|
||||
#define IR44_AUTO 0xFFF00F //
|
||||
#define IR44_DIY4 0xFF10EF //
|
||||
#define IR44_DIY5 0xFF906F //
|
||||
#define IR44_DIY6 0xFF50AF //
|
||||
#define IR44_FLASH 0xFFD02F //
|
||||
#define IR44_JUMP3 0xFF20DF //
|
||||
#define IR44_JUMP7 0xFFA05F //
|
||||
#define IR44_FADE3 0xFF609F //
|
||||
#define IR44_FADE7 0xFFE01F //
|
||||
|
||||
//Infrared codes for 21-key remote https://images-na.ssl-images-amazon.com/images/I/51NMA0XucnL.jpg
|
||||
#define IR21_BRIGHTER 0xFFE01F
|
||||
|
@ -201,7 +201,7 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
seg.check1 = elem["o1"] | seg.check1;
|
||||
seg.check2 = elem["o2"] | seg.check2;
|
||||
seg.check3 = elem["o3"] | seg.check3;
|
||||
|
||||
|
||||
JsonArray iarr = elem[F("i")]; //set individual LEDs
|
||||
if (!iarr.isNull()) {
|
||||
// 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["rev"] = seg.reverse;
|
||||
root["mi"] = seg.mirror;
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (strip.isMatrix) {
|
||||
root["rY"] = seg.reverse_y;
|
||||
root["mY"] = seg.mirror_y;
|
||||
root[F("tp")] = seg.transpose;
|
||||
}
|
||||
root["o1"] = seg.check1;
|
||||
root["o2"] = seg.check2;
|
||||
root["o3"] = seg.check3;
|
||||
root["si"] = seg.soundSim;
|
||||
#endif
|
||||
root["o1"] = seg.check1;
|
||||
root["o2"] = seg.check2;
|
||||
root["o3"] = seg.check3;
|
||||
root["si"] = seg.soundSim;
|
||||
root["m12"] = seg.map1D2D;
|
||||
}
|
||||
|
||||
@ -650,7 +652,7 @@ void serializeInfo(JsonObject root)
|
||||
fs_info[F("pmt")] = presetsModifiedTime;
|
||||
|
||||
root[F("ndc")] = nodeListEnabled ? (int)Nodes.size() : -1;
|
||||
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#ifdef WLED_DEBUG
|
||||
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));
|
||||
switch (i) {
|
||||
case 0: //default palette
|
||||
setPaletteColors(curPalette, PartyColors_p);
|
||||
setPaletteColors(curPalette, PartyColors_p);
|
||||
break;
|
||||
case 1: //random
|
||||
curPalette.add("r");
|
||||
|
@ -102,19 +102,19 @@ void stateUpdated(byte callMode) {
|
||||
|
||||
if (bri != briOld || stateChanged) {
|
||||
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);
|
||||
|
||||
|
||||
//set flag to update blynk, ws and mqtt
|
||||
interfaceUpdateCallMode = callMode;
|
||||
stateChanged = false;
|
||||
} else {
|
||||
if (nightlightActive && !nightlightActiveOld && callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) {
|
||||
notify(CALL_MODE_NIGHTLIGHT);
|
||||
notify(CALL_MODE_NIGHTLIGHT);
|
||||
interfaceUpdateCallMode = CALL_MODE_NIGHTLIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (callMode != CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE)) {
|
||||
briNlT = bri;
|
||||
nightlightDelayMs -= (millis() - nightlightStartTime);
|
||||
@ -128,7 +128,7 @@ void stateUpdated(byte callMode) {
|
||||
|
||||
//deactivate nightlight if target brightness is reached
|
||||
if (bri == nightlightTargetBri && callMode != CALL_MODE_NO_NOTIFY && nightlightMode != NL_MODE_SUN) nightlightActive = false;
|
||||
|
||||
|
||||
if (fadeTransition) {
|
||||
//set correct delay if not using notification delay
|
||||
if (callMode != CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay; // load actual transition duration
|
||||
@ -160,7 +160,7 @@ void updateInterfaces(uint8_t callMode)
|
||||
sendDataWs();
|
||||
lastInterfaceUpdate = millis();
|
||||
if (callMode == CALL_MODE_WS_SEND) return;
|
||||
|
||||
|
||||
#ifndef WLED_DISABLE_ALEXA
|
||||
if (espalexaDevice != nullptr && callMode != CALL_MODE_ALEXA) {
|
||||
espalexaDevice->setValue(bri);
|
||||
@ -168,7 +168,7 @@ void updateInterfaces(uint8_t callMode)
|
||||
}
|
||||
#endif
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
if (callMode != CALL_MODE_BLYNK &&
|
||||
if (callMode != CALL_MODE_BLYNK &&
|
||||
callMode != CALL_MODE_NO_NOTIFY) updateBlynk();
|
||||
#endif
|
||||
doPublishMqtt = true;
|
||||
@ -181,7 +181,7 @@ void handleTransitions()
|
||||
//handle still pending interface update
|
||||
if (interfaceUpdateCallMode && millis() - lastInterfaceUpdate > INTERFACE_UPDATE_COOLDOWN) updateInterfaces(interfaceUpdateCallMode);
|
||||
if (doPublishMqtt) publishMqtt();
|
||||
|
||||
|
||||
if (transitionActive && transitionDelayTemp > 0)
|
||||
{
|
||||
float tper = (millis() - transitionStartTime)/(float)transitionDelayTemp;
|
||||
@ -196,7 +196,7 @@ void handleTransitions()
|
||||
if (tper - tperLast < 0.004) return;
|
||||
tperLast = tper;
|
||||
briT = briOld + ((bri - briOld) * tper);
|
||||
|
||||
|
||||
applyBri();
|
||||
}
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ bool parseLx(int lxValue, byte rgbw[4])
|
||||
bool ok = false;
|
||||
float lxRed = 0, lxGreen = 0, lxBlue = 0;
|
||||
|
||||
if (lxValue < 200000000) {
|
||||
if (lxValue < 200000000) {
|
||||
// Loxone RGB
|
||||
ok = true;
|
||||
lxRed = round((lxValue % 1000) * 2.55);
|
||||
lxGreen = round(((lxValue / 1000) % 1000) * 2.55);
|
||||
lxBlue = round(((lxValue / 1000000) % 1000) * 2.55);
|
||||
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
|
||||
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
|
||||
// Loxone Lumitech
|
||||
ok = true;
|
||||
float tmpBri = floor((lxValue - 200000000) / 10000); ;
|
||||
|
@ -1,15 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* Welcome!
|
||||
* Welcome!
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
@ -20,27 +20,27 @@ const ethernet_settings ethernetBoards[] = {
|
||||
// None
|
||||
{
|
||||
},
|
||||
|
||||
|
||||
// WT32-EHT01
|
||||
// Please note, from my testing only these pins work for LED outputs:
|
||||
// IO2, IO4, IO12, IO14, IO15
|
||||
// These pins do not appear to work from my testing:
|
||||
// IO35, IO36, IO39
|
||||
{
|
||||
1, // eth_address,
|
||||
16, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
1, // eth_address,
|
||||
16, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
ETH_PHY_LAN8720, // eth_type,
|
||||
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
||||
},
|
||||
|
||||
// ESP32-POE
|
||||
{
|
||||
0, // eth_address,
|
||||
12, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
0, // eth_address,
|
||||
12, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
ETH_PHY_LAN8720, // eth_type,
|
||||
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
||||
},
|
||||
@ -77,20 +77,20 @@ const ethernet_settings ethernetBoards[] = {
|
||||
|
||||
// ESP3DEUXQuattro
|
||||
{
|
||||
1, // eth_address,
|
||||
-1, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
1, // eth_address,
|
||||
-1, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
ETH_PHY_LAN8720, // eth_type,
|
||||
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
||||
},
|
||||
|
||||
// ESP32-ETHERNET-KIT-VE
|
||||
{
|
||||
0, // eth_address,
|
||||
5, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
0, // eth_address,
|
||||
5, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
ETH_PHY_IP101, // eth_type,
|
||||
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
||||
},
|
||||
@ -135,7 +135,7 @@ void WiFiEvent(WiFiEvent_t event)
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
char hostname[25];
|
||||
#endif
|
||||
|
||||
|
||||
switch (event) {
|
||||
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
|
||||
case SYSTEM_EVENT_ETH_START:
|
||||
|
@ -162,7 +162,7 @@ void updateTimezone() {
|
||||
|
||||
void handleTime() {
|
||||
handleNetworkTime();
|
||||
|
||||
|
||||
toki.millisecond();
|
||||
toki.setTick();
|
||||
|
||||
@ -363,7 +363,7 @@ void checkTimers()
|
||||
{
|
||||
if (timerMacro[i] != 0
|
||||
&& (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)
|
||||
&& ((timerWeekday[i] >> weekdayMondayFirst()) & 0x01) //timer should activate at current day of week
|
||||
&& 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;
|
||||
|
||||
//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);
|
||||
|
||||
//3. calculate the Sun's mean anomaly
|
||||
|
||||
//3. calculate the Sun's mean anomaly
|
||||
float M = (0.9856f * t) - 3.289f;
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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 RAquadrant = floor_t(RA/90) * 90;
|
||||
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;
|
||||
|
||||
//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);
|
||||
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;
|
||||
|
||||
//9. adjust back to UTC
|
||||
|
@ -18,7 +18,7 @@ void _overlayAnalogClock()
|
||||
int hourPixel = floor(analogClock12pixel + overlaySize*hourP);
|
||||
if (hourPixel > overlayMax) hourPixel = overlayMin -1 + hourPixel - overlayMax;
|
||||
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);
|
||||
if (secondPixel > overlayMax) secondPixel = overlayMin -1 + secondPixel - overlayMax;
|
||||
if (analogClockSecondsTrail)
|
||||
|
@ -514,7 +514,7 @@ const byte Tiamat_gp[] PROGMEM = {
|
||||
220, 39,252,135, //gc from 177,254,255
|
||||
240, 193,213,253, //gc from 203,239,253
|
||||
255, 255,249,255};
|
||||
|
||||
|
||||
//Custom palette by Aircoookie
|
||||
|
||||
const byte April_Night_gp[] PROGMEM = {
|
||||
@ -598,16 +598,16 @@ const byte Atlantica_gp[] PROGMEM = {
|
||||
0, 255, 5, 0, //red
|
||||
60, 255, 5, 0,
|
||||
60, 196, 57, 2, //amber (start 61?)
|
||||
120, 196, 57, 2,
|
||||
120, 196, 57, 2,
|
||||
120, 6, 126, 2, //green (start 126?)
|
||||
180, 6, 126, 2,
|
||||
180, 4, 30, 114, //blue (start 191?)
|
||||
255, 4, 30, 114};
|
||||
|
||||
|
||||
// Gradient palette "temperature_gp", originally from
|
||||
// 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)
|
||||
// Size: 144 bytes of program space.
|
||||
// Size: 144 bytes of program space.
|
||||
|
||||
const byte temperature_gp[] PROGMEM = {
|
||||
0, 1, 27,105,
|
||||
|
@ -31,7 +31,7 @@ bool PinManagerClass::deallocatePin(byte gpio, PinOwner tag)
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
byte by = gpio >> 3;
|
||||
byte bi = gpio - 8*by;
|
||||
bitWrite(pinAlloc[by], bi, false);
|
||||
@ -119,7 +119,7 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by
|
||||
continue;
|
||||
} else if (isPinAllocated(gpio)) {
|
||||
#ifdef WLED_DEBUG
|
||||
DEBUG_PRINT(F("PIN ALLOC: FAIL: IO "));
|
||||
DEBUG_PRINT(F("PIN ALLOC: FAIL: IO "));
|
||||
DEBUG_PRINT(gpio);
|
||||
DEBUG_PRINT(F(" already allocated by "));
|
||||
DebugPrintOwnerTag(ownerTag[gpio]);
|
||||
@ -143,7 +143,7 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by
|
||||
// as this can greatly simplify configuration arrays
|
||||
continue;
|
||||
}
|
||||
if (gpio >= WLED_NUM_PINS)
|
||||
if (gpio >= WLED_NUM_PINS)
|
||||
continue; // other unexpected GPIO => avoid array bounds violation
|
||||
|
||||
byte by = gpio >> 3;
|
||||
@ -151,7 +151,7 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by
|
||||
bitWrite(pinAlloc[by], bi, true);
|
||||
ownerTag[gpio] = tag;
|
||||
#ifdef WLED_DEBUG
|
||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||
DEBUG_PRINT(gpio);
|
||||
DEBUG_PRINT(F(" allocated by "));
|
||||
DebugPrintOwnerTag(tag);
|
||||
@ -183,7 +183,7 @@ bool PinManagerClass::allocatePin(byte gpio, bool output, PinOwner tag)
|
||||
}
|
||||
if (isPinAllocated(gpio)) {
|
||||
#ifdef WLED_DEBUG
|
||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||
DEBUG_PRINT(gpio);
|
||||
DEBUG_PRINT(F(" already allocated by "));
|
||||
DebugPrintOwnerTag(ownerTag[gpio]);
|
||||
@ -197,12 +197,12 @@ bool PinManagerClass::allocatePin(byte gpio, bool output, PinOwner tag)
|
||||
bitWrite(pinAlloc[by], bi, true);
|
||||
ownerTag[gpio] = tag;
|
||||
#ifdef WLED_DEBUG
|
||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||
DEBUG_PRINT(F("PIN ALLOC: Pin "));
|
||||
DEBUG_PRINT(gpio);
|
||||
DEBUG_PRINT(F(" successfully allocated by "));
|
||||
DebugPrintOwnerTag(tag);
|
||||
DEBUG_PRINTLN(F(""));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
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.
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* ADC1: GPIO1 - GPIO10 (channel 0..9)
|
||||
|
@ -15,7 +15,7 @@ typedef struct PinManagerPinType {
|
||||
* Allows PinManager to "lock" an allocation to a specific
|
||||
* owner, so someone else doesn't accidentally de-allocate
|
||||
* a pin it hasn't allocated. Also enhances debugging.
|
||||
*
|
||||
*
|
||||
* RAM Cost:
|
||||
* 17 bytes on ESP8266
|
||||
* 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_AnimatedStaircase = USERMOD_ID_ANIMATED_STAIRCASE, // 0x0E // Usermod "Animated_Staircase.h"
|
||||
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_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
|
||||
@ -92,7 +92,7 @@ class PinManagerClass {
|
||||
// De-allocation requires the same owner tag (or override)
|
||||
bool allocatePin(byte gpio, bool output, PinOwner 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,
|
||||
// ethernet, etc..
|
||||
bool allocateMultiplePins(const managed_pin_type * mptArray, byte arrayElementCount, PinOwner tag );
|
||||
|
@ -55,7 +55,7 @@ void unloadPlaylist() {
|
||||
|
||||
int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
|
||||
unloadPlaylist();
|
||||
|
||||
|
||||
JsonArray presets = playlistObj["ps"];
|
||||
playlistLen = presets.size();
|
||||
if (playlistLen == 0) return -1;
|
||||
|
@ -79,12 +79,12 @@ static void doSaveState() {
|
||||
playlistSave = false;
|
||||
}
|
||||
|
||||
bool getPresetName(byte index, String& name)
|
||||
bool getPresetName(byte index, String& name)
|
||||
{
|
||||
if (!requestJSONBufferLock(9)) return false;
|
||||
bool presetExists = false;
|
||||
if (readObjectFromFileUsingId(getFileName(), index, &doc))
|
||||
{
|
||||
{
|
||||
JsonObject fdo = doc.as<JsonObject>();
|
||||
if (fdo["n"]) {
|
||||
name = (const char*)(fdo["n"]);
|
||||
|
@ -171,14 +171,14 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
buttonType[i] = request->arg(be).toInt();
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
// 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
|
||||
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;
|
||||
pinManager.deallocatePin(hw_btn_pin,PinOwner::Button);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (disablePullUp) {
|
||||
@ -200,7 +200,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
|
||||
strip.ablMilliampsMax = request->arg(F("MA")).toInt();
|
||||
strip.milliampsPerLed = request->arg(F("LA")).toInt();
|
||||
|
||||
|
||||
briS = request->arg(F("CA")).toInt();
|
||||
|
||||
turnOnAtBoot = request->hasArg(F("BO"));
|
||||
@ -362,7 +362,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
longitude = request->arg(F("LN")).toFloat();
|
||||
latitude = request->arg(F("LT")).toFloat();
|
||||
// force a sunrise/sunset re-calculation
|
||||
calculateSunriseAndSunset();
|
||||
calculateSunriseAndSunset();
|
||||
|
||||
overlayCurrent = request->hasArg(F("OL")) ? 1 : 0;
|
||||
|
||||
|
@ -41,7 +41,7 @@ void notify(byte callMode, bool followUp)
|
||||
udpOut[8] = mainseg.mode;
|
||||
udpOut[9] = mainseg.speed;
|
||||
udpOut[10] = W(col);
|
||||
//compatibilityVersionByte:
|
||||
//compatibilityVersionByte:
|
||||
//0: old 1: supports white 2: supports secondary color
|
||||
//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
|
||||
@ -62,7 +62,7 @@ void notify(byte callMode, bool followUp)
|
||||
udpOut[21] = G(col);
|
||||
udpOut[22] = B(col);
|
||||
udpOut[23] = W(col);
|
||||
|
||||
|
||||
udpOut[24] = followUp;
|
||||
uint32_t t = millis() + strip.timebase;
|
||||
udpOut[25] = (t >> 24) & 0xFF;
|
||||
@ -219,7 +219,7 @@ void handleNotifications()
|
||||
if(udpConnected && (notificationCount < udpNumRetries) && ((millis()-notificationSentTime) > 250)){
|
||||
notify(notificationSentCallMode,true);
|
||||
}
|
||||
|
||||
|
||||
if (e131NewData && millis() - strip.getLastShow() > 15)
|
||||
{
|
||||
e131NewData = false;
|
||||
@ -231,7 +231,7 @@ void handleNotifications()
|
||||
|
||||
//receive UDP notifications
|
||||
if (!udpConnected) return;
|
||||
|
||||
|
||||
bool isSupp = false;
|
||||
size_t packetSize = notifierUdp.parsePacket();
|
||||
if (!packetSize && udp2Connected) {
|
||||
@ -260,11 +260,11 @@ void handleNotifications()
|
||||
}
|
||||
if (!(realtimeMode && useMainSegmentOnly)) strip.show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(receiveNotifications || receiveDirect)) return;
|
||||
|
||||
|
||||
localIP = Network.localIP();
|
||||
//notifier and UDP realtime
|
||||
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
|
||||
@ -313,7 +313,7 @@ void handleNotifications()
|
||||
if (millis() - notificationSentTime < 1000) return;
|
||||
if (udpIn[1] > 199) return; //do not receive custom versions
|
||||
|
||||
//compatibilityVersionByte:
|
||||
//compatibilityVersionByte:
|
||||
byte version = udpIn[11];
|
||||
|
||||
// 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
|
||||
if (!(receiveGroups & 0x01)) return;
|
||||
} else if (!(receiveGroups & udpIn[36])) return;
|
||||
|
||||
|
||||
bool someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||
|
||||
//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
|
||||
uint16_t cct = udpIn[38];
|
||||
if (udpIn[37] > 0) { //Kelvin
|
||||
cct |= (udpIn[37] << 8);
|
||||
cct |= (udpIn[37] << 8);
|
||||
}
|
||||
strip.setCCT(cct);
|
||||
}
|
||||
@ -404,7 +404,7 @@ void handleNotifications()
|
||||
}
|
||||
stateChanged = true;
|
||||
}
|
||||
|
||||
|
||||
// simple effect sync, applies to all selected segments
|
||||
if (applyEffects && (version < 11 || !receiveSegmentOptions)) {
|
||||
for (size_t i = 0; i < strip.getSegmentsNum(); i++) {
|
||||
@ -450,7 +450,7 @@ void handleNotifications()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (version > 3)
|
||||
{
|
||||
transitionDelayTemp = ((udpIn[17] << 0) & 0xFF) + ((udpIn[18] << 8) & 0xFF00);
|
||||
@ -458,14 +458,14 @@ void handleNotifications()
|
||||
|
||||
nightlightActive = udpIn[6];
|
||||
if (nightlightActive) nightlightDelayMins = udpIn[7];
|
||||
|
||||
|
||||
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
||||
stateUpdated(CALL_MODE_NOTIFICATION);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!receiveDirect) return;
|
||||
|
||||
|
||||
//TPM2.NET
|
||||
if (udpIn[0] == 0x9c)
|
||||
{
|
||||
@ -543,7 +543,7 @@ void handleNotifications()
|
||||
for (size_t i = 2; i < packetSize -3; i += 4)
|
||||
{
|
||||
setRealtimePixel(id, udpIn[i], udpIn[i+1], udpIn[i+2], udpIn[i+3]);
|
||||
|
||||
|
||||
id++; if (id >= totalLen) break;
|
||||
}
|
||||
} else if (udpIn[0] == 4) //dnrgb
|
||||
@ -652,7 +652,7 @@ void sendSysInfoUDP()
|
||||
uint8_t data[44] = {0};
|
||||
data[0] = 255;
|
||||
data[1] = 1;
|
||||
|
||||
|
||||
for (size_t x = 0; x < 4; 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 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;
|
||||
|
||||
@ -730,7 +730,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
|
||||
|
||||
// there are 3 channels per RGB pixel
|
||||
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;
|
||||
|
||||
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));
|
||||
/*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
|
||||
for (size_t i = 0; i < packetSize; i += 3) {
|
||||
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 (!ddpUdp.endPacket()) {
|
||||
if (!ddpUdp.endPacket()) {
|
||||
DEBUG_PRINTLN(F("WiFiUDP.endPacket returned an error"));
|
||||
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::handleOverlayDraw() { for (byte i = 0; i < numMods; i++) ums[i]->handleOverlayDraw(); }
|
||||
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;
|
||||
for (byte i = 0; i < numMods; i++) {
|
||||
if (ums[i]->handleButton(b)) overrideIO = true;
|
||||
}
|
||||
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++) {
|
||||
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)
|
||||
@ -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::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); }
|
||||
bool UsermodManager::readFromConfig(JsonObject& obj) {
|
||||
bool UsermodManager::readFromConfig(JsonObject& obj) {
|
||||
bool allComplete = true;
|
||||
for (byte i = 0; i < numMods; i++) {
|
||||
if (!ums[i]->readFromConfig(obj)) allComplete = false;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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)
|
||||
* 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!
|
||||
*/
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
//gets called once at boot. Do all initialization that doesn't depend on network here
|
||||
void userSetup()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
//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
|
||||
void userLoop()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
class UsermodRenameMe : public Usermod {
|
||||
private:
|
||||
|
||||
|
||||
public:
|
||||
void setup() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
|
||||
}
|
||||
};
|
@ -55,7 +55,7 @@
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
#ifdef USE_ALT_DISPlAY
|
||||
#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"
|
||||
#endif
|
||||
#endif
|
||||
@ -169,7 +169,7 @@
|
||||
// resolved correctly (when included in mod's header only)
|
||||
#ifdef WLED_USE_SD_MMC
|
||||
#include "SD_MMC.h"
|
||||
#elif defined(WLED_USE_SD_SPI)
|
||||
#elif defined(WLED_USE_SD_SPI)
|
||||
#include "SD.h"
|
||||
#include "SPI.h"
|
||||
#endif
|
||||
@ -196,119 +196,119 @@ void registerUsermods()
|
||||
#ifdef USERMOD_BATTERY
|
||||
usermods.add(new UsermodBattery());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_DALLASTEMPERATURE
|
||||
usermods.add(new UsermodTemperature());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_SN_PHOTORESISTOR
|
||||
usermods.add(new Usermod_SN_Photoresistor());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_PWM_FAN
|
||||
usermods.add(new PWMFanUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_BUZZER
|
||||
usermods.add(new BuzzerUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_BH1750
|
||||
usermods.add(new Usermod_BH1750());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_BME280
|
||||
usermods.add(new UsermodBME280());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_SENSORSTOMQTT
|
||||
usermods.add(new UserMod_SensorsToMQTT());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_PIRSWITCH
|
||||
usermods.add(new PIRsensorSwitch());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_MODE_SORT
|
||||
usermods.add(new ModeSortUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
usermods.add(new FourLineDisplayUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_ROTARY_ENCODER_UI
|
||||
usermods.add(new RotaryEncoderUIUsermod()); // can use USERMOD_FOUR_LINE_DISPLAY
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_AUTO_SAVE
|
||||
usermods.add(new AutoSaveUsermod()); // can use USERMOD_FOUR_LINE_DISPLAY
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_DHT
|
||||
usermods.add(new UsermodDHT());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_VL53L0X_GESTURES
|
||||
usermods.add(new UsermodVL53L0XGestures());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_ANIMATED_STAIRCASE
|
||||
usermods.add(new Animated_Staircase());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_MULTI_RELAY
|
||||
usermods.add(new MultiRelay());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_RTC
|
||||
usermods.add(new RTCUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_ELEKSTUBE_IPS
|
||||
usermods.add(new ElekstubeIPSUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_ROTARY_ENCODER_BRIGHTNESS_COLOR
|
||||
usermods.add(new RotaryEncoderBrightnessColor());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RGB_ROTARY_ENCODER
|
||||
usermods.add(new RgbRotaryEncoderUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_ST7789_DISPLAY
|
||||
usermods.add(new St7789DisplayUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_SEVEN_SEGMENT
|
||||
usermods.add(new SevenSegmentDisplay());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_SSDR
|
||||
usermods.add(new UsermodSSDR());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_CRONIXIE
|
||||
usermods.add(new UsermodCronixie());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef QUINLED_AN_PENTA
|
||||
usermods.add(new QuinLEDAnPentaUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_WIZLIGHTS
|
||||
usermods.add(new WizLightsUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_WORDCLOCK
|
||||
usermods.add(new WordClockUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_MY9291
|
||||
usermods.add(new MY9291Usermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_SI7021_MQTT_HA
|
||||
usermods.add(new Si7021_MQTT_HA());
|
||||
#endif
|
||||
@ -316,7 +316,7 @@ void registerUsermods()
|
||||
#ifdef USERMOD_SMARTNEST
|
||||
usermods.add(new Smartnest());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_AUDIOREACTIVE
|
||||
usermods.add(new AudioReactive());
|
||||
#endif
|
||||
@ -324,15 +324,15 @@ void registerUsermods()
|
||||
#ifdef USERMOD_ANALOG_CLOCK
|
||||
usermods.add(new AnalogClockUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_PING_PONG_CLOCK
|
||||
usermods.add(new PingPongClockUsermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_ADS1115
|
||||
usermods.add(new ADS1115Usermod());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_BOBLIGHT
|
||||
usermods.add(new BobLightUsermod());
|
||||
#endif
|
||||
@ -340,7 +340,7 @@ void registerUsermods()
|
||||
#ifdef SD_ADAPTER
|
||||
usermods.add(new UsermodSdCard());
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USERMOD_PWM_OUTPUTS
|
||||
usermods.add(new PwmOutputsUsermod());
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@ void parseNumber(const char* str, byte* val, byte minv, byte maxv)
|
||||
} else {
|
||||
if (wrap && *val == maxv && out > 0) out = minv;
|
||||
else if (wrap && *val == minv && out < 0) out = maxv;
|
||||
else {
|
||||
else {
|
||||
out += *val;
|
||||
if (out > maxv) out = maxv;
|
||||
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
|
||||
for (size_t i=0; i<strlen(dest); i++) if (dest[i]=='=') { dest[i]='\0'; break; } // truncate default value
|
||||
|
||||
|
||||
} else {
|
||||
// defaults to just speed and intensity since there is no slider data
|
||||
switch (slider) {
|
||||
@ -397,7 +397,7 @@ typedef enum UM_SoundSimulations {
|
||||
UMS_14_3
|
||||
} um_soundSimulations_t;
|
||||
|
||||
um_data_t* simulateSound(uint8_t simulationId)
|
||||
um_data_t* simulateSound(uint8_t simulationId)
|
||||
{
|
||||
static uint8_t samplePeak;
|
||||
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[0] = &volumeSmth;
|
||||
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[4] = &FFT_MajorPeak;
|
||||
um_data->u_data[5] = &my_magnitude;
|
||||
|
@ -150,7 +150,7 @@ void WLED::loop()
|
||||
}
|
||||
|
||||
//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) {
|
||||
doInitBusses = false;
|
||||
DEBUG_PRINTLN(F("Re-init busses."));
|
||||
@ -364,7 +364,7 @@ void WLED::setup()
|
||||
if (!fsinit) {
|
||||
DEBUGFS_PRINTLN(F("FS failed!"));
|
||||
errorFlag = ERR_FS_BEGIN;
|
||||
}
|
||||
}
|
||||
#ifdef WLED_ADD_EEPROM_SUPPORT
|
||||
else deEEP();
|
||||
#else
|
||||
@ -579,10 +579,10 @@ bool WLED::initEthernet()
|
||||
}
|
||||
|
||||
if (!ETH.begin(
|
||||
(uint8_t) es.eth_address,
|
||||
(int) es.eth_power,
|
||||
(int) es.eth_mdc,
|
||||
(int) es.eth_mdio,
|
||||
(uint8_t) es.eth_address,
|
||||
(int) es.eth_power,
|
||||
(int) es.eth_mdc,
|
||||
(int) es.eth_mdio,
|
||||
(eth_phy_type_t) es.eth_type,
|
||||
(eth_clock_mode_t) es.eth_clk_mode
|
||||
)) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
/*
|
||||
* DEPRECATED, do not use for new settings
|
||||
* Only used to restore config from pre-0.11 installations using the deEEP() methods
|
||||
*
|
||||
*
|
||||
* Methods to handle saving and loading to non-volatile memory
|
||||
* EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map
|
||||
*/
|
||||
@ -154,9 +154,9 @@ void loadSettingsFromEEPROM()
|
||||
turnOnAtBoot = EEPROM.read(369);
|
||||
//strip.isRgbw = EEPROM.read(372);
|
||||
//374 - strip.paletteFade
|
||||
|
||||
|
||||
apBehavior = EEPROM.read(376);
|
||||
|
||||
|
||||
//377 = lastEEPROMversion
|
||||
if (lastEEPROMversion > 3) {
|
||||
aOtaEnabled = EEPROM.read(390);
|
||||
@ -164,7 +164,7 @@ void loadSettingsFromEEPROM()
|
||||
receiveNotificationEffects = EEPROM.read(392);
|
||||
}
|
||||
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||
|
||||
|
||||
if (lastEEPROMversion > 4) {
|
||||
#ifndef WLED_DISABLE_HUESYNC
|
||||
huePollingEnabled = EEPROM.read(2048);
|
||||
@ -232,7 +232,7 @@ void loadSettingsFromEEPROM()
|
||||
timerMacro[i] = EEPROM.read(2290 + i);
|
||||
if (timerMacro[i] > 0) timerMacro[i] += 16; //add 16 to work with macro --> preset mapping
|
||||
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) {
|
||||
udpPort2 = EEPROM.read(378) + ((EEPROM.read(379) << 8) & 0xFF00);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
receiveDirect = !EEPROM.read(2200);
|
||||
notifyMacro = EEPROM.read(2201);
|
||||
|
||||
@ -349,7 +349,7 @@ void loadSettingsFromEEPROM()
|
||||
DMXChannels = EEPROM.read(2530);
|
||||
DMXGap = EEPROM.read(2531) + ((EEPROM.read(2532) << 8) & 0xFF00);
|
||||
DMXStart = EEPROM.read(2533) + ((EEPROM.read(2534) << 8) & 0xFF00);
|
||||
|
||||
|
||||
for (int i=0;i<15;i++) {
|
||||
DMXFixtureMap[i] = EEPROM.read(2535+i);
|
||||
} //last used: 2549
|
||||
@ -372,7 +372,7 @@ void applyMacro(byte index) {
|
||||
// De-EEPROM routine, upgrade from previous versions to v0.11
|
||||
void deEEP() {
|
||||
if (WLED_FS.exists("/presets.json")) return;
|
||||
|
||||
|
||||
DEBUG_PRINTLN(F("Preset file not found, attempting to load from EEPROM"));
|
||||
DEBUGFS_PRINTLN(F("Allocating saving buffer for dEEP"));
|
||||
if (!requestJSONBufferLock(8)) return;
|
||||
@ -413,7 +413,7 @@ void deEEP() {
|
||||
|
||||
for (byte j = 0; j < numChannels; j++) colX.add(EEPROM.read(memloc + j));
|
||||
}
|
||||
|
||||
|
||||
segObj["fx"] = EEPROM.read(i+10);
|
||||
segObj["sx"] = EEPROM.read(i+11);
|
||||
segObj["ix"] = EEPROM.read(i+16);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 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.
|
||||
* 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)
|
||||
*/
|
||||
|
||||
|
@ -46,7 +46,7 @@ void sendJSON(){
|
||||
if (i != used-1) Serial.write(',');
|
||||
}
|
||||
Serial.println("]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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(0x36); Serial.write('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleSerial()
|
||||
{
|
||||
if (pinManager.isPinAllocated(hardwareRX)) return;
|
||||
|
||||
|
||||
#ifdef WLED_ENABLE_ADALIGHT
|
||||
static auto state = AdaState::Header_A;
|
||||
static uint16_t count = 0;
|
||||
@ -94,7 +94,7 @@ void handleSerial()
|
||||
return;
|
||||
} else if (next == 'v') {
|
||||
Serial.print("WLED"); Serial.write(' '); Serial.println(VERSION);
|
||||
|
||||
|
||||
} else if (next == 0xB0) {updateBaudRate( 115200);
|
||||
} else if (next == 0xB1) {updateBaudRate( 230400);
|
||||
} else if (next == 0xB2) {updateBaudRate( 460800);
|
||||
@ -103,11 +103,11 @@ void handleSerial()
|
||||
} else if (next == 0xB5) {updateBaudRate( 921600);
|
||||
} else if (next == 0xB6) {updateBaudRate(1000000);
|
||||
} else if (next == 0xB7) {updateBaudRate(1500000);
|
||||
|
||||
|
||||
} 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 == '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 == '{') { //JSON API
|
||||
@ -195,8 +195,8 @@ void handleSerial()
|
||||
// All other received bytes will disable Continuous Serial Streaming
|
||||
if (continuousSendLED && next != 'O'){
|
||||
continuousSendLED = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Serial.read(); //discard the byte
|
||||
}
|
||||
#endif
|
||||
|
@ -88,7 +88,7 @@ bool captivePortal(AsyncWebServerRequest *request)
|
||||
String hostH;
|
||||
if (!request->hasHeader("Host")) return false;
|
||||
hostH = request->getHeader("Host")->value();
|
||||
|
||||
|
||||
if (!isIp(hostH) && hostH.indexOf("wled.me") < 0 && hostH.indexOf(cmDNS) < 0) {
|
||||
DEBUG_PRINTLN("Captive portal");
|
||||
AsyncWebServerResponse *response = request->beginResponse(302);
|
||||
@ -135,14 +135,14 @@ void initServer()
|
||||
//request->send_P(200, "text/html", PAGE_liveview);
|
||||
});
|
||||
#endif
|
||||
|
||||
|
||||
//settings page
|
||||
server.on("/settings", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(request);
|
||||
});
|
||||
|
||||
|
||||
// "/settings/settings.js&p=x" request also handled by serveSettings()
|
||||
|
||||
|
||||
server.on("/style.css", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/css", PAGE_settingsCss, PAGE_settingsCss_length);
|
||||
@ -150,27 +150,27 @@ void initServer()
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
|
||||
server.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if(!handleFileRead(request, "/favicon.ico"))
|
||||
{
|
||||
request->send_P(200, "image/x-icon", favicon, 156);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
server.on("/sliders", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveIndex(request);
|
||||
});
|
||||
|
||||
|
||||
server.on("/welcome", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettings(request);
|
||||
});
|
||||
|
||||
|
||||
server.on("/reset", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(request, 200,F("Rebooting now..."),F("Please wait ~10 seconds..."),129);
|
||||
doReboot = true;
|
||||
});
|
||||
|
||||
|
||||
server.on("/settings", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
serveSettings(request, true);
|
||||
});
|
||||
@ -214,7 +214,7 @@ void initServer()
|
||||
} else {
|
||||
doSerializeConfig = true; //serializeConfig(); //Save new settings to FS
|
||||
}
|
||||
}
|
||||
}
|
||||
request->send(200, "application/json", F("{\"success\":true}"));
|
||||
});
|
||||
server.addHandler(handler);
|
||||
@ -222,15 +222,15 @@ void initServer()
|
||||
server.on("/version", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)VERSION);
|
||||
});
|
||||
|
||||
|
||||
server.on("/uptime", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)millis());
|
||||
});
|
||||
|
||||
|
||||
server.on("/freeheap", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
request->send(200, "text/plain", (String)ESP.getFreeHeap());
|
||||
});
|
||||
|
||||
|
||||
server.on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_usermod, PAGE_usermod_length);
|
||||
@ -239,12 +239,12 @@ void initServer()
|
||||
request->send(response);
|
||||
//request->send_P(200, "text/html", PAGE_usermod);
|
||||
});
|
||||
|
||||
|
||||
//Deprecated, use of /json/state and presets recommended instead
|
||||
server.on("/url", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
URL_response(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);
|
||||
});
|
||||
@ -271,14 +271,14 @@ void initServer()
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
|
||||
server.on("/rangetouch.js", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "application/javascript", rangetouchJs, rangetouchJs_length);
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
|
||||
createEditHandler(correctPIN);
|
||||
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
@ -289,7 +289,7 @@ void initServer()
|
||||
} else
|
||||
serveSettings(request); // checks for "upd" in URL and handles PIN
|
||||
});
|
||||
|
||||
|
||||
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
if (!correctPIN) {
|
||||
serveSettings(request, true); // handle PIN page POST request
|
||||
@ -298,7 +298,7 @@ void initServer()
|
||||
if (Update.hasError() || otaLock) {
|
||||
serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry!"), 254);
|
||||
} else {
|
||||
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
|
||||
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
|
||||
doReboot = true;
|
||||
}
|
||||
},[](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
|
||||
server.addHandler(&ws);
|
||||
#endif
|
||||
|
||||
|
||||
//called when the url is not defined here, ajax-in; get-settings
|
||||
server.onNotFound([](AsyncWebServerRequest *request){
|
||||
DEBUG_PRINTLN("Not-Found HTTP call:");
|
||||
@ -363,7 +363,7 @@ void initServer()
|
||||
request->send(response);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(handleSet(request, request->url())) return;
|
||||
#ifndef WLED_DISABLE_ALEXA
|
||||
if(espalexa.handleAlexaApiCall(request)) return;
|
||||
@ -471,7 +471,7 @@ void serveMessage(AsyncWebServerRequest* request, uint16_t code, const String& h
|
||||
messageHead = headl;
|
||||
messageSub = subl;
|
||||
optionType = optionT;
|
||||
|
||||
|
||||
request->send_P(code, "text/html", PAGE_msg, msgProcessor);
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ String dmxProcessor(const String& var)
|
||||
mapJS += "0];";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return mapJS;
|
||||
}
|
||||
#endif
|
||||
@ -526,7 +526,7 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
||||
byte subPage = 0, originalSubPage = 0;
|
||||
const String& url = request->url();
|
||||
|
||||
if (url.indexOf("sett") >= 0)
|
||||
if (url.indexOf("sett") >= 0)
|
||||
{
|
||||
if (url.indexOf(".js") > 0) subPage = 254;
|
||||
else if (url.indexOf(".css") > 0) subPage = 253;
|
||||
@ -589,7 +589,7 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AsyncWebServerResponse *response;
|
||||
switch (subPage)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ void URL_response(AsyncWebServerRequest *request)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
sprintf(s,"%02X", col[i]);
|
||||
oappend(s);
|
||||
oappend(s);
|
||||
}
|
||||
oappend(SET_F("&C2=h"));
|
||||
for (int i = 0; i < 3; i++)
|
||||
@ -115,7 +115,7 @@ void URL_response(AsyncWebServerRequest *request)
|
||||
oappend(SET_F("<html><body><a href=\""));
|
||||
oappend(s2buf);
|
||||
oappend(SET_F("\" target=\"_blank\">"));
|
||||
oappend(s2buf);
|
||||
oappend(s2buf);
|
||||
oappend(SET_F("</a></body></html>"));
|
||||
|
||||
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;
|
||||
default: sprintf_P(hueErrorString,PSTR("Bridge Error %i"),hueError);
|
||||
}
|
||||
|
||||
|
||||
sappends('m',SET_F("(\"sip\")[0]"),hueErrorString);
|
||||
#else
|
||||
oappend(SET_F("toggle('Hue');")); // hide Hue Sync settings
|
||||
@ -658,17 +658,17 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
oappend(serverDescription);
|
||||
oappend(SET_F("\";"));
|
||||
}
|
||||
|
||||
|
||||
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
|
||||
if (subPage == 7)
|
||||
{
|
||||
sappend('v',SET_F("PU"),e131ProxyUniverse);
|
||||
|
||||
|
||||
sappend('v',SET_F("CN"),DMXChannels);
|
||||
sappend('v',SET_F("CG"),DMXGap);
|
||||
sappend('v',SET_F("CS"),DMXStart);
|
||||
sappend('v',SET_F("SL"),DMXStartLED);
|
||||
|
||||
|
||||
sappend('i',SET_F("CH1"),DMXFixtureMap[0]);
|
||||
sappend('i',SET_F("CH2"),DMXFixtureMap[1]);
|
||||
sappend('i',SET_F("CH3"),DMXFixtureMap[2]);
|
||||
|
Loading…
Reference in New Issue
Block a user