From 46545bfb5d0a5587a049f16b7eebb5ee1062fc8b Mon Sep 17 00:00:00 2001 From: Torsten Stauder Date: Sun, 27 Dec 2020 23:11:25 +0100 Subject: [PATCH] Shortened MQTT-conn-timeout + added PSRAM-flag to A1S --- PCBs/Wemos Lolin D32/README.md | 10 +++++----- PCBs/Wemos Lolin32/README.md | 8 ++++---- platformio.ini | 4 +++- src/main.cpp | 4 +--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/PCBs/Wemos Lolin D32/README.md b/PCBs/Wemos Lolin D32/README.md index 79f133c..e4031ca 100644 --- a/PCBs/Wemos Lolin D32/README.md +++ b/PCBs/Wemos Lolin D32/README.md @@ -2,13 +2,13 @@ ## Attention * In rev1 I made a mistake that leads to a short circuit. Hopefully nobody ordered it :-( Current revision is 1.1 -* This PCB is not yet tested! +* This PCB is not yet tested! Please tell me when you've been testing it successfully. ## Features * Fits Wemos Lolin D32 (not Lolin32, Lolin D32 pro or Lolin 32 lite!) * Outer diameter: 53 x 81mm * JST-PH 2.0-connectors for buttons, rotary encoder, Neopixel, RFID and reset (not 2.54mm pitch!) -* 2.54mm-connectors for MAX98357a and uSD-card-reader +* 2.54mm-connectors for MAX98357a and uSD-card-reader. In contrast to my pictures: better solder them directly onto the PCB without having a female-connector (as socket) in between. In turned out that especially plugging MAX98357a into a female connector can lead to connectivity-issues! * Mosfet-circuit that switches off MAX98357a, Neopixel, headphone-pcb and uSD-card-reader automatically when deepsleep is active * All peripherals are solely driven at 3.3V! Keep this especially in mind when choosing uSD-reader. If in doubts use one without voltage-regulator (link below). * If [headphone-pcb](https://github.com/biologist79/Tonuino-ESP32-I2S/tree/master/PCBs/Headphone%20with%20PCM5102a%20and%20TDA1308) is used, MAX98357a is automatically muted when there's a headphone plugged in and vice versa. @@ -17,10 +17,10 @@ ## Prerequisites * If no [headphone-pcb](https://github.com/biologist79/Tonuino-ESP32-I2S/tree/master/PCBs/Headphone%20with%20PCM5102a%20and%20TDA1308) is connected, make sure `HEADPHONE_ADJUST_ENABLE` is not active. -* Make sure to edit `settings.h` according your needs. +* Make sure to edit `settings.h` (HAL=3) and `settings-lolin_d32.h` according your needs. ## Things to mention -* Better don't solder Lolin D32 directly to the PCB. I recommend to make use of female connectors instead (link below). +* Better don't solder Lolin D32 directly to the PCB. I recommend to make use of female connectors (as socket) instead (link below). * When ordering a LiPo-battery, make sure to use [one](https://www.eremit.de/p/eremit-3-7v-2500mah-lipo-104050-jst-ph-2-0mm) with deep discharge protection! This is really really really important!!! * Doesn't (currently) support SD-MMC and RFID-reader PN5180 @@ -50,7 +50,7 @@ The heart of my project is an ESP32 on a [Wemos Lolin D32 development-board](htt * 4x JST-PH2.0-connector (2 Pins) * 3x JST-PH2.0-connector (3 Pins) * 1x JST-PH2.0-connector (5 Pins) -* Female connector as socket for Lolin32, uSD-reader and MAX98357a +* Female connector as socket for Lolin32 * (optional for headphone-PCB) 1x IDC-connecor female (6pin) * (optional for headphone-PCB) 1x IDC-connecor male (6pin) diff --git a/PCBs/Wemos Lolin32/README.md b/PCBs/Wemos Lolin32/README.md index c2c1c84..4ec32b7 100644 --- a/PCBs/Wemos Lolin32/README.md +++ b/PCBs/Wemos Lolin32/README.md @@ -7,7 +7,7 @@ After I've been asked many times to provide a PCB, I finally did so :-) It makes * Fits Wemos Lolin32 (not Lolin D32, Lolin D32 pro or Lolin 32 lite!) * Outer diameter: 56 x 93mm * JST-PH 2.0-connectors for buttons, rotary encoder, Neopixel, RFID, reset and battery (not 2.54mm pitch!) -* 2.54mm-connectors for MAX98357a and uSD-card-reader +* 2.54mm-connectors for MAX98357a and uSD-card-reader. In contrast to my pictures: better solder them directly onto the PCB without having a female-connector (as socket) in between. In turned out that especially plugging MAX98357a into a female connector can lead to connectivity-issues! * Mosfet-circuit that switches off MAX98357a, Neopixel, headphone-pcb and uSD-card-reader automatically when deepsleep is active * All peripherals are solely driven at 3.3V! Keep this especially in mind when choosing uSD-reader. If in doubts use one without voltage-regulator (link below). * If [headphone-pcb](https://github.com/biologist79/Tonuino-ESP32-I2S/tree/master/PCBs/Headphone%20with%20PCM5102a%20and%20TDA1308) is used, MAX98357a is automatically muted when there's a headphone plugged in and vice versa. @@ -17,12 +17,12 @@ After I've been asked many times to provide a PCB, I finally did so :-) It makes ## Prerequisites * If no [headphone-pcb](https://github.com/biologist79/Tonuino-ESP32-I2S/tree/master/PCBs/Headphone%20with%20PCM5102a%20and%20TDA1308) is connected, make sure `HEADPHONE_ADJUST_ENABLE` is not active. * I used 390/130 kOhms-resistors as voltage-divider. However, make sure to use a multimeter to determine their exact values in order to achieve a better battery-measurement. They can be configured in `settings-lolin32.h` as `rdiv1` and `rdiv2`. Hint: for Lolin D32's battery-measurement 100k+100k were used. However, I decided to change the ratio from 50/50% to 25/75% to have a "better" signal. 100/100 might be work as well; didn't test it. -* Make sure to edit `settings.h` according your needs. +* Make sure to edit `settings.h` (HAL=1) and `settings-lolin32.h` according your needs. ## Things to mention * RFID: In order to avoid buying a 6pin-JST-PH-connector I used 2x3pin instead. This is because I already had ten of them (see link below). * In contrast to Lolin D32, Lolin32 doesn't feature an integrated voltage-divider. That's why on the lower left there's a JST-PH2.0-connector to connect the LiPo-battery. Make sure to connect (+) to the left und GND to the right. From there you need to solder two short wires (5cm or so) onto the pcb with a JST-PH2.0-connector attached on the other side. This one needs to be plugged into Lolin32 (see pictures-folder). Please note: Lolin's JST-PH2.0-connector needs (+) left side and GND right side. Don't be confused if black/red-colouring of the JST-wires used seems "weird" because is reversed (black => (+); red => GND). -* Better don't solder Lolin32 directly to the PCB. I recommend to make use of female connectors instead (link below). +* Better don't solder Lolin32 directly to the PCB. I recommend to make use of female connectors (as socket) instead (link below). * When ordering a LiPo-battery, make sure to use [one](https://www.eremit.de/p/eremit-3-7v-2500mah-lipo-104050-jst-ph-2-0mm) with deep discharge protection! This is really really really important!!! * Doesn't (currently) support SD-MMC and RFID-reader PN5180 @@ -55,7 +55,7 @@ The heart of my project is an ESP32 on a [Wemos Lolin32 development-board](https * 5x JST-PH2.0-connector (2 Pins) * 3x JST-PH2.0-connector (3 Pins) * 1x JST-PH2.0-connector (5 Pins) -* Female connector as socket for Lolin32, uSD-reader and MAX98357a +* Female connector as socket for Lolin32 * (optional for headphone-PCB) 1x IDC-connecor female (6pin) * (optional for headphone-PCB) 1x IDC-connecor male (6pin) * rev2: (optional) 1x 10 uF capacitor (2.0mm-pitch) diff --git a/platformio.ini b/platformio.ini index 6f6a504..248ee22 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,6 +37,8 @@ framework = arduino monitor_speed = 115200 board_build.partitions = no_ota.csv build_flags = -DHAL=2 + -DBOARD_HAS_PSRAM + -mfix-esp32-psram-cache-issue lib_deps = https://github.com/kkloesener/MFRC522_I2C_Library.git https://github.com/kkloesener/AC101.git @@ -126,7 +128,7 @@ upload_port = /dev/cu.SLAB_USBtoUART monitor_port = /dev/cu.SLAB_USBtoUART -;;; Change upload/monitor-port of your board regarding your operating-system! +;;; Change upload/monitor-port of your board regarding your operating-system and develboard! ;MAC: /dev/cu.SLAB_USBtoUART ;WINDOWS: COM3 ;LINUX: /dev/ttyUSB0 (if it's the first USB-device attached, otherwise increase number) diff --git a/src/main.cpp b/src/main.cpp index 0ccc166..34547d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,6 +48,7 @@ #endif #include #ifdef MQTT_ENABLE + #define MQTT_SOCKET_TIMEOUT 1 // https://github.com/knolleary/pubsubclient/issues/403 #include #endif #include @@ -72,9 +73,6 @@ #include -// Info-docs: -// https://docs.aws.amazon.com/de_de/freertos-kernel/latest/dg/queue-management.html -// https://arduino-esp8266.readthedocs.io/en/latest/PROGMEM.html#how-do-i-declare-a-global-flash-string-and-use-it // Serial-logging buffer uint8_t serialLoglength = 200;