diff --git a/src/main.cpp b/src/main.cpp index 75f8c8f..f8c4f0a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -195,7 +195,7 @@ void loopHandler() { if (livesend && (millis()>last_mqtt_send+MQTT_SENDINTERVALL)) { last_mqtt_send=millis(); - float weight_filtered=getFilteredWeight(); + //float weight_filtered=getFilteredWeight(); float spread=getWeightSpread(); char charBuf[10]; @@ -293,9 +293,12 @@ bool cmdHandler(const HomieRange& range, const String& value) { scaleNode.setProperty("cmd").send("HX711 not found"); } - }else if (value=="adc") { //get raw value. use "reset" first. then adc to get value for calibration to enter in SCALE_CALIBRATION + }else if (value=="calibrate") { //get raw value. use "reset" first. then adc to get value for calibration to enter in SCALE_CALIBRATION if (scale.wait_ready_timeout(1000)) { //for non blocking mode - scaleNode.setProperty("cmd").send("adc="+scale.read_average(20)); + float _units=scale.get_units(10); + char charBuf[13]; + dtostrf(_units,6, 6, charBuf); + scaleNode.setProperty("cmd").send(charBuf); } else { Serial.println("HX711 not found."); scaleNode.setProperty("cmd").send("HX711 not found");