homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 308 forks source link

wemos d1-mini: cannot get in configuration mode #71

Closed gtom closed 8 years ago

gtom commented 8 years ago

Hi, I did a misconfiguration in mqtt credentials, now my d1-mini is trying endless to connect to wrong server. I have a reset button on d1-mini, but after pressing it for 5 seconds, it always reboots into normal mode and tries to connect again. Top get into configuration mode, I have to press FLASH button, which doesn't exist on d1-mini. What can I do to get into configuration mode? Any way to reset the eeprom-file-system during flashing homie again? Thanks in advance Tom

marvinroger commented 8 years ago

Just format the file system once:

#include "FS.h"

void setup() {
  Serial.begin(115200);
  Serial.println("");
  Serial.println("Mounting FS...");

  if (!SPIFFS.begin()) {
    Serial.println("Failed to mount file system");
    return;
  }

  SPIFFS.format();
  Serial.println("Done.");
}

void loop() { }

If you want, you can also change the reset button pin (you might add an external button): https://github.com/marvinroger/homie-esp8266/blob/master/docs/3.-Advanced-usage.md#reset

TommySharpNZ commented 8 years ago

It would be great to work out how to make the onboard button work on the Wemos D1 mini so that we can press it for 5 seconds to get into configuration mode.

DavidStacer commented 8 years ago

The button on the D1-mini is tied directly to reset on the Esp8266 so I don't think its possible to capture that. The Wemos button Shield ties pin D3 GPIO0 to GND. If you don't have the button shield, you could emulate that with a simple jumper from D3 on the D1-mini to GND for 5 seconds.

The Wemos schematics can be found here

TommySharpNZ commented 8 years ago

What do we need to do in our sketches to make D3 on the D1-mini become the reset button?

DavidStacer commented 8 years ago

D3 on the D1-mini is already connected to GPIO0 on the ESP-12 and GPIO0 is the default for Homie, so you shouldn't have to do anything in the code. Just hold D3 to GND for 5+ seconds.

I did run into a problem where the D1 always wanted to go into config mode. documented here .

marvinroger commented 8 years ago

Sorry guys, as @DavidStacer explained, the D1 mini button is tied to the reset, so there is no way to intercept the signal.