mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 11:36:59 +03:00
Merge branch 'master' into nvs_parameters
# Conflicts: # .cproject # Makefile # README.md # components/cmd_nvs/cmd_nvs.c # components/cmd_system/cmd_system.c # components/cmd_system/cmd_system.h # components/driver_bt/CMakeLists.txt # components/wifi-manager/CMakeLists.txt # components/wifi-manager/Kconfig.projbuild # components/wifi-manager/code.js # components/wifi-manager/component.mk # components/wifi-manager/dns_server.c # components/wifi-manager/dns_server.h # components/wifi-manager/http_server.c # components/wifi-manager/http_server.h # components/wifi-manager/index.html # components/wifi-manager/style.css # components/wifi-manager/wifi_manager.c # components/wifi-manager/wifi_manager.h # main/CMakeLists.txt # main/console.c # main/esp_app_main.c # sdkconfig.defaults
This commit is contained in:
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN apt-get update && apt-get install -y git wget libncurses-dev flex bison gperf \
|
||||
python python-pip python-setuptools python-serial python-click \
|
||||
python-cryptography python-future python-pyparsing \
|
||||
python-pyelftools cmake ninja-build ccache libusb-1.0
|
||||
|
||||
RUN mkdir /workspace
|
||||
WORKDIR /workspace
|
||||
|
||||
# Download and checkout known good esp-idf commit
|
||||
RUN git clone --recursive https://github.com/espressif/esp-idf.git esp-idf
|
||||
RUN cd esp-idf && git checkout 4dac7c7df885adaa86a5c79f2adeaf8d68667349
|
||||
RUN git clone https://github.com/sle118/squeezelite-esp32.git
|
||||
|
||||
# Download GCC 5.2.0
|
||||
RUN wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
|
||||
RUN tar -xzf xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
|
||||
RUN rm xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
|
||||
|
||||
# Patch I2S in esp-idf
|
||||
RUN cp /workspace/squeezelite-esp32/idf-patch/i2s.c /workspace/esp-idf/components/driver/i2s.c
|
||||
RUN rm -r /workspace/squeezelite-esp32
|
||||
RUN mkdir /workspace/squeezelite-esp32
|
||||
|
||||
# Setup PATH to use esp-idf and gcc-5.2.0
|
||||
RUN touch /root/.bashrc && \
|
||||
echo export PATH="\$PATH:/workspace/xtensa-esp32-elf/bin" >> /root/.bashrc && \
|
||||
echo export IDF_PATH=/workspace/esp-idf >> /root/.bashrc
|
||||
|
||||
# OPTIONAL: Install vim for text editing in Bash
|
||||
RUN apt-get update && apt-get install -y vim
|
||||
|
||||
WORKDIR /workspace/squeezelite-esp32
|
||||
CMD ["bash"]
|
||||
145
README.md
145
README.md
@@ -1,7 +1,76 @@
|
||||
# Getting pre-compiled binaries
|
||||
An automated build was configured to produce binaries on a regular basis, from common templates that are the most typical. They can be downloaded from :
|
||||
# Squeezelite-esp32
|
||||
## Supported Hardware
|
||||
### SqueezeAMP
|
||||
Works with the SqueezeAMP see [here](https://forums.slimdevices.com/showthread.php?110926-pre-ANNOUNCE-SqueezeAMP-and-SqueezeliteESP32) and [here](https://github.com/philippe44/SqueezeAMP/blob/master/README.md)
|
||||
|
||||
https://github.com/sle118/squeezelite-esp32/releases
|
||||
Use the `squeezelite-esp32-SqueezeAmp-sdkconfig.defaults` configuration file.
|
||||
|
||||
### ESP32-WROVER + I2S DAC
|
||||
Squeezelite-esp32 requires esp32 chipset and 4MB PSRAM. ESP32-WROVER meets these requirements.
|
||||
To get an audio output an I2S DAC can be used. Cheap PCM5102 I2S DACs work others may also work. PCM5012 DACs can be hooked up via:
|
||||
|
||||
I2S - WROVER
|
||||
VCC - 3.3V
|
||||
3.3V - 3.3V
|
||||
GND - GND
|
||||
FLT - GND
|
||||
DMP - GND
|
||||
SCL - GND
|
||||
BCK - 26
|
||||
DIN - 22
|
||||
LCK - 25
|
||||
FMT - GND
|
||||
XMT - 3.3V
|
||||
|
||||
Use the `squeezelite-esp32-I2S-4MFlash-sdkconfig.defaults` configuration file.
|
||||
|
||||
## Setting up ESP-IDF
|
||||
### Docker
|
||||
You can use docker to build squeezelite-esp32
|
||||
First you need to build the Docker container:
|
||||
```
|
||||
docker build -t esp-idf .
|
||||
```
|
||||
Then you need to run the container:
|
||||
```
|
||||
docker run -i -t -v `pwd`:/workspace/squeezelite-esp32 esp-idf
|
||||
```
|
||||
The above command will mount this repo into the docker container and start a bash terminal
|
||||
for you to then follow the below build steps
|
||||
|
||||
### Manual Install of ESP-IDF
|
||||
<strong>Currently this project requires a specific combination of IDF 4 with gcc 5.2. You'll have to implement the gcc 5.2 toolchain from an IDF 3.2 install into the IDF 4 directory in order to successfully compile it</strong>
|
||||
|
||||
You can install IDF manually on Linux or Windows (using the Subsystem for Linux) following the instructions at: https://www.instructables.com/id/ESP32-Development-on-Windows-Subsystem-for-Linux/
|
||||
And then copying the i2s.c patch file from this repo over to the esp-idf folder
|
||||
|
||||
## Building Squeezelite-esp32
|
||||
MOST IMPORTANT: create the right default config file
|
||||
- for all libraries, add -mlongcalls.
|
||||
- make defconfig
|
||||
(Note: You can also copy over config files from the build-scripts folder to ./sdkconfig)
|
||||
Then adapt the config file to your wifi/BT/I2C device (can also be done on the command line)
|
||||
- make menuconfig
|
||||
Then
|
||||
|
||||
```
|
||||
# Build recovery.bin, bootloader.bin, ota_data_initial.bin, partitions.bin
|
||||
# force appropriate rebuild by touching all the files which may have a RECOVERY_APPLICATION specific source compile logic
|
||||
find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -type f -print0 | xargs -0 grep -l "RECOVERY_APPLICATION" | xargs touch
|
||||
export PROJECT_NAME="recovery"
|
||||
make -j4 all EXTRA_CPPFLAGS='-DRECOVERY_APPLICATION=1'
|
||||
make flash
|
||||
#
|
||||
# Build squeezelite.bin
|
||||
# Now force a rebuild by touching all the files which may have a RECOVERY_APPLICATION specific source compile logic
|
||||
find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -type f -print0 | xargs -0 grep -l "RECOVERY_APPLICATION" | xargs touch
|
||||
export PROJECT_NAME="squeezelite"
|
||||
make -j4 app EXTRA_CPPFLAGS='-DRECOVERY_APPLICATION=0'
|
||||
python ${IDF_PATH}/components/esptool_py/esptool/esptool.py --chip esp32 --port ${ESPPORT} --baud ${ESPBAUD} --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x150000 ./build/squeezelite.bin
|
||||
# monitor serial output
|
||||
make monitor
|
||||
|
||||
```
|
||||
|
||||
# Configuration
|
||||
1/ setup WiFi
|
||||
@@ -20,68 +89,49 @@ At this point, the device should have disabled its built-in access point and sho
|
||||
- Add or change any additional command line option (for example player name, etc)
|
||||
- Activate squeezelite execution: this tells the device to automatiaclly run the command at start
|
||||
- Update the configuration
|
||||
- Reboot
|
||||
- click on the "start toggle" button. This will force a reboot.
|
||||
- The toggle switch should be set to 'ON' to ensure that squeezelite is active after booting
|
||||
|
||||
3/ set bluetooth & airplaysink name (if you want something other than default)
|
||||
3/ Updating Squeezelite
|
||||
- From the firmware tab, click on "Check for Updates"
|
||||
- Look for updated binaries
|
||||
- Select a line
|
||||
- Click on "Flash!"
|
||||
- The system will reboot into recovery mode (if not already in that mode), wipe the squeezelite partition and download/flash the selected version
|
||||
|
||||
*this will eventually be moved to the web configuration*
|
||||
3/ Recovery
|
||||
- From the firmware tab, click on the "Recovery" button. This will reboot the ESP32 into recovery, where additional configuration options are available from the NVS editor
|
||||
|
||||
you need to be connected to the device using a usb to serial adapter, with a terminal program (for example putty) opened on that serial port.
|
||||
- To setup the bluetooth sink name, enter the following command
|
||||
|
||||
nvs_set bt_sink_name str -v "your_bt_name_here"
|
||||
|
||||
- To setup the airplay sink name, enter the following command
|
||||
|
||||
nvs_set airplay_sink_name str -v "your_airplay_name_here"
|
||||
|
||||
# Additional command line notes
|
||||
# Additional command line notes, configured from the http configuration
|
||||
The squeezelite options are very similar to the regular Linux ones. Differences are :
|
||||
|
||||
- the output is -o [\"BT -n <sinkname>\"] | [I2S]
|
||||
|
||||
- the output is -o ["BT -n '<sinkname>' "] | [I2S]
|
||||
- if you've compiled with RESAMPLE option, normal soxr options are available using -R [-u <options>]. Note that anything above LQ or MQ will overload the CPU
|
||||
|
||||
- if you've used RESAMPLE16, <options> are (b|l|m)[:i], with b = basic linear interpolation, l = 13 taps, m = 21 taps, i = interpolate filter coefficients
|
||||
|
||||
For example, so use a BT speaker named MySpeaker, accept audio up to 192kHz and resample everything to 44100 and use 16 bits resample with medium quality, the command line is:
|
||||
|
||||
To add options that require quotes ("), escape them with \". For example, so use a BT speaker named MySpeaker and resample everything to 44100 (which is needed with Bluetooth) and use 16 bits resample with medium quality, the command line is:
|
||||
squeezelite -o "BT -n 'BT <sinkname>'" -b 500:2000 -R -u m -Z 192000 -r "44100-44100"
|
||||
|
||||
nvs_set autoexec1 str -v "squeezelite -o \"BT -n 'MySpeaker'\" -b 500:2000 -R -u m -Z 192000 -r \"44100-44100\""
|
||||
See squeezlite command line, but keys options are
|
||||
|
||||
# Building Squeezelite-esp32
|
||||
MOST IMPORTANT: create the right default config file
|
||||
```
|
||||
make defconfig
|
||||
```
|
||||
Then adapt the config file to your wifi/BT/I2C device (can alos be done on the command line)
|
||||
```
|
||||
make menuconfig
|
||||
```
|
||||
Then you will need to build the recovery binary and squeezelite binary:
|
||||
```
|
||||
# Build recovery.bin, bootloader.bin, ota_data_initial.bin, partitions.bin
|
||||
PROJECT_NAME="recovery" make -j4 all EXTRA_CPPFLAGS='-DRECOVERY_APPLICATION=1'
|
||||
# Now force a rebuild by touching all the files which may have a RECOVERY_APPLICATION specific source compile logic
|
||||
find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -type f -print0 | xargs -0 grep -l "RECOVERY_APPLICATION" | xargs touch
|
||||
# Build squeezelite.bin
|
||||
PROJECT_NAME="squeezelite" make -j4 app EXTRA_CPPFLAGS='-DRECOVERY_APPLICATION=0'
|
||||
- Z <rate> : tell LMS what is the max sample rate supported before LMS resamples
|
||||
- R (see above)
|
||||
- r "<minrate>-<maxrate>"
|
||||
|
||||
make flash monitor
|
||||
```
|
||||
|
||||
Once the application is running, under monitor, you can monitor the system activity.
|
||||
|
||||
- for all libraries, add -mlongcalls.
|
||||
## Additional misc notes to do you build
|
||||
- as of this writing, ESP-IDF has a bug int he way the PLL values are calculated for i2s, so you *must* use the i2s.c file in the patch directory
|
||||
- for all libraries, add -mlongcalls.
|
||||
- audio libraries are complicated to rebuild, open an issue if you really want to
|
||||
- libmad, libflac (no esp's version), libvorbis (tremor - not esp's version), alac work
|
||||
- libfaad does not really support real time, but if you want to try
|
||||
- -O3 -DFIXED_POINT -DSMALL_STACK
|
||||
- change ac_link in configure and case ac_files, remove ''
|
||||
- compiler but in cfft.c and cffti1, must disable optimization using
|
||||
- compiler but in cfft.c and cffti1, must disable optimization using
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
#pragma GCC pop_options
|
||||
- opus & opusfile
|
||||
- opus & opusfile
|
||||
- for opus, the ESP-provided library seems to work, but opusfile is still needed
|
||||
- per mad & few others, edit configure and change $ac_link to add -c (faking link)
|
||||
- change ac_files to remove ''
|
||||
@@ -90,11 +140,10 @@ Once the application is running, under monitor, you can monitor the system activ
|
||||
- set IDF_PATH=/home/esp-idf
|
||||
- set ESPPORT=COM9
|
||||
- update flash partition size
|
||||
- other compiler #define
|
||||
- other compiler #define
|
||||
- use no resampling or set RESAMPLE (soxr) or set RESAMPLE16 for fast fixed 16 bits resampling
|
||||
- use LOOPBACK (mandatory)
|
||||
- use BYTES_PER_FRAME=4 (8 is not fully functionnal)
|
||||
- LINKALL (mandatory)
|
||||
- NO_FAAD unless you want to us faad, which currently overloads the CPU
|
||||
- TREMOR_ONLY (mandatory)
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ CONFIG_SPIRAM_SIZE=-1
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
CONFIG_SPIRAM_CACHE_WORKAROUND=y
|
||||
|
||||
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=256
|
||||
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=65536
|
||||
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
||||
@@ -116,7 +115,6 @@ CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
|
||||
CONFIG_ESP32_PHY_MAX_TX_POWER=20
|
||||
CONFIG_FREERTOS_HZ=100
|
||||
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
|
||||
CONFIG_LWIP_UDP_RECVMBOX_SIZE=32
|
||||
CONFIG_LWIP_NETIF_LOOPBACK=y
|
||||
CONFIG_LWIP_TCP_MSL=60000
|
||||
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=8192
|
||||
@@ -140,4 +138,3 @@ CONFIG_DEFAULT_AP_IP="192.168.4.1"
|
||||
CONFIG_DEFAULT_AP_GATEWAY="192.168.4.1"
|
||||
CONFIG_DEFAULT_AP_NETMASK="255.255.255.0"
|
||||
CONFIG_DEFAULT_COMMAND_LINE="squeezelite -o I2S -b 500:2000 -d all=info"
|
||||
CONFIG_OTA_ALLOW_HTTP=y
|
||||
1139
build-scripts/squeezelite-esp32-I2S-16MFlash-sdkconfig.defaults
Normal file
1139
build-scripts/squeezelite-esp32-I2S-16MFlash-sdkconfig.defaults
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1138
build-scripts/squeezelite-esp32-I2S-4MFlash-sdkconfig.defaults
Normal file
1138
build-scripts/squeezelite-esp32-I2S-4MFlash-sdkconfig.defaults
Normal file
File diff suppressed because it is too large
Load Diff
1127
build-scripts/squeezelite-esp32-SqueezeAmp-sdkconfig.defaults
Normal file
1127
build-scripts/squeezelite-esp32-SqueezeAmp-sdkconfig.defaults
Normal file
File diff suppressed because it is too large
Load Diff
@@ -31,11 +31,6 @@
|
||||
#ifdef CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
|
||||
#define WITH_TASKS_INFO 1
|
||||
#endif
|
||||
#define LWS_MAGIC_REBOOT_TYPE_ADS 0x50001ffc
|
||||
#define LWS_MAGIC_REBOOT_TYPE_REQ_FACTORY 0xb00bcafe
|
||||
#define LWS_MAGIC_REBOOT_TYPE_FORCED_FACTORY 0xfaceb00b
|
||||
#define LWS_MAGIC_REBOOT_TYPE_FORCED_FACTORY_BUTTON 0xf0cedfac
|
||||
#define LWS_MAGIC_REBOOT_TYPE_REQ_FACTORY_ERASE_OTA 0xfac0eeee
|
||||
|
||||
|
||||
static const char * TAG = "platform_esp32";
|
||||
|
||||
@@ -88,12 +88,17 @@ void set_volume(unsigned left, unsigned right) {
|
||||
|
||||
bool test_open(const char *device, unsigned rates[], bool userdef_rates) {
|
||||
memset(rates, 0, MAX_SUPPORTED_SAMPLERATES * sizeof(unsigned));
|
||||
if (!strcmp(device, "BT")) {
|
||||
rates[0] = 44100;
|
||||
} else {
|
||||
unsigned _rates[] = { 192000, 176400, 96000, 88200, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0 };
|
||||
if (!strcasecmp(device, "I2S")) {
|
||||
unsigned _rates[] = { 192000, 176400, 96000, 88200, 48000,
|
||||
44100, 32000, 24000, 22050, 16000,
|
||||
12000, 11025, 8000, 0 };
|
||||
memcpy(rates, _rates, sizeof(_rates));
|
||||
}
|
||||
} else if (!strcasecmp(device, "SPDIF")) {
|
||||
unsigned _rates[] = { 48000, 44100, 0 };
|
||||
memcpy(rates, _rates, sizeof(_rates));
|
||||
} else {
|
||||
rates[0] = 44100;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@ Max number of WiFi static RX buffer 12-16 (6)
|
||||
Max number of WiFi dynamic buffer 24-64 (16 or 10)
|
||||
Max number of WiFi static TX buffer 12-16 (6)
|
||||
|
||||
i2C
|
||||
i2cconfig --port=0 --sda=27 --scl=26
|
||||
|
||||
|
||||
SPI RAM
|
||||
Maximum malloc() to always put in internal memory 512 (2048)
|
||||
|
||||
@@ -20,14 +24,23 @@ Put .bss in SPIRAM?
|
||||
# WiFi
|
||||
nvs_set autoexec1 str -v "join <SSID> <password>"
|
||||
# enable
|
||||
nv_set autoexec u8 -v 1
|
||||
nvs_set autoexec u8 -v 1
|
||||
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\" -e flac"
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\""
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -u m -Z 192000 -r \"44100-44100\" -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -r \"44100-44100\" -e flac"
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32-BT -R -Z 96000 -r \"44100-44100\" -e flac"
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32-BT -R -Z 96000 -r \"44100-44100\""
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -R -Z 96000 -r \"44100-44100\""
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32-BT -R -u m -Z 192000 -r \"44100-44100\" -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32-BT -r \"44100-44100\" -e flac"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\" -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"96000-96000\" -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -d slimproto=debug -d stream=sdebug -m ESP32 -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=debug -m ESP32 -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32 -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -m ESP32 -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32 -s 192.168.2.10"
|
||||
nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d decode=info -m ESP32 -s 192.168.2.144"
|
||||
nvs_set autoexec2 str -v "squeezelite -o SPDIF -b 500:2000 -d all=info -m ESP32"
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
|
||||
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
sudo add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io
|
||||
|
||||
Reference in New Issue
Block a user