Unverified Commit 0f2c1ad1 authored by Wolle's avatar Wolle Committed by GitHub

better WiFi speed

parent aea2ddce
cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(Better_WiFi_throughput)
# ESP32-audioI2S, better WiFi speed
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.
Hier ist ein komplettes Beispiel, welches einfach in PlatformIO geklont erden kann.
````c++
#include <Arduino.h>
#include "WiFiMulti.h"
#include "Audio.h"
Audio audio;
WiFiMulti wifiMulti;
String ssid = "xxxx";
String password = "xxxx";
#define I2S_LRC 26
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_MCLK 0
void setup() {
Serial.begin(115200);
wifiMulti.addAP(ssid.c_str(), password.c_str());
wifiMulti.run();
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT, -1, -1);
audio.setVolume(20); // 0...21
audio.connecttohost("http://us3.internet-radio.com:8342/stream");
}
void loop(){
audio.loop();
}
// optional
void audio_info(const char *info){
Serial.print("info "); Serial.println(info);
}
````
Das sind die wesentlichen Einstellungen:
dependencies:
idf:
component_hash: null
source:
type: idf
version: 4.4.4
manifest_hash: 42970b56113a87cad113a232ae5a1819df2189a399da7d82d7a91f5a62d9e1a1
target: esp32
version: 1.0.0
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
phy_init, data, phy, 0xd000, 0x1000
factory, app, factory, 0x10000, 3M,
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/en/latest/platforms/espressif32.html
[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#v6.2.0 ; ESP-IDF v4.4.4
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.8
;framework = arduino
framework = arduino, espidf
board = esp32dev ;chipmodel ESP32, 4M FLASH, USBtoTTL
;board = um_tinys3 ;chipmodel ESP32S3, 8M FLASH, HAS_PSRAM, SerialUSB
;board = esp32-12k ;chipmodel ESP32S3, 8M FLASH, HAS_PSRAM, USBtoTTL
board_build.f_cpu = 240000000L
board_build.flash_size=4MB
board_build.flash_freq=80M
board_build.spiram_mode=2
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_build.partitions = partitions.csv
upload_speed = 460800 ; 921600, 512000, 460800, 256000, 115200
lib_deps =
https://github.com/schreibfaul1/ESP32-audioI2S.git
board_upload.maximum_size = 3145728
board_upload.flash_size = 4MB
board_build.flash_mode = qio
board_build.bootloader = dio
board_build.arduino.upstream_packages = no
;build_flags = -DCORE_DEBUG_LEVEL=0 ; None
;build_flags = -DCORE_DEBUG_LEVEL=1 ; Error
;build_flags = -DCORE_DEBUG_LEVEL=2 ; Warn
;build_flags = -DCORE_DEBUG_LEVEL=3 ; Info
;build_flags = -DCORE_DEBUG_LEVEL=4 ; Debug
;build_flags = -DCORE_DEBUG_LEVEL=5 ; Verbose
build_flags =
-Wall
-Wextra
-DCORE_DEBUG_LEVEL=3
-DCONFIG_ARDUHAL_LOG_COLORS
-DBOARD_HAS_PSRAM
; -DAUDIO_LOG
-DARDUINO_RUNNING_CORE=1 ; Arduino Runs On Core (setup, loop)
-DARDUINO_EVENT_RUNNING_CORE=1 ; Events Run On Core
build_unflags =
; -DARDUINO_USB_CDC_ON_BOOT=0 ; traditional log
; -DBOARD_HAS_PSRAM
This diff is collapsed.
This diff is collapsed.
# This file was automatically generated for projects
# without default 'CMakeLists.txt' file.
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
idf_component_register(SRCS ${app_sources})
#include <Arduino.h>
#include "WiFiMulti.h"
#include "Audio.h"
Audio audio;
WiFiMulti wifiMulti;
String ssid = "xxxx";
String password = "xxxx";
#define I2S_LRC 26
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_MCLK 0
void setup() {
Serial.begin(115200);
wifiMulti.addAP(ssid.c_str(), password.c_str());
wifiMulti.run();
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT, -1, -1);
audio.setVolume(20); // 0...21
audio.connecttohost("http://us3.internet-radio.com:8342/stream");
}
void loop(){
audio.loop();
}
// optional
void audio_info(const char *info){
Serial.print("info "); Serial.println(info);
}
\ No newline at end of file
This directory is intended for PlatformIO Test Runner and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment