Browse Source

Fix LED logic in hardware configuration

fastled
Xose Pérez 8 years ago
parent
commit
f94d5ef927
2 changed files with 15 additions and 11 deletions
  1. +10
    -10
      code/src/config/hardware.h
  2. +5
    -1
      code/src/led.ino

+ 10
- 10
code/src/config/hardware.h View File

@ -26,8 +26,8 @@
#define DEVICE "LOLIN"
#define BUTTON1_PIN 0
#define RELAY1_PIN 12
#define LED1_PIN 2
#define LED1_PIN_INVERSE 0
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// Itead Studio boards
@ -40,7 +40,7 @@
#define BUTTON1_PIN 0
#define RELAY1_PIN 12
#define LED1_PIN 13
#define LED1_PIN_INVERSE 0
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_TH)
@ -49,7 +49,7 @@
#define BUTTON1_PIN 0
#define RELAY1_PIN 12
#define LED1_PIN 13
#define LED1_PIN_INVERSE 0
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_TOUCH)
@ -67,7 +67,7 @@
#define BUTTON1_PIN 0
#define RELAY1_PIN 12
#define LED1_PIN 15
#define LED1_PIN_INVERSE 1
#define LED1_PIN_INVERSE 0
#define ENABLE_POW 1
#elif defined(SONOFF_DUAL)
@ -76,7 +76,7 @@
#define DEVICE "SONOFF_DUAL"
#define BUTTON1_PIN 0
#define LED1_PIN 13
#define LED1_PIN_INVERSE 0
#define LED1_PIN_INVERSE 1
#undef SERIAL_BAUDRATE
#define SERIAL_BAUDRATE 19230
@ -111,7 +111,7 @@
#define BUTTON1_PIN 0
#define RELAY1_PIN 12
#define LED1_PIN 13
#define LED1_PIN_INVERSE 0
#define LED1_PIN_INVERSE 1
#elif defined(S20)
@ -120,7 +120,7 @@
#define BUTTON1_PIN 0
#define RELAY1_PIN 12
#define LED1_PIN 13
#define LED1_PIN_INVERSE 0
#define LED1_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// Electrodragon boards
@ -135,7 +135,7 @@
#define RELAY1_PIN 12
#define RELAY2_PIN 13
#define LED1_PIN 16
#define LED1_PIN_INVERSE 1
#define LED1_PIN_INVERSE 0
// -----------------------------------------------------------------------------
// WorkChoice ecoPlug
@ -148,7 +148,7 @@
#define BUTTON1_PIN 13
#define RELAY_PIN 15
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
#define LED1_PIN_INVERSE 0
// -----------------------------------------------------------------------------
// ESPurna board (still beta)


+ 5
- 1
code/src/led.ino View File

@ -70,7 +70,7 @@ void ledMQTTCallback(unsigned int type, const char * topic, const char * payload
// Get led ID
unsigned int ledID = topic[strlen(topic)-1] - '0';
if (ledID >= relayCount()) ledID = 0;
if (ledID >= ledCount()) ledID = 0;
// get value
unsigned int value = (char)payload[0] - '0';
@ -95,6 +95,10 @@ void ledMQTTCallback(unsigned int type, const char * topic, const char * payload
}
unsigned char ledCount() {
return _leds.size();
}
void ledConfigure() {
ledAuto = getSetting("ledAuto", String() + LED_AUTO).toInt() == 1;
}


Loading…
Cancel
Save