From 7d1c0b81115caf671ccd7d4913fc9451ed9133fb Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Tue, 6 Oct 2020 14:09:23 +0200 Subject: [PATCH] - added some more battery states - renamed ready state --- ScStwLibraries/headers/ScStw.hpp | 4 +++- ScStwLibraries/headers/scstwtimer.h | 2 +- ScStwLibraries/sources/scstwrace.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ScStwLibraries/headers/ScStw.hpp b/ScStwLibraries/headers/ScStw.hpp index 13ba196..1c8fdcf 100644 --- a/ScStwLibraries/headers/ScStw.hpp +++ b/ScStwLibraries/headers/ScStw.hpp @@ -165,7 +165,9 @@ public: enum ExtensionBatteryState { BatteryUnknown = -1, BatteryCritical = 0, - BatteryFine = 1 + BatteryWarning = 1, + BatteryFine = 2, + BatteryCharging = 3 }; Q_ENUM(ExtensionBatteryState); diff --git a/ScStwLibraries/headers/scstwtimer.h b/ScStwLibraries/headers/scstwtimer.h index abfa291..9ded219 100644 --- a/ScStwLibraries/headers/scstwtimer.h +++ b/ScStwLibraries/headers/scstwtimer.h @@ -102,7 +102,7 @@ public: NotInIdleState, /*!< Timer is not in IDLE state */ IsDisabled, /*!< Timer is disabled */ ExtensionIsNotConnected, /*!< Not all extension of the timer are conneted */ - ExtensionBatteryNotFine, /*!< The battery level of one or more extension is critical or unknown */ + ExtensionBatteryIsCritical, /*!< The battery level of one or more extension is critical or unknown */ ClimberIsNotReady /*!< The startpad of the timer is not triggered */ }; Q_ENUM(ReadyState) diff --git a/ScStwLibraries/sources/scstwrace.cpp b/ScStwLibraries/sources/scstwrace.cpp index f5d251a..0880a2c 100644 --- a/ScStwLibraries/sources/scstwrace.cpp +++ b/ScStwLibraries/sources/scstwrace.cpp @@ -194,7 +194,7 @@ void ScStwRace::handleTimerReadyStateChange(ScStwTimer::ReadyState readyState) { qDebug() << "Some ready state changed: " << readyState; // cancel as a technical incident if extensions are disconnected or run low on battery - if(readyState == ScStwTimer::ExtensionIsNotConnected || readyState == ScStwTimer::ExtensionBatteryNotFine) { + if(readyState == ScStwTimer::ExtensionIsNotConnected || readyState == ScStwTimer::ExtensionBatteryIsCritical) { this->technicalIncident(); return; } @@ -551,9 +551,9 @@ void ScStwRace::technicalIncident() { } foreach(ScStwTimer *timer, this->timers){ - if(raceIsRunning && timer->getReadyState() == ScStwTimer::ExtensionBatteryNotFine) + if(raceIsRunning && timer->getReadyState() == ScStwTimer::ExtensionBatteryIsCritical) continue; - else if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryNotFine) + else if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryIsCritical) timer->technicalIncident(); else if(!raceIsRunning) timer->setState(ScStwTimer::CANCELLED); @@ -575,7 +575,7 @@ bool ScStwRace::getIsReadyForNextState() { if(timer->getState() == ScStwTimer::DISABLED) continue; - if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryNotFine) { + if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryIsCritical) { this->technicalIncident();