| 41 | } // namespace |
| 42 | |
| 43 | void init() |
| 44 | { |
| 45 | Serial.begin(SERIAL_BAUD_RATE); // 115200 by default |
| 46 | Serial.systemDebugOutput(true); |
| 47 | |
| 48 | #ifndef ENABLE_FLASHSTRING_MAP |
| 49 | spiffs_mount(); // Mount file system, in order to work with files |
| 50 | #endif |
| 51 | |
| 52 | // Set higher CPU freq & disable wifi sleep |
| 53 | // System.setCpuFrequency(CpuCycleClockFast::cpuFrequency()); |
| 54 | wifi_set_sleep_type(NONE_SLEEP_T); |
| 55 | |
| 56 | activeConfig = loadConfig(); |
| 57 | if(activeConfig.StaSSID) { |
| 58 | WifiStation.enable(true); |
| 59 | WifiStation.config(activeConfig.StaSSID, activeConfig.StaPassword); |
| 60 | } |
| 61 | |
| 62 | // Attach Wifi events handlers |
| 63 | WifiEvents.onStationDisconnect(STADisconnect); |
| 64 | WifiEvents.onStationGotIP(STAGotIP); |
| 65 | |
| 66 | System.onReady(startWebServer); |
| 67 | |
| 68 | counterTimer.initializeMs<1000>(counterCallback).start(); |
| 69 | } |
nothing calls this directly
no test coverage detected