Skip to content

Commit

Permalink
motan: Support recording lis2dw and mpu9250 sensors from data_logger.py
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Mar 20, 2024
1 parent de1cf21 commit 40728e9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scripts/motan/data_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,15 @@ def handle_subscribe(self, msg, raw_msg):
self.send_subscribe("stepq:" + stepper,
"motion_report/dump_stepper", {"name": stepper})
# Subscribe to additional sensor data
stypes = ["adxl345", "lis2dw", "mpu9250", "angle"]
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})
if cfgname.startswith("angle "):
aname = cfgname.split()[1]
self.send_subscribe("angle:" + aname, "angle/dump_angle",
{"sensor": aname})
for st in stypes:
if cfgname == st or cfgname.startswith(st + " "):
aname = cfgname.split()[-1]
lname = "%s:%s" % (st, aname)
qcmd = "%s/dump_%s" % (st, st)
self.send_subscribe(lname, qcmd, {"sensor": aname})
def handle_dump(self, msg, raw_msg):
msg_id = msg["id"]
if "result" not in msg:
Expand Down

0 comments on commit 40728e9

Please sign in to comment.