diff --git a/ESP32_AP-Flasher/platformio.ini b/ESP32_AP-Flasher/platformio.ini index dfc019d1..7c3952a4 100644 --- a/ESP32_AP-Flasher/platformio.ini +++ b/ESP32_AP-Flasher/platformio.ini @@ -85,7 +85,7 @@ build_unflags = build_flags = -D BUILD_ENV_NAME=$PIOENV -D BUILD_TIME=$UNIX_TIME - -D OPENEPAPERLINK_MINI_AP_PCB + -D OPENEPAPERLINK_NANO_AP_PCB -D ARDUINO_USB_MODE=0 -D CONFIG_SPIRAM_USE_MALLOC=1 -D CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y @@ -100,10 +100,10 @@ build_flags = -D FLASHER_AP_MOSI=39 -D FLASHER_AP_MISO=33 -D FLASHER_AP_RESET=37 - -D FLASHER_AP_POWER=-1 ;18 - ;-D FLASHER_AP_POWER2=21 - ;-D FLASHER_AP_POWER3=16 - ;-D FLASHER_AP_POWER4=17 + -D FLASHER_AP_POWER=18 + -D FLASHER_AP_POWER2=21 + -D FLASHER_AP_POWER3=16 + -D FLASHER_AP_POWER4=17 -D FLASHER_AP_TXD=35 -D FLASHER_AP_RXD=36 -D FLASHER_AP_TEST=34 diff --git a/ESP32_AP-Flasher/src/main.cpp b/ESP32_AP-Flasher/src/main.cpp index fa3860bb..49b9ba67 100644 --- a/ESP32_AP-Flasher/src/main.cpp +++ b/ESP32_AP-Flasher/src/main.cpp @@ -51,7 +51,7 @@ void setup() { showColorPattern(CRGB::Aqua, CRGB::Green, CRGB::Blue); #endif -#ifdef OPENEPAPERLINK_MINI_AP_PCB +#if defined(OPENEPAPERLINK_MINI_AP_PCB) || defined(OPENEPAPERLINK_NANO_AP_PCB) APEnterEarlyReset(); // this allows us to view the booting process. After the device showing up, you have 3 seconds to open a terminal on the COM port vTaskDelay(3000 / portTICK_PERIOD_MS); diff --git a/ESP32_AP-Flasher/src/powermgt.cpp b/ESP32_AP-Flasher/src/powermgt.cpp index 1148616a..0ca53654 100644 --- a/ESP32_AP-Flasher/src/powermgt.cpp +++ b/ESP32_AP-Flasher/src/powermgt.cpp @@ -22,6 +22,25 @@ void simpleAPPower(bool state) { } #endif +#ifdef OPENEPAPERLINK_NANO_AP_PCB +void simpleAPPower(bool state) { + if (FLASHER_AP_POWER >= 0 && FLASHER_AP_POWER2 >= 0 && FLASHER_AP_POWER3 >= 0 && FLASHER_AP_POWER4 >= 0) { + pinMode(FLASHER_AP_POWER, INPUT); + pinMode(FLASHER_AP_POWER2, INPUT); + pinMode(FLASHER_AP_POWER3, INPUT); + pinMode(FLASHER_AP_POWER4, INPUT); + digitalWrite(FLASHER_AP_POWER, state); + digitalWrite(FLASHER_AP_POWER2, state); + digitalWrite(FLASHER_AP_POWER3, state); + digitalWrite(FLASHER_AP_POWER4, state); + pinMode(FLASHER_AP_POWER, OUTPUT); + pinMode(FLASHER_AP_POWER2, OUTPUT); + pinMode(FLASHER_AP_POWER3, OUTPUT); + pinMode(FLASHER_AP_POWER4, OUTPUT); + } +} +#endif + // On the OpenEPaperLink board, there is no in-rush current limiting. The tags that can be connected to the board can have significant capacity, which, // when drained if the board applies power, will cause the 3v3 rail to sag enough to reset the ESP32. This is obviously not great. To prevent this from happening, // we ramp up/down the voltage with PWM. Ramping down really is unnecessary, as the board has a resistor to dump the charge into. @@ -57,4 +76,9 @@ void rampTagPower(uint8_t pin, bool up) { delay(500); simpleAPPower(up); #endif +#ifdef OPENEPAPERLINK_NANO_AP_PCB + simpleAPPower(false); + delay(500); + simpleAPPower(up); +#endif } \ No newline at end of file diff --git a/ESP32_AP-Flasher/src/web.cpp b/ESP32_AP-Flasher/src/web.cpp index fc2dc5df..fbef07cf 100644 --- a/ESP32_AP-Flasher/src/web.cpp +++ b/ESP32_AP-Flasher/src/web.cpp @@ -228,15 +228,16 @@ void init_web() { WiFiManager wm; bool res; -#ifdef OPENEPAPERLINK_MINI_AP_PCB +#if defined(OPENEPAPERLINK_MINI_AP_PCB) || defined(OPENEPAPERLINK_NANO_AP_PCB) WiFi.setTxPower(WIFI_POWER_15dBm); #endif + wm.setWiFiAutoReconnect(true); res = wm.autoConnect("OpenEPaperLink Setup"); if (!res) { Serial.println("Failed to connect"); ESP.restart(); } -#ifdef OPENEPAPERLINK_MINI_AP_PCB +#if defined(OPENEPAPERLINK_MINI_AP_PCB) || defined(OPENEPAPERLINK_NANO_AP_PCB) WiFi.setTxPower(WIFI_POWER_19_5dBm); #endif Serial.print("Connected! IP address: ");