Added defines for more granular feature disable control

pull/68/head
cschwinne 2018-11-01 15:36:13 +01:00
rodzic 48c165b0b4
commit 5e6b1e8175
12 zmienionych plików z 105 dodań i 53 usunięć

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -24,7 +24,7 @@ button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-seri
//new user welcome page
#ifndef WLED_FLASH_512K_MODE
#ifndef WLED_DISABLE_MOBILE_UI
const char PAGE_welcome0[] PROGMEM = R"=====(
<!DOCTYPE html>
<html><head>

Wyświetl plik

@ -12,16 +12,17 @@
//ESP8266-01 (black) has 1MB flash and can thus fit the whole program. Use 1M(64K SPIFFS).
//If you want the OTA update function though, you need to make sure the sketch is smaller than 479kB.
//Uncomment some of the following lines to disable features to compile for ESP8266-01 (max flash size 434kB):
//Uncomment the following lines to disable some features to compile for ESP8266-01 (max flash size 438kB):
//You are required to disable these two features:
//#define WLED_DISABLE_MOBILE_UI
//#define WLED_DISABLE_OTA
//You need to choose 1-2 of these features to disable:
//#define WLED_DISABLE_ALEXA
//#define WLED_DISABLE_BLYNK
//#define WLED_DISABLE_CRONIXIE
//#define WLED_DISABLE_HUESYNC
//#define WLED_DISABLE_MOBILE_UI
//#define WLED_DISABLE_OTA
//to toggle usb serial debug (un)comment following line(s)
//#define DEBUG
@ -41,14 +42,18 @@
#endif
#include <EEPROM.h>
#include <ArduinoOTA.h>
#include <WiFiUDP.h>
#include <DNSServer.h>
#ifndef WLED_DISABLE_OTA
#include <ArduinoOTA.h>
#include "src/dependencies/webserver/ESP8266HTTPUpdateServer.h"
#endif
#include "src/dependencies/time/Time.h"
#include "src/dependencies/time/TimeLib.h"
#include "src/dependencies/timezone/Timezone.h"
#ifndef WLED_DISABLE_BLYNK
#include "src/dependencies/blynk/BlynkSimpleEsp.h"
#endif
#include "src/dependencies/e131/E131.h"
#include "src/dependencies/pubsubclient/PubSubClient.h"
#include "htmls00.h"
@ -58,7 +63,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1810311
#define VERSION 1811011
char versionString[] = "0.8.1";
@ -384,7 +389,9 @@ HTTPClient* hueClient = NULL;
WiFiClient* mqttTCPClient = NULL;
PubSubClient* mqtt = NULL;
#ifndef WLED_DISABLE_OTA
ESP8266HTTPUpdateServer httpUpdater;
#endif
//udp interface objects
WiFiUDP notifierUdp, rgbUdp;
@ -500,7 +507,9 @@ void loop() {
if (!realtimeActive) //block stuff if WARLS/Adalight is enabled
{
if (dnsActive) dnsServer.processNextRequest();
#ifndef WLED_DISABLE_OTA
if (aOtaEnabled) ArduinoOTA.handle();
#endif
handleNightlight();
if (!onlyAP) {
handleHue();

Wyświetl plik

@ -446,7 +446,7 @@ void loadSettingsFromEEPROM(bool first)
enableRealtimeUI = EEPROM.read(2201);
uiConfiguration = EEPROM.read(2202);
#ifdef WLED_FLASH_512K_MODE
#ifdef WLED_DISABLE_MOBILE_UI
uiConfiguration = 1;
//force default UI since mobile is unavailable
#endif

Wyświetl plik

@ -86,6 +86,7 @@ void wledInit()
//init ArduinoOTA
if (!onlyAP) {
#ifndef WLED_DISABLE_OTA
if (aOtaEnabled)
{
ArduinoOTA.onStart([]() {
@ -97,6 +98,7 @@ void wledInit()
if (strlen(cmDNS) > 0) ArduinoOTA.setHostname(cmDNS);
ArduinoOTA.begin();
}
#endif
if (!initLedsLast) strip.service();
// Set up mDNS responder:
@ -225,6 +227,25 @@ void getBuildInfo()
oappendi(VERSION);
oappend("\r\neepver: ");
oappendi(EEPVER);
oappend("\r\nopt: ");
#ifndef WLED_DISABLE_ALEXA
oappend("alexa ");
#endif
#ifndef WLED_DISABLE_BLYNK
oappend("blynk ");
#endif
#ifndef WLED_DISABLE_CRONIXIE
oappend("cronixie ");
#endif
#ifndef WLED_DISABLE_HUESYNC
oappend("huesync ");
#endif
#ifndef WLED_DISABLE_MOBILE_UI
oappend("mobile-ui ");
#endif
#ifndef WLED_DISABLE_OTA
oappend("ota");
#endif
#ifdef USEFS
oappend("\r\nspiffs: true\r\n");
#else

Wyświetl plik

@ -184,7 +184,7 @@ void _overlayAnalogClock()
void _overlayNixieClock()
{
#ifdef WLED_FLASH_512K_MODE
#ifdef WLED_DISABLE_CRONIXIE
if (countdownMode) checkCountdown();
#else

Wyświetl plik

@ -5,7 +5,13 @@
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
* https://github.com/probonopd/ESP8266HueEmulator
*/
void prepareIds() {
escapedMac = WiFi.macAddress();
escapedMac.replace(":", "");
escapedMac.toLowerCase();
}
#ifndef WLED_DISABLE_ALEXA
void alexaInit()
{
if (alexaEnabled && WiFi.status() == WL_CONNECTED)
@ -87,12 +93,6 @@ void alexaDim(byte briL)
handleSet(ct);
}
void prepareIds() {
escapedMac = WiFi.macAddress();
escapedMac.replace(":", "");
escapedMac.toLowerCase();
}
void respondToSearch() {
DEBUG_PRINTLN("");
DEBUG_PRINT("Send resp to ");
@ -288,3 +288,9 @@ bool connectUDP(){
return state;
}
#else
void alexaInit(){}
void handleAlexa(){}
void alexaInitPages(){}
bool handleAlexaApiCall(String req, String body){return false;}
#endif

Wyświetl plik

@ -19,7 +19,7 @@ byte getSameCodeLength(char code, int index, char const cronixieDisplay[])
void setCronixie()
{
#ifndef WLED_FLASH_512K_MODE
#ifndef WLED_DISABLE_CRONIXIE
/*
* digit purpose index
* 0-9 | 0-9 (incl. random)
@ -146,7 +146,7 @@ void setCronixie()
void _overlayCronixie()
{
if (countdownMode) checkCountdown();
#ifndef WLED_FLASH_512K_MODE
#ifndef WLED_DISABLE_CRONIXIE
byte h = hour(local);
byte h0 = h;
@ -214,4 +214,3 @@ void _overlayCronixie()
//strip.trigger(); //this has a drawback, no effects slower than RefreshMs. advantage: Quick update, not dependant on effect time
#endif
}

Wyświetl plik

@ -1,6 +1,27 @@
/*
* Color conversion methods
*/
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
{
float h = ((float)hue)/65535.0;
float s = ((float)sat)/255.0;
byte i = floor(h*6);
float f = h * 6-i;
float p = 255 * (1-s);
float q = 255 * (1-f*s);
float t = 255 * (1-(1-f)*s);
switch (i%6) {
case 0: rgb[0]=255,rgb[1]=t,rgb[2]=p;break;
case 1: rgb[0]=q,rgb[1]=255,rgb[2]=p;break;
case 2: rgb[0]=p,rgb[1]=255,rgb[2]=t;break;
case 3: rgb[0]=p,rgb[1]=q,rgb[2]=255;break;
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
}
}
#ifndef WLED_DISABLE_HUESYNC
void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
{
//this is only an approximation using WS2812B with gamma correction enabled
@ -31,25 +52,6 @@ void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
}
}
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
{
float h = ((float)hue)/65535.0;
float s = ((float)sat)/255.0;
byte i = floor(h*6);
float f = h * 6-i;
float p = 255 * (1-s);
float q = 255 * (1-f*s);
float t = 255 * (1-(1-f)*s);
switch (i%6) {
case 0: rgb[0]=255,rgb[1]=t,rgb[2]=p;break;
case 1: rgb[0]=q,rgb[1]=255,rgb[2]=p;break;
case 2: rgb[0]=p,rgb[1]=255,rgb[2]=t;break;
case 3: rgb[0]=p,rgb[1]=q,rgb[2]=255;break;
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
}
}
void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
{
float z = 1.0f - x - y;
@ -106,6 +108,16 @@ void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www
rgb[2] = 255.0*b;
}
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
{
float X = rgb[0] * 0.664511f + rgb[1] * 0.154324f + rgb[2] * 0.162028f;
float Y = rgb[0] * 0.283881f + rgb[1] * 0.668433f + rgb[2] * 0.047685f;
float Z = rgb[0] * 0.000088f + rgb[1] * 0.072310f + rgb[2] * 0.986039f;
xy[0] = X / (X + Y + Z);
xy[1] = Y / (X + Y + Z);
}
#endif
void colorFromDecOrHexString(byte* rgb, byte* wht, char* in)
{
if (in[0] == 0) return;
@ -126,15 +138,6 @@ void colorFromDecOrHexString(byte* rgb, byte* wht, char* in)
rgb[2] = c & 0xFF;
}
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
{
float X = rgb[0] * 0.664511f + rgb[1] * 0.154324f + rgb[2] * 0.162028f;
float Y = rgb[0] * 0.283881f + rgb[1] * 0.668433f + rgb[2] * 0.047685f;
float Z = rgb[0] * 0.000088f + rgb[1] * 0.072310f + rgb[2] * 0.986039f;
xy[0] = X / (X + Y + Z);
xy[1] = Y / (X + Y + Z);
}
float minf (float v, float w)
{
if (w > v) return v;
@ -155,4 +158,3 @@ void colorRGBtoRGBW(byte* rgb, byte* wht) //rgb to rgbw (http://codewelt.com/rgb
float sat = 255.0f * ((high - low) / high);
*wht = (byte)((255.0f - sat) / 255.0f * (rgb[0] + rgb[1] + rgb[2]) / 3);
}

Wyświetl plik

@ -1,7 +1,7 @@
/*
* Sync to Philips hue lights
*/
#ifndef WLED_DISABLE_HUESYNC
void handleHue()
{
if (huePollingEnabled && WiFi.status() == WL_CONNECTED && hueClient != NULL)
@ -206,4 +206,7 @@ String getJsonValue(String* req, String key)
}
return "";
}
#else
void handleHue(){}
bool setupHue(){return false;}
#endif

Wyświetl plik

@ -7,19 +7,24 @@ byte blSat = 255;
void initBlynk(const char* auth)
{
#ifndef WLED_DISABLE_BLYNK
if (WiFi.status() != WL_CONNECTED) return;
blynkEnabled = (auth[0] != 0);
if (blynkEnabled) Blynk.config(auth);
#endif
}
void handleBlynk()
{
#ifndef WLED_DISABLE_BLYNK
if (WiFi.status() == WL_CONNECTED && blynkEnabled)
Blynk.run();
#endif
}
void updateBlynk()
{
#ifndef WLED_DISABLE_BLYNK
if (onlyAP) return;
Blynk.virtualWrite(V0, bri);
//we need a RGB -> HSB convert here
@ -29,8 +34,10 @@ void updateBlynk()
Blynk.virtualWrite(V6, effectIntensity);
Blynk.virtualWrite(V7, nightlightActive);
Blynk.virtualWrite(V8, notifyDirect);
#endif
}
#ifndef WLED_DISABLE_BLYNK
BLYNK_WRITE(V0)
{
bri = param.asInt();//bri
@ -86,4 +93,4 @@ BLYNK_WRITE(V8)
{
notifyDirect = (param.asInt()>0); //send notifications
}
#endif

Wyświetl plik

@ -132,7 +132,13 @@ void initServer()
server.on("/list", HTTP_GET, handleFileList);
#endif
//init ota page
#ifndef WLED_DISABLE_OTA
httpUpdater.setup(&server);
#else
server.on("/update", HTTP_GET, [](){
serveMessage(500, "Not implemented", "OTA updates are not supported in this build.", 254);
});
#endif
} else
{
server.on("/edit", HTTP_GET, [](){
@ -311,7 +317,7 @@ void serveSettings(byte subPage)
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec 255: welcomepage
if (!realtimeActive || enableRealtimeUI) //do not serve while receiving realtime
{
#ifdef WLED_FLASH_512K_MODE //disable welcome page if not enough storage
#ifdef WLED_DISABLE_MOBILE_UI //disable welcome page if not enough storage
if (subPage == 255) {serveIndex(); return;}
#endif
@ -363,4 +369,3 @@ void serveSettings(byte subPage)
serveRealtimeError(true);
}
}