Переглянути джерело

send more copies for http

Chris Mullins 8 роки тому
батько
коміт
576202f04f

+ 0 - 1
lib/MiLight/MiLightRadio.cpp

@@ -62,7 +62,6 @@ int MiLightRadio::configure() {
 
 bool MiLightRadio::available()
 {
-  configure(); 
   if (_waiting) {
 #ifdef DEBUG_PRINTF
   printf("_waiting\n");

+ 9 - 0
lib/WebServer/MiLightHttpServer.cpp

@@ -181,6 +181,8 @@ void MiLightHttpServer::handleUpdateGroup(const UrlTokenBindings* urlBindings) {
     server.send(400, "text/plain", body);
     return;
   }
+  
+  milightClient->setResendCount(MILIGHT_RESEND_COUNT_FOR_HTTP);
     
   if (request.containsKey("status")) {
     const String& statusStr = request.get<String>("status");
@@ -222,6 +224,9 @@ void MiLightHttpServer::handleUpdateGroup(const UrlTokenBindings* urlBindings) {
     }
     
     if (request.containsKey("command")) {
+      // CCT command work more effectively with a lower number of repeats it seems.
+      milightClient->setResendCount(MILIGHT_DEFAULT_RESEND_COUNT);
+      
       if (request["command"] == "level_up") {
         milightClient->increaseCctBrightness(deviceId, groupId);
       }
@@ -240,6 +245,8 @@ void MiLightHttpServer::handleUpdateGroup(const UrlTokenBindings* urlBindings) {
     }
   } 
   
+  milightClient->setResendCount(MILIGHT_DEFAULT_RESEND_COUNT);
+  
   server.send(200, "application/json", "true");
 }
 
@@ -258,6 +265,8 @@ void MiLightHttpServer::handleUpdateGateway(const UrlTokenBindings* urlBindings)
     return;
   }
   
+  milightClient->setResendCount(MILIGHT_DEFAULT_RESEND_COUNT);
+  
   if (request.containsKey("status")) {
     if (request["status"] == "on") {
       milightClient->allOn(type, deviceId);

+ 2 - 0
lib/WebServer/MiLightHttpServer.h

@@ -5,6 +5,8 @@
 #ifndef _MILIGHT_HTTP_SERVER
 #define _MILIGHT_HTTP_SERVER 
 
+#define MILIGHT_RESEND_COUNT_FOR_HTTP 50
+
 typedef std::function<void(void)> SettingsSavedHandler;
 
 class MiLightHttpServer {