Browse Source

Support for hardware inching button

fastled
Xose Pérez 8 years ago
parent
commit
9e00de6b6f
3 changed files with 20 additions and 0 deletions
  1. +13
    -0
      code/src/button.ino
  2. +2
    -0
      code/src/config/hardware.h
  3. +5
    -0
      code/src/web.ino

+ 13
- 0
code/src/button.ino View File

@ -77,6 +77,10 @@ void buttonSetup() {
_buttons.push_back(new DebounceEvent(BUTTON4_PIN)); _buttons.push_back(new DebounceEvent(BUTTON4_PIN));
#endif #endif
#ifdef ITEAD_1CH_INCHING
pinMode(LED_INCHING, OUTPUT);
#endif
DEBUG_MSG("[BUTTON] Number of buttons: %d\n", _buttons.size()); DEBUG_MSG("[BUTTON] Number of buttons: %d\n", _buttons.size());
} }
@ -91,6 +95,15 @@ void buttonLoop() {
if (event == EVENT_DOUBLE_CLICK) createAP(); if (event == EVENT_DOUBLE_CLICK) createAP();
if (event == EVENT_LONG_CLICK) ESP.reset(); if (event == EVENT_LONG_CLICK) ESP.reset();
} }
#ifdef ITEAD_1CH_INCHING
if (i == 1) {
byte relayInch = getSetting("relayInch", String(RELAY_INCHING)).toInt();
relayInch = (relayInch == RELAY_INCHING_NONE) ? RELAY_INCHING_OFF : RELAY_INCHING_NONE;
setSetting("relayInch", String(relayInch));
digitalWrite(LED_INCHING, relayInch != RELAY_INCHING_NONE);
continue;
}
#endif
if (event == EVENT_SINGLE_CLICK) relayToggle(i); if (event == EVENT_SINGLE_CLICK) relayToggle(i);
} }
} }


+ 2
- 0
code/src/config/hardware.h View File

@ -118,9 +118,11 @@
#define MANUFACTURER "ITEAD" #define MANUFACTURER "ITEAD"
#define DEVICE "1CH_INCHING" #define DEVICE "1CH_INCHING"
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON2_PIN 9
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define LED_PIN 13 #define LED_PIN 13
#define LED_PIN_INVERSE 0 #define LED_PIN_INVERSE 0
#define LED_INCHING 5
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Electrodragon boards // Electrodragon boards


+ 5
- 0
code/src/web.ino View File

@ -184,6 +184,11 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
setCurrentRatio(getSetting("emonRatio").toFloat()); setCurrentRatio(getSetting("emonRatio").toFloat());
#endif #endif
#if ITEAD_1CH_INCHING
byte relayInch = getSetting("relayInch", String(RELAY_INCHING)).toInt();
digitalWrite(LED_INCHING, relayInch != RELAY_INCHING_NONE);
#endif
// Check if we should reconfigure MQTT connection // Check if we should reconfigure MQTT connection
if (dirtyMQTT) { if (dirtyMQTT) {
mqttDisconnect(); mqttDisconnect();


Loading…
Cancel
Save