Add to possibility to use GPIO 1&3

On ESP01, Serial won't be available anymore
This commit is contained in:
Mathieu Maret 2016-03-04 01:02:11 +01:00
parent aec6e58fed
commit b9b8253adc
1 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,8 @@
/* "Flash Size" Menu. Use espota.py to upload OTA */
/* After passing in OTA mode, next boot will be in setup mode */
/* To Use GPIO 3 And 1, uncomment #define ENABLE_EXTRA_GPIO */
/* but Serial will be available on GPIO 15 and 13 */
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
@ -18,7 +20,11 @@
#include <ArduinoOTA.h>
#include <errno.h>
//#define ENABLE_EXTRA_GPIO
#define EEPROM_SIZE 512
char eeprom[EEPROM_SIZE];
#define BOOTMODE_SETUP 0
@ -279,7 +285,9 @@ void setup() {
Serial.swap(); //Switch Serial on GPIO 13 & 15
pinMode(3, INPUT_PULLUP);
int txStatus = digitalRead(3);
Serial.swap(); // Switch back
#ifndef ENABLE_EXTRA_GPIO
Serial.swap(); // Switch back on GPIO 1 & 3
#endif
EEPROM.begin(EEPROM_SIZE);
readEEPROM(mode, &confSsid, &confPassword, &confHost);