diff --git a/klippy/extras/hx71x.py b/klippy/extras/hx71x.py index fdaeb24f728c..0aca620a3d41 100644 --- a/klippy/extras/hx71x.py +++ b/klippy/extras/hx71x.py @@ -238,6 +238,9 @@ def __init__(self, config): self.gcode.register_mux_command("QUERY_WEIGHT", "SENSOR", self.name, self.cmd_QUERY_WEIGHT, desc=self.cmd_QUERY_WEIGHT_help) + self.gcode.register_mux_command("TARE_WEIGHT", "SENSOR", self.name, + self.cmd_TARE_WEIGHT, + desc=self.cmd_TARE_WEIGHT_help) cmd_QUERY_WEIGHT_help = "Report on the status of a group of hx71x sensors" def cmd_QUERY_WEIGHT(self, gcmd): @@ -248,6 +251,12 @@ def cmd_QUERY_WEIGHT(self, gcmd): out = " ".join(out) gcmd.respond_info(self.name + ": " + out) + cmd_TARE_WEIGHT_help = "Tare the weight sensor" + def cmd_TARE_WEIGHT(self, gcmd): + for oid in self.oids: + self._sample_tare[oid] += self.weight[oid] + self.total_weight = 0.0 + def handle_connect(self): # self.reactor.update_timer(self.sample_timer, self.reactor.NOW) return