Refactor WiFiManager: extract server and handlers into separate modules

- Move server lifecycle management to WiFiManagerServer
- Move HTTP handlers and rendering to WiFiManagerHandlers
- Move DEBUG_WM template definitions to WiFiManagerDebug
- Implement lazy initialization of server manager to save memory
- Add proper cleanup in destructor and on multiple createServer calls
- Update tests to use getServer() and getDNSServer() accessors
This commit is contained in:
2025-11-15 22:22:36 +10:00
parent 1788aa3c4a
commit 9cd5f62f9b
14 changed files with 1777 additions and 1753 deletions
@@ -1,6 +1,7 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include <WiFiManagerParameter.h>
#include "../test_main.h"
// Test autoConnect fallback flow
@@ -145,8 +146,8 @@ void test_portal_with_parameters_and_infrastructure() {
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Verify infrastructure
TEST_ASSERT_NOT_NULL(wm.server);
TEST_ASSERT_NOT_NULL(wm.dnsServer);
TEST_ASSERT_NOT_NULL(wm.getServer());
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
// Verify parameters
TEST_ASSERT_EQUAL(2, wm.getParametersCount());