Prechádzať zdrojové kódy

Handle packets of length 2

Chris Mullins 8 rokov pred
rodič
commit
188208d213
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      lib/MiLight/MiLightUdpServer.cpp

+ 2 - 2
lib/MiLight/MiLightUdpServer.cpp

@@ -23,11 +23,11 @@ void MiLightUdpServer::handleClient() {
   const size_t packetSize = socket.parsePacket();
   
   if (packetSize) {
-    if (packetSize == 3) {
+    if (packetSize < 2 || packetSize > 3) {
       socket.read(packetBuffer, packetSize);
       handleCommand(packetBuffer[0], packetBuffer[1]);
     } else {
-      Serial.print("Error, unexpected packet length (should always be 3, was: ");
+      Serial.print("Error, unexpected packet length (should always be 2-3, was: ");
       Serial.println(packetSize);
     }
   }