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

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 "utf8Rus.h"
size_t strlen_utf8(const char* s) {
size_t count = 0;
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;
}
#ifndef DSP_LCD
// Polish chars: ąćęłńóśźż ĄĆĘŁŃÓŚŹŻ
char* utf8Rus(const char* str, bool uppercase) {
static char out[BUFLEN];
int outPos = 0;
#if defined(DSP_LCD) && !defined(LCD_RUS)
static const char* mapD0[] = {
"A","B","V","G","D","E","ZH","Z","I","Y",
"K","L","M","N","O","P","R","S","T","U",
"F","H","TS","CH","SH","SHCH","'","YU","'","E","YU","YA"
};
#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
}
int index = 0;
static char strn[BUFLEN];
strlcpy(strn, str, BUFLEN);
if (uppercase) { // Przełącz wielkie i małe litery
for (char *iter = strn; *iter != '\0'; ++iter)
*iter = toupper(*iter);
}
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