Skip to content

Commit 124d1b9

Browse files
committed
AP default channel 6 (thx wled), activeAP (also ETH)
1 parent bdab279 commit 124d1b9

File tree

13 files changed

+57
-24
lines changed

13 files changed

+57
-24
lines changed

factory_settings.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build_flags =
1616
-D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED
1717
-D FACTORY_AP_SSID=\"ML-#{unique_id}\" ; 1-64 characters, supports placeholders
1818
-D FACTORY_AP_PASSWORD=\"\" ; 8-64 characters ; 🌙 empty no password needed
19-
-D FACTORY_AP_CHANNEL=1
19+
-D FACTORY_AP_CHANNEL=6 ; // 🌙: See https://github.com/wled/WLED/commit/fc7993f4a7241739d1878df25fd4600100abc506
2020
-D FACTORY_AP_SSID_HIDDEN=false
2121
-D FACTORY_AP_MAX_CLIENTS=4
2222
-D FACTORY_AP_LOCAL_IP=\"4.3.2.1\" ; 🌙

lib/framework/APSettingsService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#endif
5151

5252
#ifndef FACTORY_AP_CHANNEL
53-
#define FACTORY_AP_CHANNEL 1
53+
#define FACTORY_AP_CHANNEL 6 // 🌙: See https://github.com/wled/WLED/commit/fc7993f4a7241739d1878df25fd4600100abc506
5454
#endif
5555

5656
#ifndef FACTORY_AP_SSID_HIDDEN

lib/framework/FSPersistence.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class FSPersistence
176176
virtual void applyDefaults()
177177
{
178178
JsonDocument jsonDocument;
179-
JsonObject jsonObject = jsonDocument.as<JsonObject>();
179+
JsonObject jsonObject = jsonDocument.to<JsonObject>(); // 🌙: to instead of as
180180
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
181181
}
182182
};

src/MoonBase/Module.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,6 @@ class Module : public StatefulService<ModuleState> {
180180
EventSocket* _socket;
181181
void readFromFS() { // used in ModuleEffects, for live scripts...
182182
_fsPersistence.readFromFS(); // overwrites the default settings in state
183-
// sizeof(StatefulService<ModuleState>); // 200
184-
// sizeof(_server); // 8
185-
// sizeof(HttpEndpoint<ModuleState>); // 152
186-
// sizeof(EventEndpoint<ModuleState>); // 112
187-
// sizeof(WebSocketServer<ModuleState>); // 488
188-
// sizeof(FSPersistence<ModuleState>); // 128
189-
// sizeof(PsychicHttpServer*); // 8
190-
// sizeof(HttpEndpoint<APSettings>); // 152
191-
// sizeof(FSPersistence<APSettings>); // 128
192-
// sizeof(Module); // 1144
193183
}
194184

195185
private:

src/MoonBase/Modules/ModuleDevices.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ class ModuleDevices : public Module {
127127
message.name = esp32sveltekit.getWiFiSettingsService()->getHostname().c_str();
128128
deviceUDP.write((uint8_t*)&message, sizeof(message));
129129
deviceUDP.endPacket();
130-
// EXT_LOGD(MB_TAG, "UDP packet written (%s -> %d)", message.name.c_str(), WiFi.localIP()[3]);
131130

132-
updateDevices(message.name.c_str(), WiFi.localIP());
131+
IPAddress activeIP = WiFi.localIP() ? WiFi.localIP() : ETH.localIP();
132+
// EXT_LOGD(MB_TAG, "UDP packet written (%s -> %d)", message.name.c_str(), activeIP[3]);
133+
updateDevices(message.name.c_str(), activeIP);
133134
}
134135
}
135136
};

src/MoonBase/Modules/ModuleTasks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class ModuleTasks : public Module {
9696
}
9797

9898
Char<32> summary;
99-
summary.format("%s %d%% @ P%d", state, 100 * ts->ulRunTimeCounter / totalRunTime, ts->uxCurrentPriority);
99+
summary.format("%s %d%% @ P%d", state, (uint32_t)(100ULL * ts->ulRunTimeCounter / totalRunTime), ts->uxCurrentPriority);
100100

101101
task["name"] = ts->pcTaskName;
102102
task["summary"] = summary.c_str();

src/MoonBase/SharedEventEndpoint.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
// src/MoonBase/SharedEventEndpoint.h
1+
/**
2+
@title MoonBase
3+
@file SharedEventEndpoint.h
4+
@repo https://github.com/MoonModules/MoonLight, submit changes to this file as PRs
5+
@Authors https://github.com/MoonModules/MoonLight/commits/main
6+
@Doc https://moonmodules.org/MoonLight/moonbase/overview/
7+
@Copyright © 2025 Github MoonLight Commit Authors
8+
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
9+
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact us for more information.
10+
**/
11+
212
#ifndef SharedEventEndpoint_h
313
#define SharedEventEndpoint_h
414

src/MoonBase/SharedFSPersistence.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
// src/MoonBase/SharedFSPersistence.h
1+
/**
2+
@title MoonBase
3+
@file SharedFSPersistence.h
4+
@repo https://github.com/MoonModules/MoonLight, submit changes to this file as PRs
5+
@Authors https://github.com/MoonModules/MoonLight/commits/main
6+
@Doc https://moonmodules.org/MoonLight/moonbase/overview/
7+
@Copyright © 2025 Github MoonLight Commit Authors
8+
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
9+
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact us for more information.
10+
**/
11+
212
#ifndef SharedFSPersistence_h
313
#define SharedFSPersistence_h
414

@@ -60,7 +70,7 @@ class SharedFSPersistence {
6070
void enableUpdateHandler(const String& moduleName) {
6171
auto it = _modules.find(moduleName);
6272
if (it != _modules.end() && !it->second.updateHandlerId) {
63-
it->second.updateHandlerId = it->second.module->addUpdateHandler([this, moduleName](const String& originId) { writeToFS(moduleName); }, false);
73+
it->second.updateHandlerId = it->second.module->addUpdateHandler([this, module = it->second.module](const String& originId) { writeToFS(module->_moduleName); }, false);
6474
}
6575
}
6676

src/MoonBase/SharedHttpEndpoint.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
// In a new file: lib/framework/SharedHttpEndpoint.h
1+
/**
2+
@title MoonBase
3+
@file SharedHttpEndpoint.h
4+
@repo https://github.com/MoonModules/MoonLight, submit changes to this file as PRs
5+
@Authors https://github.com/MoonModules/MoonLight/commits/main
6+
@Doc https://moonmodules.org/MoonLight/moonbase/overview/
7+
@Copyright © 2025 Github MoonLight Commit Authors
8+
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
9+
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact us for more information.
10+
**/
11+
212
#ifndef SharedHttpEndpoint_h
313
#define SharedHttpEndpoint_h
414

src/MoonBase/SharedWebSocketServer.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
// In lib/framework/SharedWebSocketServer.h
1+
/**
2+
@title MoonBase
3+
@file SharedWebSocketServer.h
4+
@repo https://github.com/MoonModules/MoonLight, submit changes to this file as PRs
5+
@Authors https://github.com/MoonModules/MoonLight/commits/main
6+
@Doc https://moonmodules.org/MoonLight/moonbase/overview/
7+
@Copyright © 2025 Github MoonLight Commit Authors
8+
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
9+
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact us for more information.
10+
**/
11+
212
#ifndef SharedWebSocketServer_h
313
#define SharedWebSocketServer_h
414

0 commit comments

Comments
 (0)