Add ESP32-S3 configuration for yoRadio with Polish character support

- Add Taskfile.yml for automated build/upload/monitor tasks
- Add platformio.ini configured for ESP32-S3-DevKitC-1 with USB CDC support
- Add myoptions.h with hardware configuration:
  * ILI9341 display (320x240, 3.2")
  * I2S audio pins (DOUT=16, BCLK=17, LRC=15)
  * Two rotary encoders
  * IR receiver support
  * Russian language mode for Polish characters support
- Modify utf8Rus.cpp to support Polish characters: ąćęłńóśźż ĄĆĘŁŃÓŚŹŻ
- Add CONFIG_FILES.md with WiFi and playlist configuration guide
- Add KONFIGURACJA.md with complete hardware and software documentation
- Update examples/myoptions.h with ILI9341 display and encoder configuration
This commit is contained in:
2026-02-22 13:52:17 +01:00
parent 2fd3e388d5
commit 7ba365cad9
7 changed files with 1395 additions and 184 deletions

158
CONFIG_FILES.md Normal file
View File

@@ -0,0 +1,158 @@
# Pliki konfiguracyjne yoRadio dla ESP32-S3
## Lokalizacja plików
Wszystkie pliki konfiguracyjne znajdują się w katalogu:
```
yoRadio/data/data/
```
## 1. wifi.csv - Konfiguracja WiFi
### Format
```
SSID<TAB>PASSWORD
```
### Przykład
```
MojaWiFi mojehaslo123
SiecGoscinna guest12345
```
### Instrukcja
1. Edytuj plik `yoRadio/data/data/wifi.csv`
2. Każda linia to jedna sieć WiFi
3. SSID i hasło oddzielone **tabulatorem** (TAB)
4. ESP32 będzie próbował łączyć się z sieciami po kolei
## 2. playlist.csv - Lista stacji radiowych
### Format
```
NAZWA<TAB>URL<TAB>VOLUME
```
### Przykład
```
RMF FM http://195.150.20.242:8000/rmf_fm 0
Radio ZET http://zt.cdn.eurozet.pl:8400/zet.mp3 0
TOK FM http://zt.cdn.eurozet.pl:8400/tok.mp3 0
```
### Instrukcja
1. Edytuj plik `yoRadio/data/data/playlist.csv`
2. Każda linia to jedna stacja radiowa
3. Pola oddzielone **tabulatorem** (TAB):
- **NAZWA** - nazwa wyświetlana (max 30 znaków)
- **URL** - adres streamu (HTTP/HTTPS)
- **VOLUME** - głośność 0-100 (0 = domyślna)
## Wgrywanie plików na ESP32
### Metoda 1: Upload przez PlatformIO (ZALECANE)
```bash
# Wgraj tylko pliki konfiguracyjne
task upload-fs
# Lub pełny flash (firmware + pliki)
task full-flash
```
### Metoda 2: Przez interfejs webowy
1. Połącz się z ESP32:
- WiFi AP: `yoRadioAP`
- Hasło: `12345987`
- IP: `http://192.168.4.1/`
2. Przejdź do sekcji upload
3. Wgraj pliki `wifi.csv` i `playlist.csv`
### Metoda 3: Edycja online
1. Po połączeniu z WiFi, wejdź na IP ESP32
2. W interfejsie webowym możesz dodawać/usuwać stacje
3. Pliki zostaną automatycznie zapisane w SPIFFS
## Przykładowe polskie stacje radiowe
W pliku `playlist.csv` znajdują się następujące stacje:
- RMF FM
- Radio ZET
- TOK FM
- Radio Maryja
- Radio Kraków
- Radio Wrocław
- Polskie Radio 24
Oraz międzynarodowe:
- Chillout Lounge Radio
- Jazz Radio
- SomaFM Groove Salad
## Znajdowanie nowych stacji
### Źródła URL streamów:
1. **Radio Browser** - https://www.radio-browser.info/
2. **TuneIn** - https://tunein.com/
3. **SHOUTcast** - https://directory.shoutcast.com/
4. **Icecast** - https://dir.xiph.org/
### Testowanie URL:
```bash
# Test czy stream działa
curl -I <URL_STREAMU>
# Lub w przeglądarce - VLC
vlc <URL_STREAMU>
```
## Resetowanie konfiguracji
Jeśli ESP32 nie startuje lub chcesz zacząć od nowa:
```bash
# Wymaż całą pamięć flash
task erase
# Wgraj firmware i pliki od nowa
task full-flash
```
## Backup konfiguracji
Przed aktualizacją firmware zawsze rób backup:
```bash
# Pobierz pliki z ESP32 przez przeglądarkę:
http://<ESP32_IP>/data/wifi.csv
http://<ESP32_IP>/data/playlist.csv
```
## Troubleshooting
### ESP32 nie łączy się z WiFi
1. Sprawdź format pliku `wifi.csv` - musi być TAB, nie spacje
2. Upewnij się że WiFi działa i jest w zasięgu
3. Sprawdź czy hasło jest poprawne
4. Zobacz logi przez: `task monitor`
### Stacje nie grają
1. Sprawdź URL w przeglądarce
2. Niektóre stacje wymagają HTTPS (ESP32-S3 wspiera)
3. Sprawdź format playlist.csv - TAB separator
4. Zobacz logi audio przez: `task monitor`
### Jak edytować pliki CSV
**UWAGA:** Używaj edytora tekstu, nie Excel!
Dobry edytor:
- VS Code
- Sublime Text
- Notepad++
- nano/vim
Excel często zamienia TAB na spacje!
## Format końca linii
Pliki powinny mieć Unix line endings (LF), nie Windows (CRLF).
W VS Code: dolny prawy róg -> kliknij "CRLF" -> wybierz "LF"

490
KONFIGURACJA.md Normal file
View File

@@ -0,0 +1,490 @@
# Konfiguracja yoRadio dla ESP32-S3
## Pliki konfiguracyjne
Projekt używa trzech głównych plików konfiguracyjnych:
- `yoRadio/myoptions.h` - konfiguracja sprzętowa (piny, wyświetlacz, audio)
- `yoRadio/platformio.ini` - konfiguracja PlatformIO (board, biblioteki)
- `yoRadio/data/data/wifi.csv` i `playlist.csv` - konfiguracja WiFi i stacji radiowych
---
## 1. myoptions.h - Konfiguracja sprzętowa
Plik: `yoRadio/myoptions.h`
### Język interfejsu
```cpp
#define L10N_LANGUAGE RU
```
**Dostępne języki:**
- `EN` - English (domyślny)
- `RU` - Russian (wspiera polskie znaki: ąćęłńóśźż ĄĆĘŁŃÓŚŹŻ)
**UWAGA:** Wybierz `RU` aby wyświetlać polskie znaki na wyświetlaczu!
### Wyświetlacz
```cpp
#define DSP_MODEL DSP_ILI9341
```
**Model:** ILI9341 - kolorowy wyświetlacz TFT 320x240 pikseli, 3.2 cala
**Dostępne modele wyświetlaczy:**
- `DSP_DUMMY` - bez wyświetlacza
- `DSP_ILI9341` - 320x240, 3.2" (aktualnie używany)
- `DSP_ST7735` - 160x128, 1.8"
- `DSP_ST7789` - 320x240, 2.4"
- `DSP_SSD1306` - 128x64, 0.96" OLED
- `DSP_NEXTION` - wyświetlacz Nextion
- Więcej: https://github.com/e2002/yoradio/wiki/Available-display-models
### Piny SPI wyświetlacza (ESP32-S3)
```cpp
#define TFT_MOSI 11 /* SPI MOSI - dane do wyświetlacza */
#define TFT_SCLK 12 /* SPI CLK - zegar */
#define TFT_MISO 13 /* SPI MISO - dane z wyświetlacza */
#define TFT_CS 10 /* Chip Select */
#define TFT_RST -1 /* Reset (-1 = podłącz do EN ESP32) */
#define TFT_DC 9 /* Data/Command */
```
**WAŻNE dla ESP32-S3:**
- Standardowe piny SPI to: MOSI=11, CLK=12, MISO=13
- TFT_RST=-1 oznacza że pin RST wyświetlacza jest podłączony do pinu EN (reset) ESP32-S3
- Jeśli używasz innego pinu RST, zmień wartość (np. `#define TFT_RST 9`)
### Piny I2S audio (DAC)
```cpp
#define I2S_DOUT 16 /* DIN - dane audio */
#define I2S_BCLK 17 /* BCLK - Bit Clock */
#define I2S_LRC 15 /* LRC/WS - Left/Right Clock (Word Select) */
```
**Obsługiwane DAC I2S:**
- PCM5102 (najpopularniejszy)
- MAX98357A
- UDA1334A
- CS4344
- Wewnętrzny DAC ESP32 (gorsza jakość)
**Uwaga:** Piny I2S muszą być różne od pinów SPI!
### Encoder (pokrętło obrotowe) #1
```cpp
#define ENC_BTNL 5 /* Obrót w lewo */
#define ENC_BTNB 6 /* Przycisk (naciśnięcie) */
#define ENC_BTNR 4 /* Obrót w prawo */
#define ENC_INTERNALPULLUP true /* Rezystory podciągające */
#define ENC_HALFQUARD true /* Tryb czułości */
```
**Funkcje encodera:**
- Obrót lewo/prawo - zmiana stacji lub głośności
- Naciśnięcie - pauza/play
### Encoder (pokrętło obrotowe) #2
```cpp
#define ENC2_BTNL 18 /* Obrót w lewo */
#define ENC2_BTNB 8 /* Przycisk */
#define ENC2_BTNR 7 /* Obrót w prawo */
#define ENC2_INTERNALPULLUP true /* Rezystory podciągające */
#define ENC2_HALFQUARD false /* Tryb czułości */
```
**Uwaga:** Drugi encoder jest opcjonalny!
### Jasność wyświetlacza
```cpp
#define BRIGHTNESS_PIN 14 /* PWM pin do regulacji jasności */
```
Użyj pinu PWM ESP32-S3 do podłączenia LED backlight wyświetlacza.
### Pilot IR (podczerwień)
```cpp
#define IR_PIN 21 /* Pin odbiornika IR (np. VS1838B) */
```
**Obsługiwane protokoły:**
- NEC
- Samsung
- Sony
- RC5/RC6
- Więcej: biblioteka IRremoteESP8266
---
## 2. platformio.ini - Konfiguracja build systemu
Plik: `yoRadio/platformio.ini`
### Platforma i board
```ini
[env:esp32dev]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
```
**Uwaga:** Używamy `esp32-s3-devkitc-1` nie `esp32dev`!
### Prędkości komunikacji
```ini
monitor_speed = 115200 # Prędkość Serial Monitor
upload_speed = 921600 # Prędkość uploadu (921600 lub 460800)
```
### Partycje flash
```ini
board_build.partitions = min_spiffs.csv
board_build.flash_mode = dio
```
**min_spiffs.csv** - małe SPIFFS (system plików) dla konfiguracji i interfejsu webowego
### Flagi kompilacji (ESP32-S3)
```ini
build_flags =
-DCORE_DEBUG_LEVEL=4 # Poziom logowania (0-5)
-DBOARD_HAS_PSRAM # Board ma PSRAM
-DARDUINO_USB_MODE=1 # Włącz USB
-DARDUINO_USB_CDC_ON_BOOT=1 # USB CDC (Serial) od startu
```
**KRYTYCZNE dla ESP32-S3:**
- `ARDUINO_USB_CDC_ON_BOOT=1` - bez tego Serial nie będzie działał!
- `CORE_DEBUG_LEVEL=4` - logi info+warning+error+verbose
### Biblioteki
```ini
lib_deps =
adafruit/Adafruit GFX Library # Grafika podstawowa
adafruit/Adafruit ILI9341 # Driver ILI9341
adafruit/Adafruit ST7735 and ST7789 Library
adafruit/Adafruit SSD1306 # OLED
adafruit/Adafruit PCD8544 Nokia 5110 LCD library
adafruit/Adafruit SH110X
adafruit/Adafruit SSD1327
adafruit/Adafruit SSD1305
nkawu/TFT 22 ILI9225 # ILI9225
mathertel/OneButton # Obsługa przycisków
crankyoldgit/IRremoteESP8266 # Pilot IR
paulstoffregen/XPT2046_Touchscreen # Ekran dotykowy
adafruit/RTClib # Zegar czasu rzeczywistego
```
---
## 3. Polskie czcionki i znaki
### Wsparcie dla polskich znaków
Plik: `yoRadio/src/displays/tools/utf8Rus.cpp`
**Zmienione znaki UTF-8:**
Polskie znaki: **ąćęłńóśźż ĄĆĘŁŃÓŚŹŻ**
Funkcja `utf8Rus()` konwertuje znaki UTF-8 na kody wyświetlacza:
```cpp
// Przykładowa konwersja:
case 0x82: {
if (!uppercase) {
strn[index] = 0xCf; // małe ł
} else {
strn[index] = 0xD0; // wielkie Ł
}
break;
}
```
**WAŻNE:**
- Wybierz `L10N_LANGUAGE RU` w `myoptions.h`
- Plik `utf8Rus.cpp` został zmodyfikowany do obsługi polskich znaków
- Oryginalna wersja obsługiwała tylko cyrylicę
### Testowanie polskich znaków
W pliku `playlist.csv` możesz używać polskich nazw stacji:
```
Polskie Radio Trójka http://... 0
TOK FM - najlepsze radio http://... 0
```
Znaki specjalne będą poprawnie wyświetlane na ekranie ILI9341.
---
## 4. Schemat pinów ESP32-S3
### Schemat podłączenia
```
ESP32-S3 DevKit ILI9341 Display
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPIO 11 (MOSI) ────► SDI/MOSI
GPIO 12 (CLK) ────► SCK
GPIO 13 (MISO) ────► SDO/MISO
GPIO 10 ────► CS
GPIO 9 ────► DC/RS
EN (Reset) ────► RESET
3.3V ────► VCC/LED
GND ────► GND
ESP32-S3 DevKit PCM5102 DAC
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPIO 16 ────► DIN
GPIO 17 ────► BCK
GPIO 15 ────► LCK/WS
3.3V ────► VIN
GND ────► GND
─ SCK (pin nieużywany)
GND ────► FMT
3.3V ────► XMT
ESP32-S3 DevKit Encoder
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPIO 5 ────► CLK (A)
GPIO 4 ────► DT (B)
GPIO 6 ────► SW (Button)
GND ────► GND
(3.3V opcjonalnie jeśli brak pullup)
ESP32-S3 DevKit IR Receiver (VS1838B)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPIO 21 ────► OUT
3.3V ────► VCC
GND ────► GND
```
### Bezpieczne piny ESP32-S3
**Bezpieczne do użycia:**
- GPIO 1-18 (z wyjątkiem 15,16,17,18,19,20)
- GPIO 21
- GPIO 35-45
**Unikaj:**
- GPIO 0 - boot button
- GPIO 19, 20 - USB
- GPIO 26-32 - flash/PSRAM
- GPIO 33, 34 - nie podłączaj enkodera (tylko input)
---
## 5. Budowanie i upload
### Dostępne komendy (Taskfile)
```bash
# Budowanie
task build # Kompiluj firmware
task clean # Wyczyść build cache
task rebuild # Clean + Build
# Upload
task upload # Wgraj firmware
task upload-fs # Wgraj pliki (SPIFFS)
task full-flash # Firmware + pliki
# Monitoring
task monitor # Serial monitor
task kill-monitor # Zatrzymaj monitor
# Narzędzia
task list-ports # Lista portów USB
task erase # Wymaż całą pamięć flash
```
### Proces pełnego flasha
```bash
# 1. Edytuj konfigurację
nano yoRadio/myoptions.h
# 2. Edytuj WiFi i playlistę
nano yoRadio/data/data/wifi.csv
nano yoRadio/data/data/playlist.csv
# 3. Pełny flash
task full-flash
# 4. Monitor
task monitor
```
---
## 6. Debugowanie
### Logi Serial
```bash
task monitor
```
**Poziomy logów (CORE_DEBUG_LEVEL):**
- 0 - None
- 1 - Error
- 2 - Warning
- 3 - Info
- 4 - Debug (aktualnie używany)
- 5 - Verbose
### Sprawdzanie połączenia wyświetlacza
Jeśli wyświetlacz świeci na biało:
1. Sprawdź połączenie pinów SPI
2. Sprawdź czy TFT_RST jest podłączony do EN lub do GPIO
3. Sprawdź napięcie zasilania (3.3V)
4. Sprawdź czy model wyświetlacza to ILI9341
### Sprawdzanie audio
Jeśli brak dźwięku:
1. Sprawdź połączenie I2S (DIN, BCK, LCK)
2. Sprawdź zasilanie DAC (3.3V lub 5V)
3. Zobacz logi: `task monitor`
4. Testuj inne URL stacji
---
## 7. Zaawansowane opcje
### Dodanie własnego wyświetlacza
Jeśli używasz niestandardowego wyświetlacza:
1. Znajdź driver w bibliotece Adafruit
2. Dodaj `lib_deps` w `platformio.ini`
3. Ustaw `DSP_MODEL` w `myoptions.h`
4. Dostosuj piny SPI
### Touchscreen
Jeśli masz wyświetlacz dotykowy:
```cpp
#define TS_MODEL TS_XPT2046 // Model touchscreen
#define TS_CS 255 // CS pin dla touch
```
### Wewnętrzny DAC ESP32
```cpp
#define I2S_INTERNAL true // Użyj wbudowanego DAC
// Piny: DAC1=GPIO25, DAC2=GPIO26 (tylko ESP32, nie S3!)
```
**UWAGA:** ESP32-S3 nie ma wewnętrznego DAC! Musisz użyć zewnętrznego (I2S).
### Sleep mode (oszczędzanie energii)
```cpp
#define WAKE_PIN 6 // Pin do wybudzania (ENC_BTNB)
```
---
## 8. Backup i restore konfiguracji
### Backup przed aktualizacją
```bash
# Zapisz aktualne pliki
cp yoRadio/myoptions.h myoptions.h.backup
cp yoRadio/data/data/wifi.csv wifi.csv.backup
cp yoRadio/data/data/playlist.csv playlist.csv.backup
```
### Restore po aktualizacji
```bash
# Przywróć pliki
cp myoptions.h.backup yoRadio/myoptions.h
cp wifi.csv.backup yoRadio/data/data/wifi.csv
cp playlist.csv.backup yoRadio/data/data/playlist.csv
# Rebuild i upload
task full-flash
```
---
## 9. Troubleshooting
### Problem: Wyświetlacz biały ekran
**Rozwiązanie:**
1. Sprawdź czy `DSP_MODEL` jest poprawny
2. Sprawdź piny SPI (szczególnie CS, DC, RST)
3. Sprawdź zasilanie 3.3V
4. Spróbuj ustawić `TFT_RST` na konkretny pin zamiast -1
### Problem: Brak dźwięku
**Rozwiązanie:**
1. Sprawdź piny I2S (DOUT, BCLK, LRC)
2. Sprawdź czy DAC jest zasilany
3. Sprawdź URL stacji w przeglądarce
4. Zobacz logi: `task monitor`
### Problem: ESP32 się restartuje
**Rozwiązanie:**
1. Sprawdź zasilanie (stabilne 5V, min 1A)
2. Obniż `CORE_DEBUG_LEVEL` do 2
3. Sprawdź czy nie ma konfliktu pinów
4. Zobacz logi przed restartem
### Problem: Serial Monitor nie działa
**Rozwiązanie:**
1. Sprawdź czy `ARDUINO_USB_CDC_ON_BOOT=1` w `platformio.ini`
2. Sprawdź port: `task list-ports`
3. Spróbuj innego kabla USB
4. Restart ESP32
### Problem: Nie łączy się z WiFi
**Rozwiązanie:**
1. Sprawdź format `wifi.csv` (TAB separator!)
2. Sprawdź hasło WiFi
3. Zobacz logi: `task monitor`
4. Połącz się z AP: `yoRadioAP` / `12345987`
---
## 10. Linki i dokumentacja
- **GitHub projektu:** https://github.com/e2002/yoradio
- **Wiki:** https://github.com/e2002/yoradio/wiki
- **Dostępne wyświetlacze:** https://github.com/e2002/yoradio/wiki/Available-display-models
- **Schemat pinów:** https://github.com/e2002/yoradio#connection-tables
- **ESP32-S3 pinout:** http://wiki.fluidnc.com/en/hardware/ESP32-S3_Pin_Reference
- **Forum:** https://github.com/e2002/yoradio/discussions
---
## Autor konfiguracji
Konfiguracja stworzona dla ESP32-S3 DevKitC-1 z wyświetlaczem ILI9341 i DAC PCM5102.
Data: 2026-02-22

196
Taskfile.yml Normal file
View File

@@ -0,0 +1,196 @@
version: '3'
vars:
PROJECT_DIR: '{{.TASKFILE_DIR}}/yoRadio'
PLATFORMIO_INI: '{{.PROJECT_DIR}}/platformio.ini'
tasks:
init:
desc: Inicjalizacja projektu PlatformIO
dir: '{{.PROJECT_DIR}}'
cmds:
- |
if [ ! -f platformio.ini ]; then
cat > platformio.ini << 'EOF'
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
upload_speed = 921600
board_build.partitions = min_spiffs.csv
board_build.flash_mode = dio
build_flags =
-DCORE_DEBUG_LEVEL=0
-DBOARD_HAS_PSRAM
lib_deps =
adafruit/Adafruit GFX Library
adafruit/Adafruit ST7735 and ST7789 Library
adafruit/Adafruit SSD1306
adafruit/Adafruit PCD8544 Nokia 5110 LCD library
adafruit/Adafruit SH110X
adafruit/Adafruit SSD1327
adafruit/Adafruit ILI9341
adafruit/Adafruit SSD1305
nkawu/TFT 22 ILI9225
mathertel/OneButton
crankyoldgit/IRremoteESP8266
paulstoffregen/XPT2046_Touchscreen
adafruit/RTClib
EOF
fi
status:
- test -f "{{.PLATFORMIO_INI}}"
build:
desc: Kompilacja projektu
dir: '{{.PROJECT_DIR}}'
deps: [init]
cmds:
- pio run
sources:
- src/**/*.cpp
- src/**/*.h
- yoRadio.ino
generates:
- .pio/build/esp32dev/firmware.bin
upload:
desc: Wgranie projektu na ESP32
dir: '{{.PROJECT_DIR}}'
deps: [init]
cmds:
- pio run --target upload
upload-port:
desc: Wgranie projektu na ESP32 (z wyborem portu)
dir: '{{.PROJECT_DIR}}'
deps: [init]
cmds:
- pio run --target upload --upload-port {{.CLI_ARGS}}
requires:
vars: [CLI_ARGS]
monitor:
desc: Monitor szeregowy
dir: '{{.PROJECT_DIR}}'
cmds:
- pio device monitor
interactive: true
clean:
desc: Czyszczenie projektu
dir: '{{.PROJECT_DIR}}'
cmds:
- pio run --target clean
- rm -rf .pio
upload-fs:
desc: Wgranie systemu plików (SPIFFS) na ESP32
dir: '{{.PROJECT_DIR}}'
deps: [init]
cmds:
- echo "Sprawdzam pliki konfiguracyjne..."
- ls -lh data/data/*.csv || echo "Brak plików CSV"
- pio run --target uploadfs
preconditions:
- sh: test -d data
msg: "Katalog 'data' nie istnieje"
list-ports:
desc: Lista dostępnych portów szeregowych
cmds:
- pio device list
erase:
desc: Wymazanie flash ESP32
dir: '{{.PROJECT_DIR}}'
cmds:
- pio run --target erase
build-upload:
desc: Kompilacja i wgranie projektu
dir: '{{.PROJECT_DIR}}'
cmds:
- task: build
- task: upload
build-upload-monitor:
desc: Kompilacja, wgranie i monitor
dir: '{{.PROJECT_DIR}}'
cmds:
- task: build
- task: upload
- task: monitor
full-flash:
desc: Pełne wgranie (firmware + filesystem)
dir: '{{.PROJECT_DIR}}'
cmds:
- task: build
- task: upload
- task: upload-fs
kill-monitor:
desc: Zabij procesy blokujące port szeregowy
cmds:
- pkill -f "pio.*monitor" || true
- pkill -f "python.*monitor" || true
- sleep 1
update-libs:
desc: Aktualizacja bibliotek
dir: '{{.PROJECT_DIR}}'
cmds:
- pio pkg update
info:
desc: Informacje o projekcie
dir: '{{.PROJECT_DIR}}'
cmds:
- echo "Projekt yoRadio ESP32-S3"
- echo "===================="
- pio project metadata
- echo ""
- echo "Dostępne porty:"
- pio device list
- echo ""
- echo "Konfiguracja pinów (myoptions.h):"
- echo " Display ILI9341 - TFT_CS=10, TFT_RST=9, TFT_DC=11"
- echo " I2S DAC - DOUT=17, BCLK=16, LRC=15"
- echo " Encoder1 - L=1, B=2, R=3"
- echo " Encoder2 - L=38, B=39, R=40"
monitor-raw:
desc: Monitor bez filtrów (raw output)
dir: '{{.PROJECT_DIR}}'
cmds:
- pio device monitor --raw
interactive: true
reset:
desc: Reset ESP32 (hard reset)
dir: '{{.PROJECT_DIR}}'
cmds:
- pio device monitor --echo --eol LF --raw --exit-char 3 -b 115200 -f send_on_enter -f colorize -f time
interactive: true
test-serial:
desc: Test prostego programu do sprawdzenia Serial
dir: '{{.PROJECT_DIR}}'
cmds:
- echo "Tworze prosty test Serial..."
- |
cat > test_platformio.ini << 'EOF'
[env:esp32s3-test]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
build_flags =
-DCORE_DEBUG_LEVEL=5
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
EOF
- echo "Kompiluje test..."
- pio ci --lib="." --board=esp32-s3-devkitc-1 test_serial.ino || echo "Test compilation failed"

View File

@@ -15,7 +15,7 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
/* DSP_MODEL. See description/available values in https://github.com/e2002/yoradio/wiki/Available-display-models */ /* DSP_MODEL. See description/available values in https://github.com/e2002/yoradio/wiki/Available-display-models */
/* This option is required. Use DSP_DUMMY if no display is connected */ /* This option is required. Use DSP_DUMMY if no display is connected */
#define DSP_MODEL DSP_DUMMY #define DSP_MODEL DSP_ILI9341
/* /*
* !!! Important !!! * !!! Important !!!
* if you use colored TFT displays with the esp32 wroom, due to lack of memory, you must modify the file Arduino/libraries/AsyncTCP/src/AsyncTCP.cpp * if you use colored TFT displays with the esp32 wroom, due to lack of memory, you must modify the file Arduino/libraries/AsyncTCP/src/AsyncTCP.cpp
@@ -29,9 +29,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
/* VSPI PINS. SCL(SCK, CLK) must be connected to pin 18 /* VSPI PINS. SCL(SCK, CLK) must be connected to pin 18
SDA(MOSI, DIN, SDI) must be connected to pin 23 SDA(MOSI, DIN, SDI) must be connected to pin 23
for ESP32-S3 see ESP32-S3 Pin Reference http://wiki.fluidnc.com/en/hardware/ESP32-S3_Pin_Reference*/ for ESP32-S3 see ESP32-S3 Pin Reference http://wiki.fluidnc.com/en/hardware/ESP32-S3_Pin_Reference*/
//#define TFT_CS 5 /* SPI CS pin */ #define TFT_CS 10 /* SPI CS pin */
//#define TFT_RST 15 /* SPI RST pin. set to -1 and connect to Esp EN pin */ #define TFT_RST 15 /* SPI RST pin. set to -1 and connect to Esp EN pin */
//#define TFT_DC 4 /* SPI DC/RS pin */ #define TFT_DC 4 /* SPI DC/RS pin */
/* HSPI PINS. SCL(SCK, CLK) must be connected to pin 14 /* HSPI PINS. SCL(SCK, CLK) must be connected to pin 14
SDA(MOSI, DIN, SDI) must be connected to pin 13 */ SDA(MOSI, DIN, SDI) must be connected to pin 13 */
// #define DSP_HSPI false /* Use HSPI for display */ // #define DSP_HSPI false /* Use HSPI for display */
@@ -66,9 +66,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
/******************************************/ /******************************************/
/* ENCODER */ /* ENCODER */
//#define ENC_BTNL 255 /* Left rotation */ #define ENC_BTNL 4 /* Left rotation */
//#define ENC_BTNB 255 /* Encoder button */ #define ENC_BTNB 6 /* Encoder button */
//#define ENC_BTNR 255 /* Right rotation */ #define ENC_BTNR 5 /* Right rotation */
// #define ENC_INTERNALPULLUP true /* Enable the weak pull up resistors */ // #define ENC_INTERNALPULLUP true /* Enable the weak pull up resistors */
// #define ENC_HALFQUARD true /* Experiment with it */ // #define ENC_HALFQUARD true /* Experiment with it */
/******************************************/ /******************************************/
@@ -90,9 +90,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
// #define RTC_SCL 255 /* RTC_SCL */ // #define RTC_SCL 255 /* RTC_SCL */
/* ENCODER2 */ /* ENCODER2 */
//#define ENC2_BTNL 255 /* Left rotation */ #define ENC2_BTNL 7 /* Left rotation */
//#define ENC2_BTNB 255 /* Encoder button */ #define ENC2_BTNB 8 /* Encoder button */
//#define ENC2_BTNR 255 /* Right rotation */ #define ENC2_BTNR 18 /* Right rotation */
// #define ENC2_INTERNALPULLUP true /* Enable the weak pull up resistors */ // #define ENC2_INTERNALPULLUP true /* Enable the weak pull up resistors */
// #define ENC2_HALFQUARD false /* (true, false, 255) Experiment with it */ // #define ENC2_HALFQUARD false /* (true, false, 255) Experiment with it */
/******************************************/ /******************************************/
@@ -170,5 +170,4 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
/******************************************/ /******************************************/
#endif #endif

35
yoRadio/myoptions.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef myoptions_h
#define myoptions_h
#define L10N_LANGUAGE RU
#define DSP_MODEL DSP_ILI9341
#define TFT_MOSI 11
#define TFT_SCLK 12
#define TFT_MISO 13
#define TFT_CS 10
#define TFT_RST -1
#define TFT_DC 9
#define I2S_DOUT 16
#define I2S_BCLK 17
#define I2S_LRC 15
#define ENC_BTNL 5
#define ENC_BTNB 6
#define ENC_BTNR 4
#define ENC_INTERNALPULLUP true
#define ENC_HALFQUARD true
#define ENC2_BTNL 18
#define ENC2_BTNB 8
#define ENC2_BTNR 7
#define ENC2_INTERNALPULLUP true
#define ENC2_HALFQUARD false
#define BRIGHTNESS_PIN 14
#define IR_PIN 21
#endif

27
yoRadio/platformio.ini Normal file
View File

@@ -0,0 +1,27 @@
[env:esp32dev]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
upload_speed = 921600
board_build.partitions = min_spiffs.csv
board_build.flash_mode = dio
build_flags =
-DCORE_DEBUG_LEVEL=4
-DBOARD_HAS_PSRAM
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
lib_deps =
adafruit/Adafruit GFX Library
adafruit/Adafruit ST7735 and ST7789 Library
adafruit/Adafruit SSD1306
adafruit/Adafruit PCD8544 Nokia 5110 LCD library
adafruit/Adafruit SH110X
adafruit/Adafruit SSD1327
adafruit/Adafruit ILI9341
adafruit/Adafruit SSD1305
nkawu/TFT 22 ILI9225
mathertel/OneButton
crankyoldgit/IRremoteESP8266
paulstoffregen/XPT2046_Touchscreen
adafruit/RTClib

View File

@@ -3,107 +3,413 @@
#include "../dspcore.h" #include "../dspcore.h"
#include "utf8Rus.h" #include "utf8Rus.h"
size_t strlen_utf8(const char* s) { #ifndef DSP_LCD
size_t count = 0; // Polish chars: ąćęłńóśźż ĄĆĘŁŃÓŚŹŻ
while (*s) {
count++;
if ((*s & 0xF0) == 0xF0) { // 4-byte character
s += 4;
} else if ((*s & 0xE0) == 0xE0) { // 3-byte character
s += 3;
} else if ((*s & 0xC0) == 0xC0) { // 2-byte character
s += 2;
} else { // 1-byte character (ASCII)
s += 1;
}
}
return count;
}
char* utf8Rus(const char* str, bool uppercase) { char* utf8Rus(const char* str, bool uppercase) {
static char out[BUFLEN]; int index = 0;
int outPos = 0; static char strn[BUFLEN];
#if defined(DSP_LCD) && !defined(LCD_RUS) strlcpy(strn, str, BUFLEN);
static const char* mapD0[] = {
"A","B","V","G","D","E","ZH","Z","I","Y", if (uppercase) { // Przełącz wielkie i małe litery
"K","L","M","N","O","P","R","S","T","U", for (char *iter = strn; *iter != '\0'; ++iter)
"F","H","TS","CH","SH","SHCH","'","YU","'","E","YU","YA" *iter = toupper(*iter);
};
#endif
#if defined(DSP_LCD) && defined(LCD_RUS)
// except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
static const unsigned char utf_recode[] PROGMEM =
{
0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,
0xbe,0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7
};
#endif
for (int i = 0; str[i] && outPos < BUFLEN - 1; i++) {
uint8_t c = (uint8_t)str[i];
if (c == 0xD0 && str[i+1]) {
uint8_t n = (uint8_t)str[++i];
if (n == 0x81) { // Ё
#if defined(DSP_LCD) && !defined(LCD_RUS)
const char* t = "YO";
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
#else
out[outPos++] = uppercase ? 0xA8 : 0xB8;
#endif
} else if (n >= 144 && n <= 191) {
#if defined(DSP_LCD) && !defined(LCD_RUS)
if(n>=176) n-=32;
const char* t = mapD0[n - 0x90];
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
#else
#if defined(DSP_LCD) && defined(LCD_RUS)
if(n>=176) n-=32;
out[outPos++] = utf_recode[n - 0x90];
#else
uint8_t ch = n + 48;
if(n>=176 && uppercase) ch-=32;
out[outPos++] = ch;
#endif
#endif
}
} else if (c == 0xD1 && str[i+1]) {
uint8_t n = (uint8_t)str[++i];
if (n == 0x91) { // ё
#if defined(DSP_LCD) && !defined(LCD_RUS)
const char* t = "YO";
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
#else
out[outPos++] = uppercase ? 0xA8 : 0xB8;
#endif
} else if (n >= 128 && n <= 143) {
#if defined(DSP_LCD) && !defined(LCD_RUS)
n+=16;
const char* t = mapD0[n - 128];
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
#else
#if defined(DSP_LCD) && defined(LCD_RUS)
n+=16;
out[outPos++] = utf_recode[n - 128];
#else
uint8_t ch = n + 112;
if(uppercase) ch-=32;
out[outPos++] = ch;
#endif
#endif
}
} else { // ASCII
#if defined(DSP_LCD) && !defined(LCD_RUS)
char ch = (char)toupper(c);
if (ch == 7) ch = (char)165;
if (ch == 9) ch = (char)223;
out[outPos++] = ch;
#else
out[outPos++] = uppercase ? toupper(c) : c;
#endif
}
}
out[outPos] = 0;
return out;
} }
if(L10N_LANGUAGE==EN) return strn;
while (strn[index])
{
if (strn[index] == 0xC5) // Jeśli pierwszym bajtem znaków UTF-8 jest C5, umieść je wszystkie w tej grupie!
{
switch (strn[index + 1]) {
case 0x82: {
if (!uppercase){
strn[index] = 0xCf;} // *ł
else {
strn[index] = 0xD0;} // *Ł
break;
}
case 0x81: {
strn[index] = 0xD0; // *Ł
break;
}
case 0x84: {
if (!uppercase){
strn[index] = 0xC0;} // *ń
else {
strn[index] = 0xC1;} // *Ń
break;
}
case 0x83: {
strn[index] = 0xC1; // *Ń
break;
}
case 0x9B: {
if (!uppercase){
strn[index] = 0xCB;} // *ś
else {
strn[index] = 0xCC;} // *Ś
break;
}
case 0x9A: {
strn[index] = 0xCC; // *Ś
break;
}
case 0xBA: {
if (!uppercase){
strn[index] = 0xBB;} // *ź
else {
strn[index] = 0xBC;} // *Ź
break;
}
case 0xB9: {
strn[index] = 0xBC; // *Ź
break;
}
case 0xBC: {
if (!uppercase){
strn[index] = 0xB9;} // *ż
else {
strn[index] = 0xBA;} // *Ż
break;
}
case 0xBB: {
strn[index] = 0xBA; // *Ż
break;
}
//slovakia
case 0x88: {
if (!uppercase){
strn[index] = 0xB4;} // *ň
else {
strn[index] = 0xB3;} // *Ň
break;
}
case 0x87: {
strn[index] = 0xB3; // *Ň
break;
}
case 0x95: {
if (!uppercase){
strn[index] = 0xB6;} // *ř
else {
strn[index] = 0xB5;} // *Ŕ
break;
}
case 0x94: {
strn[index] = 0xB5; // *Ŕ
break;
}
case 0xA1: {
if (!uppercase){
strn[index] = 0xC3;} // *š
else {
strn[index] = 0xC2;} // *Š
break;
}
case 0xA0: {
strn[index] = 0xC2; // *Š
break;
}
case 0xA5: {
if (!uppercase){
strn[index] = 0xC6;} // *ť
else {
strn[index] = 0xC5;} // *Ť
break;
}
case 0xA4: {
strn[index] = 0xC5; // *Ť
break;
}
case 0xBE: {
if (!uppercase){
strn[index] = 0xC8;} // *ž
else {
strn[index] = 0xC7;} // *Ž
break;
}
case 0xBD: {
strn[index] = 0xC7; // *Ž
break;
}
case 0xAE: {
if (!uppercase){
strn[index] = 0xE8;} // *ů
else {
strn[index] = 0x9D;} // *Ů
break;
}
case 0xAF: {
strn[index] = 0x9D; // *Ů
break;
}
}
int sind = index + 2;
while (strn[sind]) {
strn[sind - 1] = strn[sind];
sind++;
}
strn[sind - 1] = 0;
}
if (strn[index] == 0xC4) // Jeśli pierwszym bajtem znaków UTF-8 jest C4, umieść je wszystkie w tej grupie!
{
switch (strn[index + 1]) {
case 0x85: {
if (!uppercase){
strn[index] = 0xB8;} // *ą
else {
strn[index] = 0xB7;} // *Ą
break;
}
case 0x84 : {
strn[index] = 0xB7; // *Ą
break;
}
case 0x87: {
if (!uppercase){
strn[index] = 0xBD;} // *ć
else {
strn[index] = 0xC4;} // *Ć
break;
}
case 0x86: {
strn[index] = 0xC4; // *Ć
break;
}
case 0x99: {
if (!uppercase){
strn[index] = 0xD6;} // *ę
else {
strn[index] = 0xD7;} // *Ę
break;
}
case 0x98: {
strn[index] = 0xD7; // *Ę
break;
}
// Slovakia chars:
case 0x8D: {
if (!uppercase){
strn[index] = 0xCA;} // *č
else {
strn[index] = 0xC9;} // *Č
break;
}
case 0x8C: {
strn[index] = 0xC9; // *Č
break;
}
case 0x8E: {
if (!uppercase){
strn[index] = 0xD1;} // *ď
else {
strn[index] = 0xCE;} // *Ď
break;
}
case 0x8F: {
strn[index] = 0xCE; // *Ď
break;
}
case 0xBA: {
if (!uppercase){
strn[index] = 0xD3;} // *ĺ
else {
strn[index] = 0xD2;} // *Ĺ
break;
}
case 0xB9: {
strn[index] = 0xD2; // *Ĺ
break;
}
case 0xBE: {
if (!uppercase){
strn[index] = 0xD5;} // *ľ
else {
strn[index] = 0xD4;} // *Ľ
break;
}
case 0xBD: {
strn[index] = 0xD4; // *Ľ
break;
}
}
int sind = index + 2;
while (strn[sind]) {
strn[sind - 1] = strn[sind];
sind++;
}
strn[sind - 1] = 0;
}
if (strn[index] == 0xC3) // Jeśli pierwszym bajtem znaków UTF-8 jest C3, umieść je wszystkie w tej grupie!
{
switch (strn[index + 1]) {
case 0xB3: {
if (!uppercase){
strn[index] = 0xBE;} // *ó
else {
strn[index] = 0xBF;} // *Ó
break;
}
case 0x93: {
strn[index] = 0xBF; // *Ó
break;
}
// deutschland chars: äöü ÄÖÜ ß é
case 0xA4: {
if (!uppercase){ // ä
strn[index] = 0x84;}
else {
strn[index] = 0x8E;} // Ä
break;
}
case 0xB6: {
if (!uppercase){ // ö
strn[index] = 0x94;}
else {
strn[index] = 0x99;} // Ö
break;
}
case 0xBC: {
if (!uppercase){ // ü
strn[index] = 0x81;}
else {
strn[index] = 0x9A;} // Ü
break;
}
case 0x84: { // Ä
strn[index] = 0x8E;
break;
}
case 0x96: { // Ö
strn[index] = 0x99;
break;
}
case 0x9C: { // Ü
strn[index] = 0x9A;
break;
}
case 0x9F: { // ß
strn[index] = 0xE1;
break;
}
// Slovakia
case 0xA1: {
if (!uppercase){
strn[index] = 0xD9;} // *á
else {
strn[index] = 0xD8;} // *Á
break;
}
case 0x81: {
strn[index] = 0xD8; // *Á
break;
}
case 0xA9: {
if (!uppercase){
strn[index] = 0x82;} // *é
else {
strn[index] = 0x90;} // *É
break;
}
case 0x89: {
strn[index] = 0x90; // *É
break;
}
case 0xAD: {
if (!uppercase){
strn[index] = 0xDB;} // *í
else {
strn[index] = 0xDA;} // *Í
break;
}
case 0x8D: {
strn[index] = 0xDA; // *Í
break;
}
case 0xB4: {
if (!uppercase){
strn[index] = 0xDD;} // *ô
else {
strn[index] = 0xDC;} // *Ô
break;
}
case 0x94: {
strn[index] = 0xDC; // *Ô
break;
}
case 0xBA: {
if (!uppercase){
strn[index] = 0xDF;} // *ú
else {
strn[index] = 0xDE;} // *Ú
break;
}
case 0x9A: {
strn[index] = 0xDE; // *Ú
break;
}
case 0xBD: {
if (!uppercase){
strn[index] = 0xE3;} // *ý
else {
strn[index] = 0xE2;} // *Ý
break;
}
case 0x9D: {
strn[index] = 0xE2; // *Ý
break;
}
}
int sind = index + 2;
while (strn[sind]) {
strn[sind - 1] = strn[sind];
sind++;
}
strn[sind - 1] = 0;
}
// Wstaw tutaj swoją korektę na dalsze czcionki...
index++;
}
return strn;
}
#endif //#ifndef DSP_LCD