fix calibration cmd output

This commit is contained in:
interfisch 2021-02-22 20:24:50 +01:00
parent 95c1e02048
commit f78193556d
1 changed files with 6 additions and 3 deletions

View File

@ -195,7 +195,7 @@ void loopHandler() {
if (livesend && (millis()>last_mqtt_send+MQTT_SENDINTERVALL)) { if (livesend && (millis()>last_mqtt_send+MQTT_SENDINTERVALL)) {
last_mqtt_send=millis(); last_mqtt_send=millis();
float weight_filtered=getFilteredWeight(); //float weight_filtered=getFilteredWeight();
float spread=getWeightSpread(); float spread=getWeightSpread();
char charBuf[10]; char charBuf[10];
@ -293,9 +293,12 @@ bool cmdHandler(const HomieRange& range, const String& value) {
scaleNode.setProperty("cmd").send("HX711 not found"); 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 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 { } else {
Serial.println("HX711 not found."); Serial.println("HX711 not found.");
scaleNode.setProperty("cmd").send("HX711 not found"); scaleNode.setProperty("cmd").send("HX711 not found");