Bläddra i källkod

Fix remote fetching for RGBW

Chris Mullins 8 år sedan
förälder
incheckning
5a0819d406
2 ändrade filer med 9 tillägg och 2 borttagningar
  1. 8 1
      lib/MiLight/MiLightRemoteConfig.cpp
  2. 1 1
      lib/WebServer/MiLightHttpServer.cpp

+ 8 - 1
lib/MiLight/MiLightRemoteConfig.cpp

@@ -29,13 +29,17 @@ const MiLightRemoteConfig* MiLightRemoteConfig::fromType(const String& type) {
     return &FUT098Config;
   }
 
+  Serial.println(F("ERROR - tried to fetch remote config for type"));
+
   return NULL;
 }
 
 const MiLightRemoteConfig* MiLightRemoteConfig::fromType(MiLightRemoteType type) {
   switch (type) {
-    case REMOTE_TYPE_RGB:
+    case REMOTE_TYPE_RGBW:
       return &FUT096Config;
+    case REMOTE_TYPE_RGB:
+      return &FUT098Config;
     case REMOTE_TYPE_CCT:
       return &FUT091Config;
     case REMOTE_TYPE_RGB_CCT:
@@ -43,6 +47,7 @@ const MiLightRemoteConfig* MiLightRemoteConfig::fromType(MiLightRemoteType type)
     case REMOTE_TYPE_FUT089:
       return &FUT089Config;
     default:
+      Serial.println(F("ERROR - tried to fetch remote config for unknown type"));
       return NULL;
   }
 }
@@ -60,6 +65,8 @@ const MiLightRemoteConfig* MiLightRemoteConfig::fromReceivedPacket(
     }
   }
 
+  Serial.println(F("ERROR - tried to fetch remote config for unknown packet"));
+
   return NULL;
 }
 

+ 1 - 1
lib/WebServer/MiLightHttpServer.cpp

@@ -14,7 +14,7 @@ void MiLightHttpServer::begin() {
   server.on("/", HTTP_GET, handleServe_P(index_html_gz, index_html_gz_len));
   server.on("/settings", HTTP_GET, handleServeFile(SETTINGS_FILE, APPLICATION_JSON));
   server.on("/settings", HTTP_PUT, [this]() { handleUpdateSettings(); });
-  server.on("/settings", HTTP_POST, [this]() { server.send_P(200, TEXT_PLAIN, PSTR("success. rebooting")); ESP.restart(); }, handleUpdateFile(SETTINGS_FILE));
+  server.on("/settings", HTTP_POST, [this]() { server.send_P(200, TEXT_PLAIN, PSTR("success.")); }, handleUpdateFile(SETTINGS_FILE));
   server.on("/radio_configs", HTTP_GET, [this]() { handleGetRadioConfigs(); });
 
   server.on("/gateway_traffic", HTTP_GET, [this]() { handleListenGateway(NULL); });