Search for Power Button Panel
[pierogi] / protocols / kathreinprotocol.cpp
index 1d29779..35208f3 100644 (file)
@@ -51,8 +51,11 @@ void KathreinProtocol::startSendingCommand(
     // Do we even have this key defined?
     if (i == keycodes.end())
     {
-      std::string s = "Tried to send a non-existent command.\n";
-      throw PIRException(s);
+      QMutexLocker cifLocker(&commandIFMutex);
+      commandInFlight = false;
+      return;
+//      std::string s = "Tried to send a non-existent command.\n";
+//      throw PIRException(s);
     }
 
     // construct the device:
@@ -83,23 +86,26 @@ void KathreinProtocol::startSendingCommand(
         // Check whether we've been asked to stop:
         if (checkRepeatFlag())
         {
+          break;
+/*
           QMutexLocker cifLocker(&commandIFMutex);
           commandInFlight = false;
           return;
+*/
         }
       }
 
       ++repeatCount;
     }
+
+    QMutexLocker cifLocker(&commandIFMutex);
+    commandInFlight = false;
   }
   catch (PIRException e)
   {
     // inform the gui:
     emit commandFailed(e.getError().c_str());
   }
-
-  QMutexLocker cifLocker(&commandIFMutex);
-  commandInFlight = false;
 }