        payload += x;
        payload += "}";
 
-      sendHx711(payload);
-    }
-
-}
-
-
-void sendHx711(String payload) {
+      sendHx711topicAverage(payload);
+    }
+
+}
+
+
+void sendHx711topicEvery(String payload) {
   if (!client.connected()) {
     if (client.connect((char*) clientName.c_str())) {
       Serial.println("Connected to MQTT broker again HX711");
       Serial.print("Topic is: ");
-      Serial.println(topic);
+      Serial.println(topicEvery);
     }
     else {
       Serial.println("MQTT connect failed");

       payload += x;
       payload += "}";

      sendHx711(payload);
    }

     if ( c == 1 ) {

    Serial.println(payload);

    if (
      client.publish(MQTT::Publish(topicEvery, (char*) payload.c_str())
                     .set_retain()
                    )
    ) {
      Serial.println("Publish ok");
    }
    else {
      Serial.println("Publish failed");
    }
  }

}


void sendHx711topicAverage(String payload) {
  if (!client.connected()) {
    if (client.connect((char*) clientName.c_str())) {
      Serial.println("Connected to MQTT broker again HX711");
      Serial.print("Topic is: ");
      Serial.println(topicAverage);
    }
    else {
      Serial.println("MQTT connect failed");
      Serial.println("Will reset and try again...");
      abort();
    }
  }

  if (client.connected()) {
    Serial.print("Sending payload: ");
    Serial.println(payload);

    if (
      client.publish(MQTT::Publish(topicAverage, (char*) payload.c_str())
                     .set_retain()
                    )
    ) {
