浏览代码

Handle packets of length 2

Chris Mullins 8 年之前
父节点
当前提交
188208d213
共有 1 个文件被更改,包括 2 次插入2 次删除
  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);
     }
   }