How do I factory reset a ESP8266MOD
GPIO0 on the ESP8266 is used to invoke the bootloader at startup.
Have a look here: https://github.com/espressif/esptool/wiki/ESP8266-Boot-Mode-Selection
GPIO0 = LOW means serial bootloader mode is active. That is to say, if GPIO0 reads low at power on / reset, it runs the serial bootloader out of ROM.