From 8dacb87fde83dd6a7dd3922ea51e796c5cf16f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Tue, 17 Oct 2017 11:28:21 +0200 Subject: [PATCH] Adding a button to wemos d1 mini boards (#239) --- code/espurna/config/hardware.h | 13 ++++++++++++- code/espurna/hardware.ino | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 947b4e31..03406e76 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -49,7 +49,11 @@ #define DEVICE "D1_MINI_RELAYSHIELD" // Buttons - // No buttons on the D1 MINI + // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems + #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND, + // it's the same as using a Wemos one button shield + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 // Relays #define RELAY1_PIN 5 @@ -59,6 +63,13 @@ #define LED1_PIN 2 #define LED1_PIN_INVERSE 1 + // Buttons + // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems + #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND, + // it's the same as using a Wemos one button shield + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + // ----------------------------------------------------------------------------- // ESPurna // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index a789f4f8..05d6e4d2 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -33,6 +33,8 @@ void hwUpwardsCompatibility() { setSetting("board", 3); setSetting("ledGPIO", 1, 2); setSetting("ledLogic", 1, 1); + setSetting("btnGPIO", 1, 0); + setSetting("btnRelay", 1, 1); setSetting("relayGPIO", 1, 5); setSetting("relayType", 1, RELAY_TYPE_NORMAL);