- added some more battery states

- renamed ready state
This commit is contained in:
Dorian Zedler 2020-10-06 14:09:23 +02:00
parent be6aebd458
commit 7d1c0b8111
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
3 changed files with 8 additions and 6 deletions

View file

@ -165,7 +165,9 @@ public:
enum ExtensionBatteryState { enum ExtensionBatteryState {
BatteryUnknown = -1, BatteryUnknown = -1,
BatteryCritical = 0, BatteryCritical = 0,
BatteryFine = 1 BatteryWarning = 1,
BatteryFine = 2,
BatteryCharging = 3
}; };
Q_ENUM(ExtensionBatteryState); Q_ENUM(ExtensionBatteryState);

View file

@ -102,7 +102,7 @@ public:
NotInIdleState, /*!< Timer is not in IDLE state */ NotInIdleState, /*!< Timer is not in IDLE state */
IsDisabled, /*!< Timer is disabled */ IsDisabled, /*!< Timer is disabled */
ExtensionIsNotConnected, /*!< Not all extension of the timer are conneted */ 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 */ ClimberIsNotReady /*!< The startpad of the timer is not triggered */
}; };
Q_ENUM(ReadyState) Q_ENUM(ReadyState)

View file

@ -194,7 +194,7 @@ void ScStwRace::handleTimerReadyStateChange(ScStwTimer::ReadyState readyState) {
qDebug() << "Some ready state changed: " << readyState; qDebug() << "Some ready state changed: " << readyState;
// cancel as a technical incident if extensions are disconnected or run low on battery // 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(); this->technicalIncident();
return; return;
} }
@ -551,9 +551,9 @@ void ScStwRace::technicalIncident() {
} }
foreach(ScStwTimer *timer, this->timers){ foreach(ScStwTimer *timer, this->timers){
if(raceIsRunning && timer->getReadyState() == ScStwTimer::ExtensionBatteryNotFine) if(raceIsRunning && timer->getReadyState() == ScStwTimer::ExtensionBatteryIsCritical)
continue; continue;
else if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryNotFine) else if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryIsCritical)
timer->technicalIncident(); timer->technicalIncident();
else if(!raceIsRunning) else if(!raceIsRunning)
timer->setState(ScStwTimer::CANCELLED); timer->setState(ScStwTimer::CANCELLED);
@ -575,7 +575,7 @@ bool ScStwRace::getIsReadyForNextState() {
if(timer->getState() == ScStwTimer::DISABLED) if(timer->getState() == ScStwTimer::DISABLED)
continue; continue;
if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryNotFine) { if(timer->getReadyState() == ScStwTimer::ExtensionIsNotConnected || timer->getReadyState() == ScStwTimer::ExtensionBatteryIsCritical) {
this->technicalIncident(); this->technicalIncident();