From 2669b101deba1ac81127965e16e755c7fe1bc968 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 2 Aug 2024 13:44:26 -0400 Subject: [PATCH] hx71x: Update api header and docs to correctly note "value" field Update both hx71x and ads1220 to reflect that there is a third "value" field in the reported data. Signed-off-by: Kevin O'Connor --- docs/API_Server.md | 10 ++++++---- klippy/extras/ads1220.py | 6 ++---- klippy/extras/hx71x.py | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/API_Server.md b/docs/API_Server.md index 894b536f9..3da4584b1 100644 --- a/docs/API_Server.md +++ b/docs/API_Server.md @@ -375,9 +375,10 @@ A request may look like: `{"id": 123, "method":"hx71x/dump_hx71x", "params": {"sensor": "load_cell", "response_template": {}}}` and might return: -`{"id": 123,"result":{"header":["time","counts"]}}` +`{"id": 123,"result":{"header":["time","counts","value"]}}` and might later produce asynchronous messages such as: -`{"params":{"data":[[3292.432935, 562534], [3292.4394937, 5625322]]}}` +`{"params":{"data":[[3292.432935, 562534, 0.067059278], +[3292.4394937, 5625322, 0.670590639]]}}` ### ads1220/dump_ads1220 @@ -390,9 +391,10 @@ A request may look like: `{"id": 123, "method":"ads1220/dump_ads1220", "params": {"sensor": "load_cell", "response_template": {}}}` and might return: -`{"id": 123,"result":{"header":["time","counts"]}}` +`{"id": 123,"result":{"header":["time","counts","value"]}}` and might later produce asynchronous messages such as: -`{"params":{"data":[[3292.432935, 562534], [3292.4394937, 5625322]]}}` +`{"params":{"data":[[3292.432935, 562534, 0.067059278], +[3292.4394937, 5625322, 0.670590639]]}}` ### pause_resume/cancel diff --git a/klippy/extras/ads1220.py b/klippy/extras/ads1220.py index 5b879cc54..341d9b559 100644 --- a/klippy/extras/ads1220.py +++ b/klippy/extras/ads1220.py @@ -98,11 +98,9 @@ def __init__(self, config): UPDATE_INTERVAL, ) # publish raw samples to the socket + hdr = {"header": ("time", "counts", "value")} self.batch_bulk.add_mux_endpoint( - "ads1220/dump_ads1220", - "sensor", - self.name, - {"header": ("time", "counts")}, + "ads1220/dump_ads1220", "sensor", self.name, hdr ) # Command Configuration mcu.add_config_cmd( diff --git a/klippy/extras/hx71x.py b/klippy/extras/hx71x.py index b0fe6833c..92b613c7a 100644 --- a/klippy/extras/hx71x.py +++ b/klippy/extras/hx71x.py @@ -68,9 +68,8 @@ def __init__( ) # publish raw samples to the socket dump_path = "%s/dump_%s" % (sensor_type, sensor_type) - self.batch_bulk.add_mux_endpoint( - dump_path, "sensor", self.name, {"header": ("time", "counts")} - ) + hdr = {"header": ("time", "counts", "value")} + self.batch_bulk.add_mux_endpoint(dump_path, "sensor", self.name, hdr) # Command Configuration self.query_hx71x_cmd = None mcu.add_config_cmd(