Configure finsih

pull/125/head
Robert Stein 2020-12-13 17:54:34 +01:00
parent 9fd1f8e590
commit 4ef1eb2d83
3 changed files with 71 additions and 21 deletions

View File

@ -138,8 +138,8 @@ void GlobalDataController::readSettings() {
this->debugController->printLn("weatherLang=" + this->WeatherLang); this->debugController->printLn("weatherLang=" + this->WeatherLang);
} }
if(line.indexOf("useLedFlash=") >= 0) { if(line.indexOf("useLedFlash=") >= 0) {
this->useLedFlash = line.substring(line.lastIndexOf("useLedFlash=") + 12).toInt(); this->UseLedFlash = line.substring(line.lastIndexOf("useLedFlash=") + 12).toInt();
this->debugController->printLn("useLedFlash=" + String(this->useLedFlash)); this->debugController->printLn("useLedFlash=" + String(this->UseLedFlash));
} }
} }
fr.close(); fr.close();
@ -182,7 +182,7 @@ void GlobalDataController::writeSettings() {
f.println("weatherCityId=" + String(this->WeatherCityId)); f.println("weatherCityId=" + String(this->WeatherCityId));
f.println("weatherIsMetric=" + String(this->WeatherIsMetric)); f.println("weatherIsMetric=" + String(this->WeatherIsMetric));
f.println("weatherLang=" + this->WeatherLang); f.println("weatherLang=" + this->WeatherLang);
f.println("useLedFlash=" + String(this->useLedFlash)); f.println("useLedFlash=" + String(this->UseLedFlash));
} }
f.close(); f.close();
readSettings(); readSettings();
@ -209,11 +209,9 @@ BasePrinterClient *GlobalDataController::getPrinterClient() {
return this->basePrinterClient; return this->basePrinterClient;
} }
/**
* Configuration parameters
*/
String GlobalDataController::getPrinterApiKey() { String GlobalDataController::getPrinterApiKey() {
return this->PrinterApiKey; return this->PrinterApiKey;
@ -279,46 +277,88 @@ bool GlobalDataController::getWebserverIsBasicAuth() {
return this->WebserverIsBasicAuth; return this->WebserverIsBasicAuth;
} }
void GlobalDataController::setWebserverIsBasicAuth(bool webserverIsBasicAuth) {
this->WebserverIsBasicAuth = webserverIsBasicAuth;
}
String GlobalDataController::getWebserverUsername() { String GlobalDataController::getWebserverUsername() {
return this->WebserverUsername; return this->WebserverUsername;
} }
void GlobalDataController::setWebserverUsername(String webserverUsername) {
this->WebserverUsername = webserverUsername;
}
String GlobalDataController::getWebserverPassword() { String GlobalDataController::getWebserverPassword() {
return this->WebserverPassword; return this->WebserverPassword;
} }
void GlobalDataController::setWebserverPassword(String webserverPassword) {
this->WebserverPassword = webserverPassword;
}
String GlobalDataController::getWebserverTheme() { String GlobalDataController::getWebserverTheme() {
return this->WebserverTheme; return this->WebserverTheme;
} }
void GlobalDataController::setWebserverTheme(String webserverTheme) {
this->WebserverTheme = webserverTheme;
}
bool GlobalDataController::isDisplayInverted() { bool GlobalDataController::isDisplayInverted() {
return this->DisplayInvertDisplay; return this->DisplayInvertDisplay;
} }
void GlobalDataController::setIsDisplayInverted(bool displayInvertDisplay) {
this->DisplayInvertDisplay = displayInvertDisplay;
}
int GlobalDataController::getClockUtcOffset() { int GlobalDataController::getClockUtcOffset() {
return this->ClockUtcOffset; return this->ClockUtcOffset;
} }
void GlobalDataController::setClockUtcOffset(int clockUtcOffset) {
this->ClockUtcOffset = clockUtcOffset;
}
bool GlobalDataController::getDisplayClock() { bool GlobalDataController::getDisplayClock() {
return this->DisplayClock; return this->DisplayClock;
} }
void GlobalDataController::setDisplayClock(bool displayClock) {
this->DisplayClock = displayClock;
}
bool GlobalDataController::getClockIs24h() { bool GlobalDataController::getClockIs24h() {
return this->ClockIs24h; return this->ClockIs24h;
} }
void GlobalDataController::setClockIs24h(bool clockIs24h) {
this->ClockIs24h = clockIs24h;
}
int GlobalDataController::getClockResyncMinutes() { int GlobalDataController::getClockResyncMinutes() {
return this->ClockResyncMinutes; return this->ClockResyncMinutes;
} }
void GlobalDataController::setClockResyncMinutes(int clockResyncMinutes) {
this->ClockResyncMinutes = clockResyncMinutes;
}
bool GlobalDataController::useLedFlash() {
return this->UseLedFlash;
}
void GlobalDataController::setUseLedFlash(bool useLedFlash) {
this->UseLedFlash = useLedFlash;
}
/** /**
* Notify LED * Notify LED
*/ */
void GlobalDataController::ledOnOff(boolean value) { void GlobalDataController::ledOnOff(boolean value) {
if (USE_FLASH) { if (this->useLedFlash()) {
if (value) { if (value) {
digitalWrite(EXTERNAL_LED, LOW); // LED ON digitalWrite(EXTERNAL_LED, LOW); // LED ON
} else { } else {

View File

@ -41,7 +41,7 @@ private:
bool ClockIs24h = TIME_IS_24HOUR; bool ClockIs24h = TIME_IS_24HOUR;
int ClockResyncMinutes = TIME_RESYNC_MINUTES_DELAY; int ClockResyncMinutes = TIME_RESYNC_MINUTES_DELAY;
bool useLedFlash = USE_FLASH; bool UseLedFlash = USE_FLASH;
bool WeatherShow = DISPLAYWEATHER; bool WeatherShow = DISPLAYWEATHER;
String WeatherApiKey = WEATHER_APIKEY; String WeatherApiKey = WEATHER_APIKEY;
@ -83,16 +83,28 @@ public:
int getWebserverPort(); int getWebserverPort();
bool getWebserverIsBasicAuth(); bool getWebserverIsBasicAuth();
void setWebserverIsBasicAuth(bool webserverIsBasicAuth);
String getWebserverUsername(); String getWebserverUsername();
void setWebserverUsername(String webserverUsername);
String getWebserverPassword(); String getWebserverPassword();
void setWebserverPassword(String webserverPassword);
String getWebserverTheme(); String getWebserverTheme();
void setWebserverTheme(String webserverTheme);
bool isDisplayInverted(); bool isDisplayInverted();
void setIsDisplayInverted(bool displayInvertDisplay);
int getClockUtcOffset(); int getClockUtcOffset();
void setClockUtcOffset(int clockUtcOffset);
bool getDisplayClock(); bool getDisplayClock();
void setDisplayClock(bool displayClock);
bool getClockIs24h(); bool getClockIs24h();
void setClockIs24h(bool clockIs24h);
int getClockResyncMinutes(); int getClockResyncMinutes();
void setClockResyncMinutes(int clockResyncMinutes);
bool useLedFlash();
void setUseLedFlash(bool useLedFlash);
void ledOnOff(boolean value); void ledOnOff(boolean value);
void flashLED(int number, int delayTime); void flashLED(int number, int delayTime);

View File

@ -305,19 +305,17 @@ void WebServer::handleUpdateConfig() {
this->globalDataController->setPrinterAuthUser(this->server->arg("octoUser")); this->globalDataController->setPrinterAuthUser(this->server->arg("octoUser"));
this->globalDataController->setPrinterAuthPass(this->server->arg("octoPass")); this->globalDataController->setPrinterAuthPass(this->server->arg("octoPass"));
this->globalDataController->setHasPrinterPsu(this->server->hasArg("hasPSU")); this->globalDataController->setHasPrinterPsu(this->server->hasArg("hasPSU"));
this->globalDataController->setDisplayClock(this->server->hasArg("isClockEnabled"));
/*DISPLAYCLOCK = this->server->hasArg("isClockEnabled"); this->globalDataController->setIsDisplayInverted(this->server->hasArg("invDisp"));
IS_24HOUR = this->server->hasArg("is24hour"); this->globalDataController->setClockIs24h(this->server->hasArg("is24hour"));
INVERT_DISPLAY = this->server->hasArg("invDisp"); this->globalDataController->setClockResyncMinutes(this->server->arg("refresh").toInt());
USE_FLASH = this->server->hasArg("useFlash"); this->globalDataController->setWebserverTheme(this->server->arg("theme"));
this->globalDataController->setClockUtcOffset(this->server->arg("utcoffset").toFloat());
minutesBetweenDataRefresh = this->server->arg("refresh").toInt();
themeColor = this->server->arg("theme");
UtcOffset = this->server->arg("utcoffset").toFloat();
String temp = this->server->arg("userid"); String temp = this->server->arg("userid");
temp.toCharArray(www_username, sizeof(temp)); this->globalDataController->setWebserverUsername(temp);
temp = this->server->arg("stationpassword"); temp = this->server->arg("stationpassword");
temp.toCharArray(www_password, sizeof(temp));*/ this->globalDataController->setWebserverPassword(temp);
this->globalDataController->setUseLedFlash(this->server->hasArg("useFlash"));
this->globalDataController->writeSettings(); this->globalDataController->writeSettings();
//findMDNS(); //findMDNS();