Skip to content

Commit 41fea14

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 42e6ec1 + c419a75 commit 41fea14

15 files changed

+13611
-13575
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ ssl_certs/cacert.pem
2424
/scripts/__pycache__
2525
/site
2626
.DS_Store
27+
*.bak

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [WIP] - Next Release
6+
7+
### Added
8+
9+
- Add originID to StateUpdateResult update [#110](https://github.com/theelims/ESP32-sveltekit/pull/110)
10+
- Add originID to StateUpdateResult update [#110](https://github.com/theelims/ESP32-sveltekit/pull/110)
11+
- Ethernet Support [#107](https://github.com/theelims/ESP32-sveltekit/pull/107)
12+
13+
### Changed
14+
15+
- Changed the width of the confirm dialog.
16+
- SvelteKit bundling as single files to reduce heap consumption.
17+
518
## [0.6.0] - 2025-11-03
619

720
> [!CAUTION]

interface/src/lib/components/ConfirmDialog.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
{@const SvelteComponent = labels?.confirm.icon}
3232
<div
3333
role="dialog"
34-
class="pointer-events-none fixed inset-0 z-50 flex items-center justify-center"
34+
class="pointer-events-none fixed inset-0 z-50 flex items-center justify-center p-4"
3535
transition:fly={{ y: 50 }}
3636
use:focusTrap
3737
>
3838
<div
39-
class="rounded-box bg-base-100 shadow-secondary/30 pointer-events-auto flex min-w-fit max-w-md flex-col justify-between p-4 shadow-lg"
39+
class="rounded-box bg-base-100 shadow-secondary/30 pointer-events-auto flex w-full max-w-xs sm:max-w-sm md:max-w-md flex-col justify-between p-4 shadow-lg overflow-hidden"
4040
>
41-
<h2 class="text-base-content text-start text-2xl font-bold">{title}</h2>
41+
<h2 class="text-base-content text-start text-2xl font-bold break-words">{title}</h2>
4242
<div class="divider my-2"></div>
43-
<p class="text-base-content mb-1 text-start">{@html message}</p>
43+
<p class="text-base-content mb-1 text-start break-words whitespace-normal">{@html message}</p>
4444
<div class="divider my-2"></div>
4545
<div class="flex justify-end gap-2">
4646
<button

interface/svelte.config.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ const config = {
88
preprocess: vitePreprocess(),
99

1010
kit: {
11-
output: {
12-
bundleStrategy: 'single'
13-
},
1411
adapter: adapter({
1512
pages: 'build',
1613
assets: 'build',
@@ -20,8 +17,10 @@ const config = {
2017
}),
2118
alias: {
2219
$src: './src'
23-
}
24-
//prerender: { default: true },
20+
},
21+
output: {
22+
bundleStrategy: 'single'
23+
}
2524
}
2625
};
2726

lib/framework/APSettingsService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class APSettings
112112
root["subnet_mask"] = settings.subnetMask.toString();
113113
}
114114

115-
static StateUpdateResult update(JsonObject &root, APSettings &settings, const String &originId) // 🌙 add originID
115+
static StateUpdateResult update(JsonObject &root, APSettings &settings, const String &originId)
116116
{
117117
APSettings newSettings = {};
118118
newSettings.provisionMode = root["provision_mode"] | FACTORY_AP_PROVISION_MODE;

lib/framework/EthernetSettingsService.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ EthernetSettingsService::EthernetSettingsService(PsychicHttpServer *server,
1818
FS *fs,
1919
SecurityManager *securityManager,
2020
EventSocket *socket) : _server(server),
21-
_securityManager(securityManager),
22-
_httpEndpoint(EthernetSettings::read, EthernetSettings::update, this, server, ETHERNET_SETTINGS_SERVICE_PATH, securityManager,
23-
AuthenticationPredicates::IS_ADMIN),
24-
_fsPersistence(EthernetSettings::read, EthernetSettings::update, this, fs, ETHERNET_SETTINGS_FILE),
25-
_socket(socket)
21+
_securityManager(securityManager),
22+
_httpEndpoint(EthernetSettings::read, EthernetSettings::update, this, server, ETHERNET_SETTINGS_SERVICE_PATH, securityManager,
23+
AuthenticationPredicates::IS_ADMIN),
24+
_fsPersistence(EthernetSettings::read, EthernetSettings::update, this, fs, ETHERNET_SETTINGS_FILE),
25+
_socket(socket)
2626
{
2727
addUpdateHandler([&](const String &originId)
2828
{ reconfigureEthernet(); },
@@ -82,11 +82,21 @@ void EthernetSettingsService::configureNetwork(ethernet_settings_t &network)
8282
// configure for DHCP
8383
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
8484
}
85-
// (re)start ethernet
85+
// (re)start ethernet
86+
#if CONFIG_IDF_TARGET_ESP32
87+
// ESP32 chips with built-in ethernet MAC/PHY
8688
ETH.begin();
89+
#elif CONFIG_IDF_TARGET_ESP32P4
90+
// todo: setup in P4
91+
#else
92+
#ifdef ETH_PHY_TYPE //only if defined
93+
// For SPI based ethernet modules like W5500, ENC28J60 etc.
94+
SPI.begin(ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI);
95+
ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI);
96+
#endif
97+
#endif
8798
// set hostname (again) after (re)starting ethernet due to a bug in the ESP-IDF implementation
8899
ETH.setHostname(_state.hostname.c_str());
89-
90100
}
91101

92102
void EthernetSettingsService::reconfigureEthernet()

lib/framework/EthernetSettingsService.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class EthernetSettings
6969
ESP_LOGV(SVK_TAG, "Ethernet Settings read");
7070
}
7171

72-
static StateUpdateResult update(JsonObject &root, EthernetSettings &settings, const String &originId) // 🌙 add originID
72+
static StateUpdateResult update(JsonObject &root, EthernetSettings &settings, const String &originId)
7373
{
7474
settings.hostname = root["hostname"] | SettingValue::format(FACTORY_ETHERNET_HOSTNAME);
7575
settings.ethernetSettings.staticIPConfig = root["static_ip_config"] | false;
@@ -121,7 +121,6 @@ class EthernetSettingsService : public StatefulService<EthernetSettings>
121121
void configureNetwork(ethernet_settings_t &network);
122122
void reconfigureEthernet();
123123
void updateEthernet();
124-
125124
};
126125

127126
#endif // end EthernetSettingsService_h

lib/framework/FSPersistence.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FSPersistence
5252
if (error == DeserializationError::Ok && jsonDocument.is<JsonObject>())
5353
{
5454
JsonObject jsonObject = jsonDocument.as<JsonObject>();
55-
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
55+
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater, _filePath);
5656
settingsFile.close();
5757
return;
5858
}
@@ -177,7 +177,7 @@ class FSPersistence
177177
{
178178
JsonDocument jsonDocument;
179179
JsonObject jsonObject = jsonDocument.to<JsonObject>(); // 🌙: to instead of as
180-
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
180+
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater, _filePath);
181181
}
182182
};
183183

lib/framework/HttpEndpoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class HttpEndpoint
8888
}
8989

9090
JsonObject jsonObject = json.as<JsonObject>();
91-
StateUpdateResult outcome = _statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
91+
StateUpdateResult outcome = _statefulService->updateWithoutPropagation(jsonObject, _stateUpdater, _servicePath);
9292

9393
if (outcome == StateUpdateResult::ERROR)
9494
{

lib/framework/MqttSettingsService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class MqttSettings
106106
root["message_interval_ms"] = settings.messageIntervalMs;
107107
}
108108

109-
static StateUpdateResult update(JsonObject &root, MqttSettings &settings, const String &originId) // 🌙 add originID
109+
static StateUpdateResult update(JsonObject &root, MqttSettings &settings, const String &originId)
110110
{
111111
settings.enabled = root["enabled"] | FACTORY_MQTT_ENABLED;
112112
settings.uri = root["uri"] | FACTORY_MQTT_URI;

0 commit comments

Comments
 (0)