From 210cd8df713592241a1addb6daf6c0769b1417d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 28 Jun 2018 14:05:38 +0200 Subject: [PATCH] Option to disable LED support --- code/espurna/config/general.h | 8 ++++++++ code/espurna/config/hardware.h | 1 + code/espurna/espurna.ino | 6 ++++-- code/espurna/led.ino | 4 ++++ code/espurna/relay.ino | 4 +++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 26722487..8c10f7c7 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -217,6 +217,14 @@ #define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click #endif +//------------------------------------------------------------------------------ +// LED +//------------------------------------------------------------------------------ + +#ifndef LED_SUPPORT +#define LED_SUPPORT 1 +#endif + //------------------------------------------------------------------------------ // RELAY //------------------------------------------------------------------------------ diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index ae7affd4..c200cc77 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -52,6 +52,7 @@ //#define DEBUG_SERIAL_SUPPORT 0 //#define DEBUG_TELNET_SUPPORT 0 //#define DEBUG_WEB_SUPPORT 0 + //#define LED_SUPPORT 0 //#define TELNET_SUPPORT 0 //#define TERMINAL_SUPPORT 0 diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index def70f6b..852055da 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -49,7 +49,7 @@ void setup() { // Init EEPROM eepromSetup(); - + // Init Serial, SPIFFS and system check systemSetup(); @@ -100,7 +100,9 @@ void setup() { relaySetup(); buttonSetup(); - ledSetup(); + #if LED_SUPPORT + ledSetup(); + #endif #if MQTT_SUPPORT mqttSetup(); #endif diff --git a/code/espurna/led.ino b/code/espurna/led.ino index 06fac792..f71aa31b 100644 --- a/code/espurna/led.ino +++ b/code/espurna/led.ino @@ -10,6 +10,8 @@ Copyright (C) 2016-2018 by Xose PĂ©rez // LED // ----------------------------------------------------------------------------- +#if LED_SUPPORT + typedef struct { unsigned char pin; bool reverse; @@ -290,3 +292,5 @@ void ledLoop() { _led_update = false; } + +#endif LED_SUPPORT diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index 1c361a60..f738187e 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -194,7 +194,9 @@ void _relayProcess(bool mode) { #endif // Flag relay-based LEDs to update status - ledUpdate(true); + #if LED_SUPPORT + ledUpdate(true); + #endif _relays[id].report = false; _relays[id].group_report = false;