Skip to content

Commit

Permalink
hx71x: Update api header and docs to correctly note "value" field
Browse files Browse the repository at this point in the history
Update both hx71x and ads1220 to reflect that there is a third "value"
field in the reported data.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor authored and rogerlz committed Sep 23, 2024
1 parent 95b32b0 commit 2669b10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 6 additions & 4 deletions docs/API_Server.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
6 changes: 2 additions & 4 deletions klippy/extras/ads1220.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 2 additions & 3 deletions klippy/extras/hx71x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2669b10

Please sign in to comment.