Skip to content

Commit 53b9480

Browse files
committed
prepare for V4 (part2)
timezones.csv is obsolete and therefore deleted in zip process timezones_json in index.h instead timezones.csv delete some ESP32 partitions
1 parent 102b819 commit 53b9480

File tree

8 files changed

+29
-216
lines changed

8 files changed

+29
-216
lines changed

Content_on_SD_Card.zip

-3.79 KB
Binary file not shown.

boards/ESP32-Dev-16MB.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

boards/ESP32-Dev-4MB.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

boards/ESP32-Dev-8MB.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

boards/ESP32-S3-DevKitC-1-N8R2.json

Lines changed: 0 additions & 43 deletions
This file was deleted.

platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ custom_component_remove = espressif/esp_hosted
6666

6767
lib_deps =
6868
https://github.com/schreibfaul1/ESP32-audioI2S.git
69-
https://github.com/schreibfaul1/ESP32-KCX-BT-EMITTER.git#6181da6 ;27.12.2024
69+
https://github.com/schreibfaul1/ESP32-KCX-BT-EMITTER.git
7070
https://github.com/schreibfaul1/ESP32-DLNA-Client.git
71-
https://github.com/schreibfaul1/ESP32-IR-Remote-Control.git#c371281 ;05.01.2025
71+
https://github.com/schreibfaul1/ESP32-IR-Remote-Control.git
7272

7373
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
7474
[env:esp32s3]

src/index.h

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* index.h
33
*
44
* Created on: 04.10.2018
5-
* Updated on: 27.03.2025
5+
* Updated on: 11.04.2025
66
* Author: Wolle
77
*
88
* successfully tested with Chrome and Firefox
@@ -527,7 +527,7 @@ function connect() {
527527
if (n >= 0) {
528528
var msg = socketMsg.substring(0, n)
529529
var val = socketMsg.substring(n + 1)
530-
console.log("para ",msg, " val ",val)
530+
// console.log("para ",msg, " val ",val)
531531
}
532532
else {
533533
msg = socketMsg
@@ -695,6 +695,9 @@ function connect() {
695695
bt_RxTx = 'RX'
696696
}
697697
break;
698+
case "timezones": console.log(msg, val)
699+
fillTimeZoneSelect(val)
700+
break;
698701
default: console.log('unknown message', msg, val)
699702
}
700703
}
@@ -888,14 +891,13 @@ function showTab6 () {
888891
document.getElementById('btn5').src = 'SD/png/Search_Green.png'
889892
document.getElementById('btn6').src = 'SD/png/Settings_Yellow.png'
890893
document.getElementById('btn7').src = 'SD/png/About_Green.png'
891-
// getTimeZoneName()
892-
loadTimeZones()
893894
loadRingVolume()
894895
loadVolumeAfterAlarm()
895896
loadVolumeSteps()
896897
socket.send('getRingVolume')
897898
socket.send('getVolAfterAlarm')
898899
socket.send("getTimeSpeechLang")
900+
socket.send("getTimeZones") // fetch timezones_json
899901
}
900902
901903
function showTab7 () {
@@ -1997,7 +1999,6 @@ function getTimeZoneName() {
19971999
console.log("timeout in getTimeZoneName()");
19982000
reject("Fehler: Anfragezeitüberschreitung"); // Promise ablehnen, falls ein Timeout auftritt
19992001
};
2000-
20012002
xhr.send();
20022003
});
20032004
}
@@ -2008,48 +2009,26 @@ function setTimeZone(selectObject){
20082009
socket.send("setTimeZone=" + txt + "&" + value)
20092010
}
20102011
2011-
async function loadTimeZones() {
2012-
try {
2013-
g_timeZoneName = await getTimeZoneName(); // Warten, bis getTimeZoneName abgeschlossen ist
2014-
const tzFile = new XMLHttpRequest();
2015-
tzFile.timeout = 2000; // Zeit in Millisekunden
2016-
tzFile.open('GET', 'SD_Download?/timezones.csv', true);
2017-
2018-
tzFile.onreadystatechange = function () {
2019-
if (tzFile.readyState === 4) {
2020-
const tzdata = tzFile.responseText;
2021-
const tzNames = tzdata.split("\n");
2022-
const select = document.getElementById('TimeZoneSelect');
2023-
select.options.length = 0;
2024-
2025-
for (let i = 0; i < tzNames.length; i++) {
2026-
const [tzItem1, tzItem2] = tzNames[i].split("\t");
2027-
if (!tzItem1 || !tzItem2) continue;
2028-
2029-
const opt = document.createElement('OPTION');
2030-
opt.text = tzItem1;
2031-
opt.value = tzItem2;
2032-
select.add(opt);
2033-
}
2034-
2035-
// Auswahl basierend auf g_timeZoneName setzen
2036-
for (let i = 0; i < select.options.length; i++) {
2037-
if (select.options[i].text === g_timeZoneName) {
2038-
select.selectedIndex = i;
2039-
break;
2040-
}
2041-
}
2012+
function fillTimeZoneSelect(timezones_json){
2013+
const timezones = JSON.parse(timezones_json);
2014+
const selectElement = document.getElementById('TimeZoneSelect');
2015+
timezones.forEach(([name, offset]) => {
2016+
const option = document.createElement('option');
2017+
option.value = offset;
2018+
option.textContent = name;
2019+
selectElement.appendChild(option);
2020+
});
2021+
getTimeZoneName().then((tzName) => {
2022+
const selectElement = document.getElementById('TimeZoneSelect');
2023+
for (let i = 0; i < selectElement.options.length; i++) {
2024+
if (selectElement.options[i].text === tzName) {
2025+
selectElement.selectedIndex = i;
2026+
break;
20422027
}
2043-
};
2044-
2045-
tzFile.ontimeout = () => {
2046-
console.log("load SD/timezones.csv timeout");
2047-
};
2048-
2049-
tzFile.send();
2050-
} catch (error) {
2051-
console.error("Fehler beim Laden des Zeitzonennamens:", error);
2052-
}
2028+
}
2029+
}).catch((error) => {
2030+
console.error("Fehler beim Abrufen des Zeitzonennamens:", error);
2031+
});
20532032
}
20542033
20552034
function loadRingVolume(){

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MiniWebRadio -- Webradio receiver for ESP32-S3
55
66
first release on 03/2017 */char Version[] ="\
7-
Version 3.7-rc1.r - Apr 10/2025 ";
7+
Version 3.7-rc1.s - Apr 11/2025 ";
88

99
/* display (320x240px) with controller ILI9341 or
1010
display (480x320px) with controller ILI9486 or ILI9488 (SPI) or
@@ -4245,7 +4245,7 @@ void WEBSRV_onCommand(const String cmd, const String param, const String arg){
42454245

42464246
if(cmd == "get_tftSize"){ webSrv.send("tftSize=", _tftSize); return;};
42474247

4248-
if(cmd == "getTimeZones"){ webSrv.streamfile(SD_MMC, "/timezones.csv"); return;}
4248+
if(cmd == "getTimeZones"){ webSrv.send("timezones=", timezones_json); return;}
42494249

42504250
if(cmd == "setTimeZone"){ _TZName = param; _TZString = arg;
42514251
SerialPrintfln("Timezone: .. " ANSI_ESC_BLUE "%s, %s", param.c_str(), arg.c_str());

0 commit comments

Comments
 (0)