| 1054 | } |
| 1055 | |
| 1056 | void startWebUi(String ssid, int encryptation, bool mode_ap) { |
| 1057 | file_size = 0; |
| 1058 | #ifndef HEADLESS |
| 1059 | getConfigs(); |
| 1060 | #endif |
| 1061 | config.httpuser = wui_usr; |
| 1062 | config.httppassword = wui_pwd; |
| 1063 | config.webserverporthttp = default_webserverporthttp; |
| 1064 | |
| 1065 | if (launcherWifiIsConnected() && mode_ap) launcherWifiStop(); |
| 1066 | if (!launcherWifiIsConnected() || mode_ap) wifiConnect(ssid, encryptation, mode_ap); |
| 1067 | vTaskDelay(pdMS_TO_TICKS(250)); |
| 1068 | |
| 1069 | launcherConsolePrintln("Configuring Webserver ..."); |
| 1070 | server = launcherWebServerStart(config.webserverporthttp); |
| 1071 | if (!server) { |
| 1072 | launcherConsolePrintln("Failed to start Webserver"); |
| 1073 | return; |
| 1074 | } |
| 1075 | configureWebServer(); |
| 1076 | vTaskDelay(pdTICKS_TO_MS(500)); |
| 1077 | |
| 1078 | startWebUiLoopCommon(mode_ap); |
| 1079 | stopWebServerAndWifi(); |
| 1080 | #ifndef HEADLESS |
| 1081 | tft->fillScreen(BGCOLOR); |
| 1082 | #endif |
| 1083 | } |
no test coverage detected