From ac084da5b660d7a76c39ac9f6aff481319395496 Mon Sep 17 00:00:00 2001 From: luc Date: Wed, 19 Aug 2015 16:07:11 +0800 Subject: [PATCH] Add compilation directive to disable CSS This will make pages lighter if no need fancy UI Save 5K per page --- esp8266/config.h | 3 +++ esp8266/webinterface.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/esp8266/config.h b/esp8266/config.h index 01acb39a..6d9ca1b3 100644 --- a/esp8266/config.h +++ b/esp8266/config.h @@ -27,6 +27,9 @@ //SSDD_FEATURE: this feature is a discovery protocol, supported on Windows out of the box #define SSDP_FEATURE +//USE_CSS_FEATURE: this feature allow to have fancy UI by adding css in page +#define USE_CSS_FEATURE + #define PROGMEM2CHAR progmem2char extern char * progmem2char(const char* src); diff --git a/esp8266/webinterface.cpp b/esp8266/webinterface.cpp index 841ffa5b..279a19fa 100644 --- a/esp8266/webinterface.cpp +++ b/esp8266/webinterface.cpp @@ -34,6 +34,7 @@ extern "C" { #include #endif const char CSS_START[] PROGMEM ="\n"; const char PAGE_HEAD_1[] PROGMEM = "\n\n\n\n" \ "\n"; @@ -440,6 +446,7 @@ bool WEBINTERFACE_CLASS::isIPValid(const char * IP) void add_css(String & buffer2send) { buffer2send+=PROGMEM2CHAR(CSS_START); + #ifdef USE_CSS_FEATURE buffer2send+=PROGMEM2CHAR(CSS_1); buffer2send+=PROGMEM2CHAR(CSS_2); buffer2send+=PROGMEM2CHAR(CSS_3); @@ -479,6 +486,11 @@ void add_css(String & buffer2send) buffer2send+=PROGMEM2CHAR(CSS_34); buffer2send+=PROGMEM2CHAR(CSS_35); buffer2send+=PROGMEM2CHAR(CSS_36); + #else + buffer2send+=PROGMEM2CHAR(CSS_1); + buffer2send+=PROGMEM2CHAR(CSS_2); + buffer2send+=PROGMEM2CHAR(CSS_3); + #endif buffer2send+=PROGMEM2CHAR(CSS_END); }