Nano AP fully power Control support

The idea to switch to an array based power Control was discarded for now
This commit is contained in:
atc1441
2023-06-07 01:00:40 +02:00
parent 8e31a1b8eb
commit 064bd4258c
4 changed files with 33 additions and 8 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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
}

View File

@@ -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: ");