bug fixes

This commit is contained in:
Dorian Zedler 2020-10-02 15:23:30 +02:00
parent d1f132d0b0
commit 72b03c0e66
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37

View file

@ -44,7 +44,7 @@ ScStwRace::ScStwRace(QObject *parent) : QObject(parent)
// --- Main Functionality --- // --- Main Functionality ---
// -------------------------- // --------------------------
int ScStwRace::start(bool asyncronous) { ScStw::StatusCode ScStwRace::start(bool asyncronous) {
if(this->state == WAITING) { if(this->state == WAITING) {
if(this->isReadyForNextState()) { if(this->isReadyForNextState()) {
this->startWaitLoop->exit(LoopManualExit); this->startWaitLoop->exit(LoopManualExit);
@ -74,7 +74,7 @@ int ScStwRace::start(bool asyncronous) {
return ScStw::Success; return ScStw::Success;
} }
int ScStwRace::stop() { ScStw::StatusCode ScStwRace::stop() {
if(this->state != RUNNING && this->state != STARTING) { if(this->state != RUNNING && this->state != STARTING) {
return ScStw::CurrentStateNotVaildForOperationError; return ScStw::CurrentStateNotVaildForOperationError;
} }
@ -83,7 +83,7 @@ int ScStwRace::stop() {
double timeOfStop = QDateTime::currentMSecsSinceEpoch(); double timeOfStop = QDateTime::currentMSecsSinceEpoch();
int returnCode = ScStw::Success; ScStw::StatusCode returnCode = ScStw::Success;
foreach(ScStwTimer *speedTimer, this->timers){ foreach(ScStwTimer *speedTimer, this->timers){
if(!speedTimer->stop(timeOfStop) && speedTimer->getState() != ScStwTimer::DISABLED){ if(!speedTimer->stop(timeOfStop) && speedTimer->getState() != ScStwTimer::DISABLED){
@ -138,14 +138,14 @@ void ScStwRace::handleTimerStop() {
} }
} }
int ScStwRace::reset() { ScStw::StatusCode ScStwRace::reset() {
if(this->state != STOPPED && this->state != INCIDENT) { if(this->state != STOPPED && this->state != INCIDENT) {
return ScStw::CurrentStateNotVaildForOperationError; return ScStw::CurrentStateNotVaildForOperationError;
} }
qDebug() << "+ [INFO] resetting race"; qDebug() << "+ [INFO] resetting race";
int returnCode = ScStw::Success; ScStw::StatusCode returnCode = ScStw::Success;
foreach(ScStwTimer *speedTimer, this->timers){ foreach(ScStwTimer *speedTimer, this->timers){
if(!speedTimer->reset() && speedTimer->getState() != ScStwTimer::DISABLED) { if(!speedTimer->reset() && speedTimer->getState() != ScStwTimer::DISABLED) {
@ -159,13 +159,13 @@ int ScStwRace::reset() {
return returnCode; return returnCode;
} }
int ScStwRace::cancel() { ScStw::StatusCode ScStwRace::cancel() {
if(this->state != PREPAIRING && this->state != WAITING && this->state != STARTING && this->state != RUNNING) if(this->state != PREPAIRING && this->state != WAITING && this->state != STARTING && this->state != RUNNING)
return ScStw::CurrentStateNotVaildForOperationError; return ScStw::CurrentStateNotVaildForOperationError;
qDebug() << "[INFO][RACE] cancelling race"; qDebug() << "[INFO][RACE] cancelling race";
int returnCode = ScStw::Success; ScStw::StatusCode returnCode = ScStw::Success;
foreach(ScStwTimer *timer, this->timers){ foreach(ScStwTimer *timer, this->timers){
if(!timer->cancel() && timer->getState() != ScStwTimer::DISABLED) if(!timer->cancel() && timer->getState() != ScStwTimer::DISABLED)