91 lines
1.9 KiB
C++
91 lines
1.9 KiB
C++
#include "app_config.h"
|
|
#include "config.h"
|
|
|
|
AppConfig appConfig;
|
|
|
|
void loadDefaultConfig() {
|
|
appConfig.deviceName = DEVICE_NAME;
|
|
|
|
appConfig.relays[0] = {
|
|
"relay_1",
|
|
"Relay 1",
|
|
RELAY_STARLINK_PIN,
|
|
true
|
|
};
|
|
|
|
appConfig.relays[1] = {
|
|
"relay_2",
|
|
"Relay 2",
|
|
RELAY_FRIDGE_PIN,
|
|
true
|
|
};
|
|
|
|
appConfig.tempSensorCount = 4;
|
|
|
|
appConfig.tempSensors[0] = {
|
|
"temp_1",
|
|
"Temperature 1",
|
|
"",
|
|
true
|
|
};
|
|
|
|
appConfig.tempSensors[1] = {
|
|
"temp_2",
|
|
"Temperature 2",
|
|
"",
|
|
true
|
|
};
|
|
|
|
appConfig.tempSensors[2] = {
|
|
"temp_3",
|
|
"Temperature 3",
|
|
"",
|
|
true
|
|
};
|
|
|
|
appConfig.tempSensors[3] = {
|
|
"temp_4",
|
|
"Temperature 4",
|
|
"",
|
|
true
|
|
};
|
|
|
|
for (int i = 4; i < MAX_TEMP_SENSORS; i++) {
|
|
appConfig.tempSensors[i] = {
|
|
"temp_" + String(i + 1),
|
|
"Temperature " + String(i + 1),
|
|
"",
|
|
false
|
|
};
|
|
}
|
|
|
|
appConfig.bms.enabled = true;
|
|
appConfig.bms.name = "BMS";
|
|
appConfig.bms.address = "a5:c2:37:2c:05:dc";
|
|
appConfig.bms.addressType = "public";
|
|
}
|
|
|
|
void printConfig() {
|
|
Serial.println("Config:");
|
|
Serial.print(" Device: ");
|
|
Serial.println(appConfig.deviceName);
|
|
|
|
Serial.println(" Relays:");
|
|
for (int i = 0; i < MAX_RELAYS; i++) {
|
|
Serial.print(" ");
|
|
Serial.print(appConfig.relays[i].id);
|
|
Serial.print(" / ");
|
|
Serial.print(appConfig.relays[i].name);
|
|
Serial.print(" / GPIO ");
|
|
Serial.println(appConfig.relays[i].pin);
|
|
}
|
|
|
|
Serial.println(" BMS:");
|
|
Serial.print(" Enabled: ");
|
|
Serial.println(appConfig.bms.enabled ? "true" : "false");
|
|
Serial.print(" Name: ");
|
|
Serial.println(appConfig.bms.name);
|
|
Serial.print(" Address: ");
|
|
Serial.println(appConfig.bms.address);
|
|
}
|