Bläddra i källkod

fix all on/off in packet formater, add support for cct nightmode

Chris Mullins 8 år sedan
förälder
incheckning
7079031ede
3 ändrade filer med 11 tillägg och 0 borttagningar
  1. 6 0
      lib/MiLight/CctPacketFormatter.cpp
  2. 4 0
      lib/Udp/V5MiLightUdpServer.cpp
  3. 1 0
      lib/Udp/V5MiLightUdpServer.h

+ 6 - 0
lib/MiLight/CctPacketFormatter.cpp

@@ -68,6 +68,9 @@ uint8_t CctPacketFormatter::getCctStatusButton(uint8_t groupId, MiLightStatus st
 
   if (status == ON) {
     switch(groupId) {
+      case 0:
+        button = CCT_ALL_ON;
+        break;
       case 1:
         button = CCT_GROUP_1_ON;
         break;
@@ -83,6 +86,9 @@ uint8_t CctPacketFormatter::getCctStatusButton(uint8_t groupId, MiLightStatus st
     }
   } else {
     switch(groupId) {
+      case 0:
+        button = CCT_ALL_OFF;
+        break;
       case 1:
         button = CCT_GROUP_1_OFF;
         break;

+ 4 - 0
lib/Udp/V5MiLightUdpServer.cpp

@@ -96,6 +96,10 @@ void V5MiLightUdpServer::handleCommand(uint8_t command, uint8_t commandArg) {
         client->increaseTemperature();
         break;
 
+      case UDP_CCT_NIGHT_MODE:
+        client->enableNightMode();
+        break;
+
       default:
         if (!handled) {
           Serial.print(F("V5MiLightUdpServer - Unhandled command: "));

+ 1 - 0
lib/Udp/V5MiLightUdpServer.h

@@ -24,6 +24,7 @@ enum MiLightUdpCommands {
   UDP_CCT_TEMPERATURE_UP     = 0x3E,
   UDP_CCT_BRIGHTNESS_DOWN    = 0x34,
   UDP_CCT_BRIGHTNESS_UP      = 0x3C,
+  UDP_CCT_NIGHT_MODE         = 0xB9,
 
   UDP_RGBW_ALL_ON            = 0x41,
   UDP_RGBW_ALL_OFF           = 0x42,