mirror of
https://github.com/wled/WLED.git
synced 2025-07-18 16:26:32 +00:00
Optimized EEPROM string read/write code
Changed DNS server to improve AP mode stability
This commit is contained in:
parent
f98b0beee5
commit
34ddf104a9
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 1810061
|
#define VERSION 1810064
|
||||||
char versionString[] = "0.8.0";
|
char versionString[] = "0.8.0";
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ char mqttServer[33] = ""; //both domains and IPs should work
|
|||||||
|
|
||||||
bool huePollingEnabled = false; //poll hue bridge for light state
|
bool huePollingEnabled = false; //poll hue bridge for light state
|
||||||
uint16_t huePollIntervalMs = 2500; //low values (< 1sec) may cause lag but offer quicker response
|
uint16_t huePollIntervalMs = 2500; //low values (< 1sec) may cause lag but offer quicker response
|
||||||
char hueApiKey[65] = "api"; //key token will be obtained from bridge
|
char hueApiKey[47] = "api"; //key token will be obtained from bridge
|
||||||
byte huePollLightId = 1; //ID of hue lamp to sync to. Find the ID in the hue app ("about" section)
|
byte huePollLightId = 1; //ID of hue lamp to sync to. Find the ID in the hue app ("about" section)
|
||||||
IPAddress hueIP = (0,0,0,0); //IP address of the bridge
|
IPAddress hueIP = (0,0,0,0); //IP address of the bridge
|
||||||
bool hueApplyOnOff = true;
|
bool hueApplyOnOff = true;
|
||||||
@ -188,7 +188,7 @@ byte analogClock12pixel = 0; //The pixel in your strip where "m
|
|||||||
bool analogClockSecondsTrail = false; //Display seconds as trail of LEDs instead of a single pixel
|
bool analogClockSecondsTrail = false; //Display seconds as trail of LEDs instead of a single pixel
|
||||||
bool analogClock5MinuteMarks = false; //Light pixels at every 5-minute position
|
bool analogClock5MinuteMarks = false; //Light pixels at every 5-minute position
|
||||||
|
|
||||||
char cronixieDisplay[] = "HHMMSS"; //Cronixie Display mask. See wled13_cronixie.ino
|
char cronixieDisplay[7] = "HHMMSS"; //Cronixie Display mask. See wled13_cronixie.ino
|
||||||
bool cronixieBacklight = true; //Allow digits to be back-illuminated
|
bool cronixieBacklight = true; //Allow digits to be back-illuminated
|
||||||
|
|
||||||
bool countdownMode = false; //Clock will count down towards date
|
bool countdownMode = false; //Clock will count down towards date
|
||||||
|
@ -30,6 +30,25 @@ void clearEEPROM()
|
|||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void writeStringToEEPROM(uint16_t pos, char* str, uint16_t len)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
EEPROM.write(pos + i, str[i]);
|
||||||
|
if (str[i] == 0) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void readStringFromEEPROM(uint16_t pos, char* str, uint16_t len)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
str[i] = EEPROM.read(pos + i);
|
||||||
|
if (str[i] == 0) return;
|
||||||
|
}
|
||||||
|
str[len] = 0; //make sure every string is properly terminated. str must be at least len +1 big.
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write configuration to flash
|
* Write configuration to flash
|
||||||
*/
|
*/
|
||||||
@ -41,26 +60,12 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(233, 233);
|
EEPROM.write(233, 233);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 32; ++i)
|
writeStringToEEPROM( 0, clientSSID, 32);
|
||||||
{
|
writeStringToEEPROM( 32, clientPass, 64);
|
||||||
EEPROM.write(i, clientSSID[i]);
|
writeStringToEEPROM( 96, cmDNS, 32);
|
||||||
}
|
writeStringToEEPROM(128, apSSID, 32);
|
||||||
for (int i = 32; i < 96; ++i)
|
writeStringToEEPROM(160, apPass, 64);
|
||||||
{
|
|
||||||
EEPROM.write(i, clientPass[i-32]);
|
|
||||||
}
|
|
||||||
for (int i = 96; i < 128; ++i)
|
|
||||||
{
|
|
||||||
EEPROM.write(i, cmDNS[i-96]);
|
|
||||||
}
|
|
||||||
for (int i = 128; i < 160; ++i)
|
|
||||||
{
|
|
||||||
EEPROM.write(i, apSSID[i-128]);
|
|
||||||
}
|
|
||||||
for (int i = 160; i < 224; ++i)
|
|
||||||
{
|
|
||||||
EEPROM.write(i, apPass[i-160]);
|
|
||||||
}
|
|
||||||
EEPROM.write(224, nightlightDelayMins);
|
EEPROM.write(224, nightlightDelayMins);
|
||||||
EEPROM.write(225, nightlightFade);
|
EEPROM.write(225, nightlightFade);
|
||||||
EEPROM.write(226, notifyDirectDefault);
|
EEPROM.write(226, notifyDirectDefault);
|
||||||
@ -71,50 +76,50 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(231, notifyTwice);
|
EEPROM.write(231, notifyTwice);
|
||||||
EEPROM.write(232, buttonEnabled);
|
EEPROM.write(232, buttonEnabled);
|
||||||
//233 reserved for first boot flag
|
//233 reserved for first boot flag
|
||||||
|
|
||||||
for (int i = 0; i<4; i++) //ip addresses
|
for (int i = 0; i<4; i++) //ip addresses
|
||||||
{
|
{
|
||||||
EEPROM.write(234+i, staticIP[i]);
|
EEPROM.write(234+i, staticIP[i]);
|
||||||
EEPROM.write(238+i, staticGateway[i]);
|
EEPROM.write(238+i, staticGateway[i]);
|
||||||
EEPROM.write(242+i, staticSubnet[i]);
|
EEPROM.write(242+i, staticSubnet[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
EEPROM.write(246, colS[0]);
|
EEPROM.write(246, colS[0]);
|
||||||
EEPROM.write(247, colS[1]);
|
EEPROM.write(247, colS[1]);
|
||||||
EEPROM.write(248, colS[2]);
|
EEPROM.write(248, colS[2]);
|
||||||
EEPROM.write(249, briS);
|
EEPROM.write(249, briS);
|
||||||
|
|
||||||
EEPROM.write(250, receiveNotificationBrightness);
|
EEPROM.write(250, receiveNotificationBrightness);
|
||||||
EEPROM.write(251, fadeTransition);
|
EEPROM.write(251, fadeTransition);
|
||||||
EEPROM.write(252, reverseMode);
|
EEPROM.write(252, reverseMode);
|
||||||
EEPROM.write(253, (transitionDelayDefault >> 0) & 0xFF);
|
EEPROM.write(253, (transitionDelayDefault >> 0) & 0xFF);
|
||||||
EEPROM.write(254, (transitionDelayDefault >> 8) & 0xFF);
|
EEPROM.write(254, (transitionDelayDefault >> 8) & 0xFF);
|
||||||
EEPROM.write(255, briMultiplier);
|
EEPROM.write(255, briMultiplier);
|
||||||
|
|
||||||
//255,250,231,230,226 notifier bytes
|
//255,250,231,230,226 notifier bytes
|
||||||
for (int i = 256; i < 288; ++i)
|
writeStringToEEPROM(256, otaPass, 32);
|
||||||
{
|
|
||||||
EEPROM.write(i, otaPass[i-256]);
|
|
||||||
}
|
|
||||||
EEPROM.write(288, nightlightTargetBri);
|
EEPROM.write(288, nightlightTargetBri);
|
||||||
EEPROM.write(289, otaLock);
|
EEPROM.write(289, otaLock);
|
||||||
EEPROM.write(290, (udpPort >> 0) & 0xFF);
|
EEPROM.write(290, (udpPort >> 0) & 0xFF);
|
||||||
EEPROM.write(291, (udpPort >> 8) & 0xFF);
|
EEPROM.write(291, (udpPort >> 8) & 0xFF);
|
||||||
for (int i = 292; i < 324; ++i)
|
writeStringToEEPROM(292, serverDescription, 32);
|
||||||
{
|
|
||||||
EEPROM.write(i, serverDescription[i-292]);
|
|
||||||
}
|
|
||||||
EEPROM.write(324, effectDefault);
|
EEPROM.write(324, effectDefault);
|
||||||
EEPROM.write(325, effectSpeedDefault);
|
EEPROM.write(325, effectSpeedDefault);
|
||||||
EEPROM.write(326, effectIntensityDefault);
|
EEPROM.write(326, effectIntensityDefault);
|
||||||
|
|
||||||
EEPROM.write(327, ntpEnabled);
|
EEPROM.write(327, ntpEnabled);
|
||||||
EEPROM.write(328, currentTimezone);
|
EEPROM.write(328, currentTimezone);
|
||||||
EEPROM.write(329, useAMPM);
|
EEPROM.write(329, useAMPM);
|
||||||
EEPROM.write(330, useGammaCorrectionBri);
|
EEPROM.write(330, useGammaCorrectionBri);
|
||||||
EEPROM.write(331, useGammaCorrectionRGB);
|
EEPROM.write(331, useGammaCorrectionRGB);
|
||||||
EEPROM.write(332, overlayDefault);
|
EEPROM.write(332, overlayDefault);
|
||||||
|
|
||||||
EEPROM.write(333, alexaEnabled);
|
EEPROM.write(333, alexaEnabled);
|
||||||
for (int i = 334; i < 366; ++i)
|
writeStringToEEPROM(334, alexaInvocationName, 32);
|
||||||
{
|
|
||||||
EEPROM.write(i, alexaInvocationName[i-334]);
|
|
||||||
}
|
|
||||||
EEPROM.write(366, notifyAlexa);
|
EEPROM.write(366, notifyAlexa);
|
||||||
|
|
||||||
EEPROM.write(367, (arlsOffset>=0));
|
EEPROM.write(367, (arlsOffset>=0));
|
||||||
EEPROM.write(368, abs(arlsOffset));
|
EEPROM.write(368, abs(arlsOffset));
|
||||||
EEPROM.write(369, turnOnAtBoot);
|
EEPROM.write(369, turnOnAtBoot);
|
||||||
@ -125,7 +130,9 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(374, strip.paletteFade);
|
EEPROM.write(374, strip.paletteFade);
|
||||||
EEPROM.write(375, apWaitTimeSecs);
|
EEPROM.write(375, apWaitTimeSecs);
|
||||||
EEPROM.write(376, recoveryAPDisabled);
|
EEPROM.write(376, recoveryAPDisabled);
|
||||||
|
|
||||||
EEPROM.write(377, EEPVER); //eeprom was updated to latest
|
EEPROM.write(377, EEPVER); //eeprom was updated to latest
|
||||||
|
|
||||||
EEPROM.write(378, colSecS[0]);
|
EEPROM.write(378, colSecS[0]);
|
||||||
EEPROM.write(379, colSecS[1]);
|
EEPROM.write(379, colSecS[1]);
|
||||||
EEPROM.write(380, colSecS[2]);
|
EEPROM.write(380, colSecS[2]);
|
||||||
@ -137,6 +144,7 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(391, receiveNotificationColor);
|
EEPROM.write(391, receiveNotificationColor);
|
||||||
EEPROM.write(392, receiveNotificationEffects);
|
EEPROM.write(392, receiveNotificationEffects);
|
||||||
EEPROM.write(393, wifiLock);
|
EEPROM.write(393, wifiLock);
|
||||||
|
|
||||||
EEPROM.write(394, (abs(utcOffsetSecs) >> 0) & 0xFF);
|
EEPROM.write(394, (abs(utcOffsetSecs) >> 0) & 0xFF);
|
||||||
EEPROM.write(395, (abs(utcOffsetSecs) >> 8) & 0xFF);
|
EEPROM.write(395, (abs(utcOffsetSecs) >> 8) & 0xFF);
|
||||||
EEPROM.write(396, (utcOffsetSecs<0)); //is negative
|
EEPROM.write(396, (utcOffsetSecs<0)); //is negative
|
||||||
@ -144,18 +152,16 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(398, (ledCount >> 8) & 0xFF);
|
EEPROM.write(398, (ledCount >> 8) & 0xFF);
|
||||||
EEPROM.write(399, !enableSecTransition);
|
EEPROM.write(399, !enableSecTransition);
|
||||||
|
|
||||||
|
//favorite setting (preset) memory (25 slots/ each 20byte)
|
||||||
|
//400 - 899 reserved
|
||||||
|
|
||||||
for (int k=0;k<6;k++){
|
for (int k=0;k<6;k++){
|
||||||
int in = 900+k*8;
|
int in = 900+k*8;
|
||||||
for (int i=in; i < in+8; ++i)
|
writeStringToEEPROM(in, cssCol[k], 8);
|
||||||
{
|
}
|
||||||
EEPROM.write(i, cssCol[k][i-in]);
|
|
||||||
}}
|
|
||||||
|
|
||||||
EEPROM.write(948,currentTheme);
|
EEPROM.write(948,currentTheme);
|
||||||
for (int i = 950; i < 982; ++i)
|
writeStringToEEPROM(950, cssFont, 32);
|
||||||
{
|
|
||||||
EEPROM.write(i, cssFont[i-950]);
|
|
||||||
}
|
|
||||||
|
|
||||||
EEPROM.write(2048, huePollingEnabled);
|
EEPROM.write(2048, huePollingEnabled);
|
||||||
//EEPROM.write(2049, hueUpdatingEnabled);
|
//EEPROM.write(2049, hueUpdatingEnabled);
|
||||||
@ -163,10 +169,7 @@ void saveSettingsToEEPROM()
|
|||||||
{
|
{
|
||||||
EEPROM.write(i, hueIP[i-2050]);
|
EEPROM.write(i, hueIP[i-2050]);
|
||||||
}
|
}
|
||||||
for (int i = 2054; i < 2100; ++i)
|
writeStringToEEPROM(2054, hueApiKey, 46);
|
||||||
{
|
|
||||||
EEPROM.write(i, hueApiKey[i-2054]);
|
|
||||||
}
|
|
||||||
EEPROM.write(2100, (huePollIntervalMs >> 0) & 0xFF);
|
EEPROM.write(2100, (huePollIntervalMs >> 0) & 0xFF);
|
||||||
EEPROM.write(2101, (huePollIntervalMs >> 8) & 0xFF);
|
EEPROM.write(2101, (huePollIntervalMs >> 8) & 0xFF);
|
||||||
EEPROM.write(2102, notifyHue);
|
EEPROM.write(2102, notifyHue);
|
||||||
@ -180,6 +183,7 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(2152, analogClock12pixel);
|
EEPROM.write(2152, analogClock12pixel);
|
||||||
EEPROM.write(2153, analogClock5MinuteMarks);
|
EEPROM.write(2153, analogClock5MinuteMarks);
|
||||||
EEPROM.write(2154, analogClockSecondsTrail);
|
EEPROM.write(2154, analogClockSecondsTrail);
|
||||||
|
|
||||||
EEPROM.write(2155, countdownMode);
|
EEPROM.write(2155, countdownMode);
|
||||||
EEPROM.write(2156, countdownYear);
|
EEPROM.write(2156, countdownYear);
|
||||||
EEPROM.write(2157, countdownMonth);
|
EEPROM.write(2157, countdownMonth);
|
||||||
@ -189,10 +193,7 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(2161, countdownSec);
|
EEPROM.write(2161, countdownSec);
|
||||||
setCountdown();
|
setCountdown();
|
||||||
|
|
||||||
for (int i = 2165; i < 2171; ++i)
|
writeStringToEEPROM(2165, cronixieDisplay, 6);
|
||||||
{
|
|
||||||
EEPROM.write(i, cronixieDisplay[i-2165]);
|
|
||||||
}
|
|
||||||
EEPROM.write(2171, cronixieBacklight);
|
EEPROM.write(2171, cronixieBacklight);
|
||||||
setCronixie();
|
setCronixie();
|
||||||
|
|
||||||
@ -231,10 +232,7 @@ void saveSettingsToEEPROM()
|
|||||||
saveCurrPresetCycConf = false;
|
saveCurrPresetCycConf = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 2220; i < 2255; ++i)
|
writeStringToEEPROM(2220, blynkApiKey, 35);
|
||||||
{
|
|
||||||
EEPROM.write(i, blynkApiKey[i-2220]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
@ -244,18 +242,9 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(2290 + i, timerMacro[i] );
|
EEPROM.write(2290 + i, timerMacro[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 2300; i < 2333; ++i)
|
writeStringToEEPROM(2300, mqttServer, 32);
|
||||||
{
|
writeStringToEEPROM(2333, mqttDeviceTopic, 32);
|
||||||
EEPROM.write(i, mqttServer[i-2300]);
|
writeStringToEEPROM(2366, mqttGroupTopic, 32);
|
||||||
}
|
|
||||||
for (int i = 2333; i < 2366; ++i)
|
|
||||||
{
|
|
||||||
EEPROM.write(i, mqttDeviceTopic[i-2333]);
|
|
||||||
}
|
|
||||||
for (int i = 2366; i < 2399; ++i)
|
|
||||||
{
|
|
||||||
EEPROM.write(i, mqttGroupTopic[i-2366]);
|
|
||||||
}
|
|
||||||
|
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
}
|
}
|
||||||
@ -272,47 +261,28 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
}
|
}
|
||||||
int lastEEPROMversion = EEPROM.read(377); //last EEPROM version before update
|
int lastEEPROMversion = EEPROM.read(377); //last EEPROM version before update
|
||||||
|
|
||||||
for (int i = 0; i < 32; ++i)
|
|
||||||
{
|
|
||||||
clientSSID[i] = EEPROM.read(i);
|
|
||||||
if (clientSSID[i] == 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 32; i < 96; ++i)
|
readStringFromEEPROM( 0, clientSSID, 32);
|
||||||
{
|
readStringFromEEPROM( 32, clientPass, 64);
|
||||||
clientPass[i-32] = EEPROM.read(i);
|
readStringFromEEPROM( 96, cmDNS, 32);
|
||||||
if (clientPass[i-32] == 0) break;
|
readStringFromEEPROM(128, apSSID, 32);
|
||||||
}
|
readStringFromEEPROM(160, apPass, 64);
|
||||||
|
|
||||||
for (int i = 96; i < 128; ++i)
|
|
||||||
{
|
|
||||||
cmDNS[i-96] = EEPROM.read(i);
|
|
||||||
if (cmDNS[i-96] == 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 128; i < 160; ++i)
|
|
||||||
{
|
|
||||||
apSSID[i-128] = EEPROM.read(i);
|
|
||||||
if (apSSID[i-128] == 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 160; i < 224; ++i)
|
|
||||||
{
|
|
||||||
apPass[i-160] = EEPROM.read(i);
|
|
||||||
if (apPass[i-160] == 0) break;
|
|
||||||
}
|
|
||||||
nightlightDelayMins = EEPROM.read(224);
|
nightlightDelayMins = EEPROM.read(224);
|
||||||
nightlightFade = EEPROM.read(225);
|
nightlightFade = EEPROM.read(225);
|
||||||
notifyDirectDefault = EEPROM.read(226);
|
notifyDirectDefault = EEPROM.read(226);
|
||||||
notifyDirect = notifyDirectDefault;
|
notifyDirect = notifyDirectDefault;
|
||||||
|
|
||||||
apChannel = EEPROM.read(227);
|
apChannel = EEPROM.read(227);
|
||||||
if (apChannel > 13 || apChannel < 1) apChannel = 1;
|
if (apChannel > 13 || apChannel < 1) apChannel = 1;
|
||||||
apHide = EEPROM.read(228);
|
apHide = EEPROM.read(228);
|
||||||
if (apHide > 1) apHide = 1;
|
if (apHide > 1) apHide = 1;
|
||||||
ledCount = ((EEPROM.read(229) << 0) & 0xFF) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > 1200 || ledCount == 0) ledCount = 10;
|
ledCount = ((EEPROM.read(229) << 0) & 0xFF) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > 1200 || ledCount == 0) ledCount = 10;
|
||||||
|
|
||||||
notifyButton = EEPROM.read(230);
|
notifyButton = EEPROM.read(230);
|
||||||
notifyTwice = EEPROM.read(231);
|
notifyTwice = EEPROM.read(231);
|
||||||
buttonEnabled = EEPROM.read(232);
|
buttonEnabled = EEPROM.read(232);
|
||||||
|
|
||||||
staticIP[0] = EEPROM.read(234);
|
staticIP[0] = EEPROM.read(234);
|
||||||
staticIP[1] = EEPROM.read(235);
|
staticIP[1] = EEPROM.read(235);
|
||||||
staticIP[2] = EEPROM.read(236);
|
staticIP[2] = EEPROM.read(236);
|
||||||
@ -325,6 +295,7 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
staticSubnet[1] = EEPROM.read(243);
|
staticSubnet[1] = EEPROM.read(243);
|
||||||
staticSubnet[2] = EEPROM.read(244);
|
staticSubnet[2] = EEPROM.read(244);
|
||||||
staticSubnet[3] = EEPROM.read(245);
|
staticSubnet[3] = EEPROM.read(245);
|
||||||
|
|
||||||
colS[0] = EEPROM.read(246); col[0] = colS[0];
|
colS[0] = EEPROM.read(246); col[0] = colS[0];
|
||||||
colS[1] = EEPROM.read(247); col[1] = colS[1];
|
colS[1] = EEPROM.read(247); col[1] = colS[1];
|
||||||
colS[2] = EEPROM.read(248); col[2] = colS[2];
|
colS[2] = EEPROM.read(248); col[2] = colS[2];
|
||||||
@ -340,20 +311,14 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
transitionDelay = transitionDelayDefault;
|
transitionDelay = transitionDelayDefault;
|
||||||
briMultiplier = EEPROM.read(255);
|
briMultiplier = EEPROM.read(255);
|
||||||
|
|
||||||
for (int i = 256; i < 288; ++i)
|
readStringFromEEPROM(256, otaPass, 32);
|
||||||
{
|
|
||||||
otaPass[i-256] = EEPROM.read(i);
|
|
||||||
if (otaPass[i-256] == 0) break;
|
|
||||||
}
|
|
||||||
nightlightTargetBri = EEPROM.read(288);
|
nightlightTargetBri = EEPROM.read(288);
|
||||||
otaLock = EEPROM.read(289);
|
otaLock = EEPROM.read(289);
|
||||||
udpPort = ((EEPROM.read(290) << 0) & 0xFF) + ((EEPROM.read(291) << 8) & 0xFF00);
|
udpPort = ((EEPROM.read(290) << 0) & 0xFF) + ((EEPROM.read(291) << 8) & 0xFF00);
|
||||||
|
|
||||||
for (int i = 292; i < 324; ++i)
|
readStringFromEEPROM(292, serverDescription, 32);
|
||||||
{
|
|
||||||
serverDescription[i-292] = EEPROM.read(i);
|
|
||||||
if (serverDescription[i-292] == 0) break;
|
|
||||||
}
|
|
||||||
effectDefault = EEPROM.read(324); effectCurrent = effectDefault;
|
effectDefault = EEPROM.read(324); effectCurrent = effectDefault;
|
||||||
effectSpeedDefault = EEPROM.read(325); effectSpeed = effectSpeedDefault;
|
effectSpeedDefault = EEPROM.read(325); effectSpeed = effectSpeedDefault;
|
||||||
ntpEnabled = EEPROM.read(327);
|
ntpEnabled = EEPROM.read(327);
|
||||||
@ -366,11 +331,8 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
|
|
||||||
alexaEnabled = EEPROM.read(333);
|
alexaEnabled = EEPROM.read(333);
|
||||||
|
|
||||||
for (int i = 334; i < 366; ++i)
|
readStringFromEEPROM(334, alexaInvocationName, 32);
|
||||||
{
|
|
||||||
alexaInvocationName[i-334] = EEPROM.read(i);
|
|
||||||
if (alexaInvocationName[i-334] == 0) break;
|
|
||||||
}
|
|
||||||
notifyAlexa = EEPROM.read(366);
|
notifyAlexa = EEPROM.read(366);
|
||||||
arlsOffset = EEPROM.read(368);
|
arlsOffset = EEPROM.read(368);
|
||||||
if (!EEPROM.read(367)) arlsOffset = -arlsOffset;
|
if (!EEPROM.read(367)) arlsOffset = -arlsOffset;
|
||||||
@ -398,11 +360,7 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
receiveNotificationColor = EEPROM.read(391);
|
receiveNotificationColor = EEPROM.read(391);
|
||||||
receiveNotificationEffects = EEPROM.read(392);
|
receiveNotificationEffects = EEPROM.read(392);
|
||||||
|
|
||||||
for (int i = 950; i < 982; ++i)
|
readStringFromEEPROM(950, cssFont, 32);
|
||||||
{
|
|
||||||
cssFont[i-950] = EEPROM.read(i);
|
|
||||||
if (cssFont[i-950] == 0) break;
|
|
||||||
}
|
|
||||||
} else //keep receiving notification behavior from pre0.5.0 after update
|
} else //keep receiving notification behavior from pre0.5.0 after update
|
||||||
{
|
{
|
||||||
receiveNotificationColor = receiveNotificationBrightness;
|
receiveNotificationColor = receiveNotificationBrightness;
|
||||||
@ -417,11 +375,8 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
hueIP[i-2050] = EEPROM.read(i);
|
hueIP[i-2050] = EEPROM.read(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 2054; i < 2100; ++i)
|
readStringFromEEPROM(2054, hueApiKey, 46);
|
||||||
{
|
|
||||||
hueApiKey[i-2054] = EEPROM.read(i);
|
|
||||||
if (hueApiKey[i-2054] == 0) break;
|
|
||||||
}
|
|
||||||
huePollIntervalMs = ((EEPROM.read(2100) << 0) & 0xFF) + ((EEPROM.read(2101) << 8) & 0xFF00);
|
huePollIntervalMs = ((EEPROM.read(2100) << 0) & 0xFF) + ((EEPROM.read(2101) << 8) & 0xFF00);
|
||||||
notifyHue = EEPROM.read(2102);
|
notifyHue = EEPROM.read(2102);
|
||||||
hueApplyOnOff = EEPROM.read(2103);
|
hueApplyOnOff = EEPROM.read(2103);
|
||||||
@ -444,10 +399,7 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
countdownSec = EEPROM.read(2161);
|
countdownSec = EEPROM.read(2161);
|
||||||
setCountdown();
|
setCountdown();
|
||||||
|
|
||||||
for (int i = 2165; i < 2171; ++i)
|
readStringFromEEPROM(2165, cronixieDisplay, 6);
|
||||||
{
|
|
||||||
cronixieDisplay[i-2165] = EEPROM.read(i);
|
|
||||||
}
|
|
||||||
cronixieBacklight = EEPROM.read(2171);
|
cronixieBacklight = EEPROM.read(2171);
|
||||||
|
|
||||||
macroBoot = EEPROM.read(2175);
|
macroBoot = EEPROM.read(2175);
|
||||||
@ -485,21 +437,9 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
|
|
||||||
if (lastEEPROMversion > 8)
|
if (lastEEPROMversion > 8)
|
||||||
{
|
{
|
||||||
for (int i = 2300; i < 2333; ++i)
|
readStringFromEEPROM(2300, mqttServer, 32);
|
||||||
{
|
readStringFromEEPROM(2333, mqttDeviceTopic, 32);
|
||||||
mqttServer[i-2300] = EEPROM.read(i);
|
readStringFromEEPROM(2366, mqttGroupTopic, 32);
|
||||||
if (mqttServer[i-2300] == 0) break;
|
|
||||||
}
|
|
||||||
for (int i = 2333; i < 2366; ++i)
|
|
||||||
{
|
|
||||||
mqttDeviceTopic[i-2333] = EEPROM.read(i);
|
|
||||||
if (mqttDeviceTopic[i-2333] == 0) break;
|
|
||||||
}
|
|
||||||
for (int i = 2366; i < 2399; ++i)
|
|
||||||
{
|
|
||||||
mqttGroupTopic[i-2366] = EEPROM.read(i);
|
|
||||||
if (mqttGroupTopic[i-2366] == 0) break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveDirect = !EEPROM.read(2200);
|
receiveDirect = !EEPROM.read(2200);
|
||||||
@ -538,20 +478,13 @@ void loadSettingsFromEEPROM(bool first)
|
|||||||
currentTheme = EEPROM.read(948);
|
currentTheme = EEPROM.read(948);
|
||||||
for (int k=0;k<6;k++){
|
for (int k=0;k<6;k++){
|
||||||
int in=900+k*8;
|
int in=900+k*8;
|
||||||
for (int i=in; i < in+8; ++i)
|
readStringFromEEPROM(in, cssCol[k], 8);
|
||||||
{
|
}
|
||||||
if (EEPROM.read(i) == 0) break;
|
|
||||||
cssCol[k][i-in] =EEPROM.read(i);
|
|
||||||
}}
|
|
||||||
|
|
||||||
//custom macro memory (16 slots/ each 64byte)
|
//custom macro memory (16 slots/ each 64byte)
|
||||||
//1024-2047 reserved
|
//1024-2047 reserved
|
||||||
|
|
||||||
for (int i = 2220; i < 2255; ++i)
|
readStringFromEEPROM(2220, blynkApiKey, 35);
|
||||||
{
|
|
||||||
blynkApiKey[i-2220] = EEPROM.read(i);
|
|
||||||
if (blynkApiKey[i-2220] == 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//user MOD memory
|
//user MOD memory
|
||||||
//2944 - 3071 reserved
|
//2944 - 3071 reserved
|
||||||
|
@ -52,7 +52,8 @@ void wledInit()
|
|||||||
//start captive portal if AP active
|
//start captive portal if AP active
|
||||||
if (onlyAP || strlen(apSSID) > 0)
|
if (onlyAP || strlen(apSSID) > 0)
|
||||||
{
|
{
|
||||||
dnsServer.start(53, "*", WiFi.softAPIP());
|
dnsServer.setErrorReplyCode(DNSReplyCode::ServerFailure);
|
||||||
|
dnsServer.start(53, "wled.me", WiFi.softAPIP());
|
||||||
dnsActive = true;
|
dnsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,14 +39,6 @@ void initServer()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/generate_204", HTTP_GET, [](){
|
|
||||||
serveIndex();
|
|
||||||
});
|
|
||||||
|
|
||||||
server.on("/fwlink", HTTP_GET, [](){
|
|
||||||
serveIndex();
|
|
||||||
});
|
|
||||||
|
|
||||||
server.on("/sliders", HTTP_GET, serveIndex);
|
server.on("/sliders", HTTP_GET, serveIndex);
|
||||||
|
|
||||||
server.on("/welcome", HTTP_GET, [](){
|
server.on("/welcome", HTTP_GET, [](){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user