Websocket Fix, Added Clock NTP Sync, Updated MQTT IP
This commit is contained in:
@@ -342,8 +342,11 @@ void setup()
|
||||
|
||||
// Set up network callbacks
|
||||
networking.setNetworkCallbacks(
|
||||
[]() {
|
||||
[]() {
|
||||
communication.onNetworkConnected();
|
||||
// Sync time with NTP server when network becomes available
|
||||
LOG_INFO("⏰ Syncing time with NTP server...");
|
||||
timekeeper.syncTimeWithNTP();
|
||||
// Start AsyncWebServer when network becomes available
|
||||
if (networking.getState() != NetworkState::WIFI_PORTAL_MODE) {
|
||||
LOG_INFO("🚀 Starting AsyncWebServer on port 80...");
|
||||
@@ -358,7 +361,11 @@ void setup()
|
||||
if (networking.isConnected()) {
|
||||
LOG_INFO("Network already connected - triggering MQTT connection");
|
||||
communication.onNetworkConnected();
|
||||
|
||||
|
||||
// Sync time with NTP server if network is already connected
|
||||
LOG_INFO("⏰ Syncing time with NTP server...");
|
||||
timekeeper.syncTimeWithNTP();
|
||||
|
||||
// 🔥 CRITICAL: Start AsyncWebServer ONLY when network is ready
|
||||
// Do NOT start if WiFiManager portal is active (port 80 conflict!)
|
||||
LOG_INFO("🚀 Starting AsyncWebServer on port 80...");
|
||||
|
||||
Reference in New Issue
Block a user