| 18 | ThermConfig activeConfig; |
| 19 | |
| 20 | ThermConfig loadConfig() |
| 21 | { |
| 22 | StaticJsonDocument<ConfigJsonBufferSize> doc; |
| 23 | ThermConfig cfg; |
| 24 | if(Json::loadFromFile(doc, THERM_CONFIG_FILE)) { |
| 25 | JsonObject network = doc[KEY_NETWORK]; |
| 26 | cfg.StaSSID = network[KEY_SSID].as<const char*>(); |
| 27 | cfg.StaPassword = network[KEY_PASS].as<const char*>(); |
| 28 | cfg.StaEnable = network[KEY_ENABLE]; |
| 29 | } else { |
| 30 | // Factory defaults if no config file present, or could not access it |
| 31 | cfg.StaSSID = F(WIFI_SSID); |
| 32 | cfg.StaPassword = F(WIFI_PWD); |
| 33 | } |
| 34 | return cfg; |
| 35 | } |
| 36 | |
| 37 | void saveConfig(ThermConfig& cfg) |
| 38 | { |
no test coverage detected