Bläddra i källkod

Merge branch 'v1.1.0' of github.com:sidoh/esp8266_milight_hub into github_download

Chris Mullins 8 år sedan
förälder
incheckning
7f0cee12a4
2 ändrade filer med 11 tillägg och 11 borttagningar
  1. 2 2
      README.md
  2. 9 9
      lib/MiLight/RgbCctPacketFormatter.cpp

+ 2 - 2
README.md

@@ -30,8 +30,8 @@ You'll need to flash the firmware and a SPIFFS image. It's really easy to do thi
 
 ```
 export ESP_BOARD=nodemcuv2
-platformio run -u $ESP_BOARD --target upload
-platformio run -u $ESP_BOARD --target uploadfs
+platformio run -e $ESP_BOARD --target upload
+platformio run -e $ESP_BOARD --target uploadfs
 ```
 
 Of course make sure to substitute `nodemcuv2` with the board that you're using.

+ 9 - 9
lib/MiLight/RgbCctPacketFormatter.cpp

@@ -7,14 +7,14 @@
 )
 
 uint8_t const RgbCctPacketFormatter::V2_OFFSETS[][4] = {
-  { 0x45, 0x1F, 0x14, 0x5C },
-  { 0x2B, 0xC9, 0xE3, 0x11 },
-  { 0xEE, 0xDE, 0x0B, 0xAA },
-  { 0xAF, 0x03, 0x1D, 0xF3 },
-  { 0x1A, 0xE2, 0xF0, 0xD1 },
-  { 0x04, 0xD8, 0x71, 0x42 },
-  { 0xAF, 0x04, 0xDD, 0x07 },
-  { 0xE1, 0x93, 0xB8, 0xE4 }
+  { 0x45, 0x1F, 0x14, 0x5C }, // request type
+  { 0x2B, 0xC9, 0xE3, 0x11 }, // id 1
+  { 0x6D, 0x5F, 0x8A, 0x2B }, // id 2
+  { 0xAF, 0x03, 0x1D, 0xF3 }, // command
+  { 0x1A, 0xE2, 0xF0, 0xD1 }, // argument
+  { 0x04, 0xD8, 0x71, 0x42 }, // sequence
+  { 0xAF, 0x04, 0xDD, 0x07 }, // group
+  { 0x61, 0x13, 0x38, 0x64 }  // checksum
 };
 
 void RgbCctPacketFormatter::initializePacket(uint8_t* packet) {
@@ -145,7 +145,7 @@ void RgbCctPacketFormatter::encodeV2Packet(uint8_t *packet) {
     packet[i] = encodeByte(packet[i], 0, key, V2_OFFSET(i, packet[0], V2_OFFSET_JUMP_START));
   }
   
-  packet[8] = encodeByte(sum, 3, key, V2_OFFSET(8, packet[0], 0));
+  packet[8] = encodeByte(sum, 2, key, V2_OFFSET(8, packet[0], 0));
 }
 
 void RgbCctPacketFormatter::format(uint8_t const* packet, char* buffer) {