Explorar o código

RGB: handle mode, mode speed up/down in packet update handler

Chris Mullins %!s(int64=8) %!d(string=hai) anos
pai
achega
19b5e5dcfe
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      lib/MiLight/RgbPacketFormatter.cpp

+ 10 - 0
lib/MiLight/RgbPacketFormatter.cpp

@@ -94,6 +94,16 @@ void RgbPacketFormatter::parsePacket(const uint8_t* packet, JsonObject& result)
     uint16_t remappedColor = Units::rescale<uint16_t, uint16_t>(packet[RGB_COLOR_INDEX], 360.0, 255.0);
     remappedColor = (remappedColor + 320) % 360;
     result["hue"] = remappedColor;
+  } else if (command == RGB_MODE_DOWN) {
+    result["command"] = "previous_mode";
+  } else if (command == RGB_MODE_UP) {
+    result["command"] = "next_mode";
+  } else if (command == RGB_SPEED_DOWN) {
+    result["command"] = "mode_speed_down";
+  } else if (command == RGB_SPEED_UP) {
+    result["command"] = "mode_speed_up";
+  } else {
+    result["button_id"] = command;
   }
 
   if (! result.containsKey("state")) {