-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.cpp
32 lines (27 loc) · 978 Bytes
/
config.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Arduino.h>
#include <EEPROM.h>
#include "config.h"
Config config;
const char* defaultSSID = "SVITLOBOARD";
const char* defaultPassword = "";
void saveConfig() {
EEPROM.put(0, config);
EEPROM.commit();
}
void loadConfig() {
EEPROM.get(0, config);
delay(1000);
if (!config.setup_completed) {
strcpy(config.ssid, defaultSSID);
strcpy(config.password, defaultPassword);
}
Serial.println("Current config:");
Serial.println(String("Main SSID: ") + config.ssid);
Serial.println(String("Password: ") + config.password);
Serial.println(String("Backup 1 SSID: ") + config.backup1_ssid);
Serial.println(String("Password: ") + config.backup1_password);
Serial.println(String("Backup 2 SSID: ") + config.backup2_ssid);
Serial.println(String("Password: ") + config.backup2_password);
Serial.println(String("Channel Key: ") + config.channel_key);
Serial.println(String("Setup completed: ") + (config.setup_completed ? "true" : "false"));
}