Skip to content

Commit 0f2c1ad

Browse files
authored
better WiFi speed
1 parent aea2ddc commit 0f2c1ad

File tree

13 files changed

+3192
-0
lines changed

13 files changed

+3192
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cmake_minimum_required(VERSION 3.16.0)
2+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
3+
project(Better_WiFi_throughput)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ESP32-audioI2S, better WiFi speed
2+
bei hoher Bitrate oder geringer Kompressionsrate kann der Datendurchsatz über WiFi nicht ausreichen um den Audiobuffer ausreichend zu füllen. In diesem Fall kommt periodisch die Meldung "slow stream, dropouts are possible". Abhilfe schaffen bessere TCP Einstellungen. Das kann über menuconfig erreicht werden mit anschließender Arduino Kompilierung.
3+
Hier ist ein komplettes Beispiel, welches einfach in PlatformIO geklont erden kann.
4+
5+
6+
````c++
7+
#include <Arduino.h>
8+
#include "WiFiMulti.h"
9+
#include "Audio.h"
10+
11+
Audio audio;
12+
WiFiMulti wifiMulti;
13+
14+
String ssid = "xxxx";
15+
String password = "xxxx";
16+
17+
#define I2S_LRC 26
18+
#define I2S_DOUT 25
19+
#define I2S_BCLK 27
20+
#define I2S_MCLK 0
21+
22+
void setup() {
23+
Serial.begin(115200);
24+
wifiMulti.addAP(ssid.c_str(), password.c_str());
25+
wifiMulti.run();
26+
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT, -1, -1);
27+
audio.setVolume(20); // 0...21
28+
audio.connecttohost("http://us3.internet-radio.com:8342/stream");
29+
}
30+
31+
void loop(){
32+
audio.loop();
33+
}
34+
35+
// optional
36+
void audio_info(const char *info){
37+
Serial.print("info "); Serial.println(info);
38+
}
39+
40+
41+
````
42+
43+
44+
45+
Das sind die wesentlichen Einstellungen:
46+
47+
63.4 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
idf:
3+
component_hash: null
4+
source:
5+
type: idf
6+
version: 4.4.4
7+
manifest_hash: 42970b56113a87cad113a232ae5a1819df2189a399da7d82d7a91f5a62d9e1a1
8+
target: esp32
9+
version: 1.0.0
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
This directory is intended for project header files.
3+
4+
A header file is a file containing C declarations and macro definitions
5+
to be shared between several project source files. You request the use of a
6+
header file in your project source file (C, C++, etc) located in `src` folder
7+
by including it, with the C preprocessing directive `#include'.
8+
9+
```src/main.c
10+
11+
#include "header.h"
12+
13+
int main (void)
14+
{
15+
...
16+
}
17+
```
18+
19+
Including a header file produces the same results as copying the header file
20+
into each source file that needs it. Such copying would be time-consuming
21+
and error-prone. With a header file, the related declarations appear
22+
in only one place. If they need to be changed, they can be changed in one
23+
place, and programs that include the header file will automatically use the
24+
new version when next recompiled. The header file eliminates the labor of
25+
finding and changing all the copies as well as the risk that a failure to
26+
find one copy will result in inconsistencies within a program.
27+
28+
In C, the usual convention is to give header files names that end with `.h'.
29+
It is most portable to use only letters, digits, dashes, and underscores in
30+
header file names, and at most one dot.
31+
32+
Read more about using header files in official GCC documentation:
33+
34+
* Include Syntax
35+
* Include Operation
36+
* Once-Only Headers
37+
* Computed Includes
38+
39+
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
This directory is intended for project specific (private) libraries.
3+
PlatformIO will compile them to static libraries and link into executable file.
4+
5+
The source code of each library should be placed in a an own separate directory
6+
("lib/your_library_name/[here are source files]").
7+
8+
For example, see a structure of the following two libraries `Foo` and `Bar`:
9+
10+
|--lib
11+
| |
12+
| |--Bar
13+
| | |--docs
14+
| | |--examples
15+
| | |--src
16+
| | |- Bar.c
17+
| | |- Bar.h
18+
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
19+
| |
20+
| |--Foo
21+
| | |- Foo.c
22+
| | |- Foo.h
23+
| |
24+
| |- README --> THIS FILE
25+
|
26+
|- platformio.ini
27+
|--src
28+
|- main.c
29+
30+
and a contents of `src/main.c`:
31+
```
32+
#include <Foo.h>
33+
#include <Bar.h>
34+
35+
int main (void)
36+
{
37+
...
38+
}
39+
40+
```
41+
42+
PlatformIO Library Dependency Finder will find automatically dependent
43+
libraries scanning project source files.
44+
45+
More information about PlatformIO Library Dependency Finder
46+
- https://docs.platformio.org/page/librarymanager/ldf.html
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Name, Type, SubType, Offset, Size
2+
nvs, data, nvs, 0x9000, 0x4000
3+
phy_init, data, phy, 0xd000, 0x1000
4+
factory, app, factory, 0x10000, 3M,
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/en/latest/platforms/espressif32.html
10+
11+
[env:esp32dev]
12+
platform = https://github.com/platformio/platform-espressif32.git#v6.2.0 ; ESP-IDF v4.4.4
13+
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.8
14+
15+
;framework = arduino
16+
framework = arduino, espidf
17+
18+
19+
board = esp32dev ;chipmodel ESP32, 4M FLASH, USBtoTTL
20+
;board = um_tinys3 ;chipmodel ESP32S3, 8M FLASH, HAS_PSRAM, SerialUSB
21+
;board = esp32-12k ;chipmodel ESP32S3, 8M FLASH, HAS_PSRAM, USBtoTTL
22+
23+
board_build.f_cpu = 240000000L
24+
board_build.flash_size=4MB
25+
board_build.flash_freq=80M
26+
board_build.spiram_mode=2
27+
monitor_speed = 115200
28+
monitor_filters = esp32_exception_decoder
29+
board_build.partitions = partitions.csv
30+
upload_speed = 460800 ; 921600, 512000, 460800, 256000, 115200
31+
32+
33+
lib_deps =
34+
https://github.com/schreibfaul1/ESP32-audioI2S.git
35+
36+
37+
board_upload.maximum_size = 3145728
38+
board_upload.flash_size = 4MB
39+
board_build.flash_mode = qio
40+
board_build.bootloader = dio
41+
board_build.arduino.upstream_packages = no
42+
43+
;build_flags = -DCORE_DEBUG_LEVEL=0 ; None
44+
;build_flags = -DCORE_DEBUG_LEVEL=1 ; Error
45+
;build_flags = -DCORE_DEBUG_LEVEL=2 ; Warn
46+
;build_flags = -DCORE_DEBUG_LEVEL=3 ; Info
47+
;build_flags = -DCORE_DEBUG_LEVEL=4 ; Debug
48+
;build_flags = -DCORE_DEBUG_LEVEL=5 ; Verbose
49+
50+
build_flags =
51+
-Wall
52+
-Wextra
53+
-DCORE_DEBUG_LEVEL=3
54+
-DCONFIG_ARDUHAL_LOG_COLORS
55+
-DBOARD_HAS_PSRAM
56+
; -DAUDIO_LOG
57+
-DARDUINO_RUNNING_CORE=1 ; Arduino Runs On Core (setup, loop)
58+
-DARDUINO_EVENT_RUNNING_CORE=1 ; Events Run On Core
59+
60+
build_unflags =
61+
; -DARDUINO_USB_CDC_ON_BOOT=0 ; traditional log
62+
; -DBOARD_HAS_PSRAM

0 commit comments

Comments
 (0)