Skip to content

Commit

Permalink
添加重量去皮命令 TARE_WEIGHT
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoGeTiertime committed Jan 19, 2024
1 parent cab74df commit 827209e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions klippy/extras/hx71x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down

0 comments on commit 827209e

Please sign in to comment.