motan: Add support for dumping and analyzing adxl345 data

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-08-12 15:59:41 -04:00
parent 0b4fbc78a8
commit f11acd8065
3 changed files with 71 additions and 0 deletions

View file

@ -150,6 +150,13 @@ class DataLogger:
for stepper in motion_report.get("steppers", []):
self.send_subscribe("stepq:" + stepper,
"motion_report/dump_stepper", {"name": stepper})
# Subscribe to additional sensor data
config = status["configfile"]["settings"]
for cfgname in config.keys():
if cfgname == "adxl345" or cfgname.startswith("adxl345 "):
aname = cfgname.split()[-1]
self.send_subscribe("adxl345:" + aname, "adxl345/dump_adxl345",
{"sensor": aname})
def handle_dump(self, msg, raw_msg):
msg_id = msg["id"]
self.db.setdefault("subscriptions", {})[msg_id] = msg["result"]