xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.99k stars 636 forks source link

Adding the button to a Wemos D1 mini relay #239

Closed xoseperez closed 6 years ago

xoseperez commented 7 years ago

Originally reported by: P.B. (Bitbucket: PieBru, GitHub: PieBru)


Hi, I point out this silly note as it might ease the life of newbies like me.

The Wemos D1 Mini relay is a very handy dev platform to test espurna before flashing on less accessible devices, at least because you don't have to press buttons to flash it and there is a handy hardware reset button.

The D1 doesn't came with an equivalent of the Sonoff button, but it's easy to add it by connecting a pushbutton between GND and D3 (GPIO0), like I did in the attached picture.

In Espurna 1.9.5 you must esplicitely enable it for the Wemos, but leaving it enabled without having connected the button doesn't give problems, so IMO this may be added permanently.

Add in hardware.h inside #elif defined(WEMOS_D1_MINI_RELAYSHIELD)

#!arduino
    // 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

Add in hardware.ino inside #elif defined(WEMOS_D1_MINI_RELAYSHIELD)

#!arduino
        setSetting("btnGPIO", 1, 0);
        setSetting("btnRelay", 1, 1);

Cheers. Piero

xoseperez commented 6 years ago

Removing milestone: 1.9.6 (automated comment)

xoseperez commented 6 years ago

Released with 1.9.6

xoseperez commented 6 years ago

Pushed with 8dacb87. Now of dev, will be released soon.

xoseperez commented 7 years ago

I agree. Will add it to the next release.