Search for Power Button Panel
[pierogi] / protocols / mceprotocol.cpp
index 9096c7e..b6d91b7 100644 (file)
@@ -58,8 +58,11 @@ void MCEProtocol::startSendingCommand(
     // Sanity check:
     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);
     }
 
     PIRRX51Hardware rx51device(carrierFrequency, dutyCycle);
@@ -141,21 +144,24 @@ void MCEProtocol::startSendingCommand(
       if (checkRepeatFlag())
       {
         // Yes, we can now quit repeating:
+        break;
+/*
         ++keypressCount;
         QMutexLocker ciflocker(&commandIFMutex);
         commandInFlight = false;
         return;
+*/
       }
     }
+
+    ++keypressCount;
+    QMutexLocker cifLocker(&commandIFMutex);
+    commandInFlight = false;
   }
   catch (PIRException e)
   {
     emit commandFailed(e.getError().c_str());
   }
-
-  ++keypressCount;
-  QMutexLocker cifLocker(&commandIFMutex);
-  commandInFlight = false;
 }