Explorar el Código

Bug fix - packet repeats not correctly applied when settings are saved

Chris Mullins hace 8 años
padre
commit
b0a076828e
Se han modificado 3 ficheros con 2 adiciones y 3 borrados
  1. 1 1
      lib/MiLight/MiLightClient.cpp
  2. 0 2
      lib/WebServer/MiLightHttpServer.cpp
  3. 1 0
      src/main.cpp

+ 1 - 1
lib/MiLight/MiLightClient.cpp

@@ -109,7 +109,7 @@ void MiLightClient::write(uint8_t packet[]) {
   }
 
 #ifdef DEBUG_PRINTF
-  printf("Sending packet: ");
+  printf("Sending packet (%d repeats): ", this->resendCount);
   for (int i = 0; i < currentRemote->packetFormatter->getPacketLength(); i++) {
     printf("%02X", packet[i]);
   }

+ 0 - 2
lib/WebServer/MiLightHttpServer.cpp

@@ -142,8 +142,6 @@ void MiLightHttpServer::applySettings(Settings& settings) {
   } else {
     server.disableAuthentication();
   }
-
-  milightClient->setResendCount(settings.packetRepeats);
 }
 
 void MiLightHttpServer::onSettingsSaved(SettingsSavedHandler handler) {

+ 1 - 0
src/main.cpp

@@ -167,6 +167,7 @@ void applySettings() {
   milightClient = new MiLightClient(radioFactory, stateStore);
   milightClient->begin();
   milightClient->onPacketSent(onPacketSentHandler);
+  milightClient->setResendCount(settings.packetRepeats);
 
   if (settings.mqttServer().length() > 0) {
     mqttClient = new MqttClient(settings, milightClient);