diff --git a/headers/climbingrace.h b/headers/climbingrace.h index 4500cd8..68a93e0 100644 --- a/headers/climbingrace.h +++ b/headers/climbingrace.h @@ -52,6 +52,7 @@ private: // helper vars QVariantList qmlTimers; + const QStringList remoteSettings = {"ready_en", "ready_delay", "at_marks_en", "at_marks_delay"}; private slots: // helper functions diff --git a/sources/climbingrace.cpp b/sources/climbingrace.cpp index b20f0ab..64be312 100644 --- a/sources/climbingrace.cpp +++ b/sources/climbingrace.cpp @@ -7,7 +7,7 @@ * - sounds * - next start action * - next start action delay progress - * + * - settings (remote and local) */ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent) @@ -18,7 +18,7 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent) this->appSettings = new AppSettings; this->baseConn = new BaseConn; - this->baseConn->setIP("ScStw"); + this->baseConn->setIP("192.168.4.1"); connect(this->baseConn, &BaseConn::stateChanged, this, &ClimbingRace::baseStationStateChanged); this->speedTimers.append( new SpeedTimer ); @@ -483,31 +483,29 @@ double ClimbingRace::getNextStartActionDelayProgress() { void ClimbingRace::writeSetting(QString key, QVariant value) { this->refreshMode(); - switch (this->mode) { - case LOCAL: - this->appSettings->writeSetting(key, value); - break; - case REMOTE: + + if(this->mode == REMOTE && this->remoteSettings.contains(key)){ this->baseConn->writeRemoteSetting(key, value.toString()); - break; + } + else { + this->appSettings->writeSetting(key, value); } } QString ClimbingRace::readSetting(QString key) { this->refreshMode(); - switch (this->mode) { - case LOCAL: - return this->appSettings->loadSetting(key); - case REMOTE: + + if(this->mode == REMOTE && this->remoteSettings.contains(key)){ QVariantMap reply = this->baseConn->sendCommand(3001, key); if(reply["status"] != 200){ return "false"; } return reply["data"].toString(); - } - + else { + return this->appSettings->loadSetting(key); + } } bool ClimbingRace::connectBaseStation() {