   sendHx711toMqtt(payload, topicEvery);
 
   payload = "{\"WeightAvg\":0}";
-  sendHx711toMqtt(payload, topicAverage);  
+  sendHx711toMqtt(payload, topicAverage);
 
 }
 


  if (WiFi.status() == WL_CONNECTED) {
    if (!client.connected()) {
      if  (
        client.connect(MQTT::Connect((char*) clientName.c_str()).set_clean_session().set_keepalive(120))) {
        client.publish(hellotopic, "hello from ESP8266 s06");
      }
    }

    if (client.connected()) {
      client.loop();
    } else {
      ESP.restart();
    }
  } else {
      Serial.println("Could not connect to WIFI");
      ESP.restart();    
  }
  
  if ( blank_checked == LOW ) {
    delay(2000);
    check_blank();

}


void sendHx711toMqtt(String payload, char* topic)
{
  if (WiFi.status() == WL_CONNECTED) {
    if (!client.connected()) {
      if ( client.connect(MQTT::Connect((char*) clientName.c_str()).set_clean_session().set_keepalive(120))) {
        client.publish(hellotopic, "hello from ESP8266 s06");
      }
    }

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

      if (client.publish(MQTT::Publish(topic, (char*) payload.c_str()).set_retain())) {
        Serial.println("Publish ok");
        if ( topic == "esp8266/arduino/s06" ) {
          AvgMeasuredIsSent = HIGH;
        }
      }
      else {
        Serial.println("Publish failed");
        ESP.restart();
      }
    }
  } else {
    Serial.println("Could not connect to WIFI");
    ESP.restart();
  }
}

