diff --git a/src/Global/GlobalDataController.cpp b/src/Global/GlobalDataController.cpp index c314042..1c17498 100644 --- a/src/Global/GlobalDataController.cpp +++ b/src/Global/GlobalDataController.cpp @@ -138,8 +138,8 @@ void GlobalDataController::readSettings() { this->debugController->printLn("weatherLang=" + this->WeatherLang); } if(line.indexOf("useLedFlash=") >= 0) { - this->useLedFlash = line.substring(line.lastIndexOf("useLedFlash=") + 12).toInt(); - this->debugController->printLn("useLedFlash=" + String(this->useLedFlash)); + this->UseLedFlash = line.substring(line.lastIndexOf("useLedFlash=") + 12).toInt(); + this->debugController->printLn("useLedFlash=" + String(this->UseLedFlash)); } } fr.close(); @@ -182,7 +182,7 @@ void GlobalDataController::writeSettings() { f.println("weatherCityId=" + String(this->WeatherCityId)); f.println("weatherIsMetric=" + String(this->WeatherIsMetric)); f.println("weatherLang=" + this->WeatherLang); - f.println("useLedFlash=" + String(this->useLedFlash)); + f.println("useLedFlash=" + String(this->UseLedFlash)); } f.close(); readSettings(); @@ -209,11 +209,9 @@ BasePrinterClient *GlobalDataController::getPrinterClient() { return this->basePrinterClient; } - - - - - +/** + * Configuration parameters + */ String GlobalDataController::getPrinterApiKey() { return this->PrinterApiKey; @@ -279,46 +277,88 @@ bool GlobalDataController::getWebserverIsBasicAuth() { return this->WebserverIsBasicAuth; } +void GlobalDataController::setWebserverIsBasicAuth(bool webserverIsBasicAuth) { + this->WebserverIsBasicAuth = webserverIsBasicAuth; +} + String GlobalDataController::getWebserverUsername() { return this->WebserverUsername; } +void GlobalDataController::setWebserverUsername(String webserverUsername) { + this->WebserverUsername = webserverUsername; +} + String GlobalDataController::getWebserverPassword() { return this->WebserverPassword; } +void GlobalDataController::setWebserverPassword(String webserverPassword) { + this->WebserverPassword = webserverPassword; +} + String GlobalDataController::getWebserverTheme() { return this->WebserverTheme; } +void GlobalDataController::setWebserverTheme(String webserverTheme) { + this->WebserverTheme = webserverTheme; +} bool GlobalDataController::isDisplayInverted() { return this->DisplayInvertDisplay; } +void GlobalDataController::setIsDisplayInverted(bool displayInvertDisplay) { + this->DisplayInvertDisplay = displayInvertDisplay; +} + int GlobalDataController::getClockUtcOffset() { return this->ClockUtcOffset; } +void GlobalDataController::setClockUtcOffset(int clockUtcOffset) { + this->ClockUtcOffset = clockUtcOffset; +} + bool GlobalDataController::getDisplayClock() { return this->DisplayClock; } +void GlobalDataController::setDisplayClock(bool displayClock) { + this->DisplayClock = displayClock; +} + bool GlobalDataController::getClockIs24h() { return this->ClockIs24h; } +void GlobalDataController::setClockIs24h(bool clockIs24h) { + this->ClockIs24h = clockIs24h; +} + int GlobalDataController::getClockResyncMinutes() { 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 */ void GlobalDataController::ledOnOff(boolean value) { - if (USE_FLASH) { + if (this->useLedFlash()) { if (value) { digitalWrite(EXTERNAL_LED, LOW); // LED ON } else { diff --git a/src/Global/GlobalDataController.h b/src/Global/GlobalDataController.h index 0700636..55ccf6f 100644 --- a/src/Global/GlobalDataController.h +++ b/src/Global/GlobalDataController.h @@ -41,7 +41,7 @@ private: bool ClockIs24h = TIME_IS_24HOUR; int ClockResyncMinutes = TIME_RESYNC_MINUTES_DELAY; - bool useLedFlash = USE_FLASH; + bool UseLedFlash = USE_FLASH; bool WeatherShow = DISPLAYWEATHER; String WeatherApiKey = WEATHER_APIKEY; @@ -83,16 +83,28 @@ public: int getWebserverPort(); bool getWebserverIsBasicAuth(); + void setWebserverIsBasicAuth(bool webserverIsBasicAuth); String getWebserverUsername(); + void setWebserverUsername(String webserverUsername); String getWebserverPassword(); + void setWebserverPassword(String webserverPassword); String getWebserverTheme(); + void setWebserverTheme(String webserverTheme); bool isDisplayInverted(); + void setIsDisplayInverted(bool displayInvertDisplay); int getClockUtcOffset(); + void setClockUtcOffset(int clockUtcOffset); bool getDisplayClock(); + void setDisplayClock(bool displayClock); bool getClockIs24h(); + void setClockIs24h(bool clockIs24h); int getClockResyncMinutes(); + void setClockResyncMinutes(int clockResyncMinutes); + + bool useLedFlash(); + void setUseLedFlash(bool useLedFlash); void ledOnOff(boolean value); void flashLED(int number, int delayTime); diff --git a/src/Network/WebServer.cpp b/src/Network/WebServer.cpp index e98ff16..4b8a309 100644 --- a/src/Network/WebServer.cpp +++ b/src/Network/WebServer.cpp @@ -305,19 +305,17 @@ void WebServer::handleUpdateConfig() { this->globalDataController->setPrinterAuthUser(this->server->arg("octoUser")); this->globalDataController->setPrinterAuthPass(this->server->arg("octoPass")); this->globalDataController->setHasPrinterPsu(this->server->hasArg("hasPSU")); - - /*DISPLAYCLOCK = this->server->hasArg("isClockEnabled"); - IS_24HOUR = this->server->hasArg("is24hour"); - INVERT_DISPLAY = this->server->hasArg("invDisp"); - USE_FLASH = this->server->hasArg("useFlash"); - - minutesBetweenDataRefresh = this->server->arg("refresh").toInt(); - themeColor = this->server->arg("theme"); - UtcOffset = this->server->arg("utcoffset").toFloat(); + this->globalDataController->setDisplayClock(this->server->hasArg("isClockEnabled")); + this->globalDataController->setIsDisplayInverted(this->server->hasArg("invDisp")); + this->globalDataController->setClockIs24h(this->server->hasArg("is24hour")); + this->globalDataController->setClockResyncMinutes(this->server->arg("refresh").toInt()); + this->globalDataController->setWebserverTheme(this->server->arg("theme")); + this->globalDataController->setClockUtcOffset(this->server->arg("utcoffset").toFloat()); String temp = this->server->arg("userid"); - temp.toCharArray(www_username, sizeof(temp)); + this->globalDataController->setWebserverUsername(temp); 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(); //findMDNS();