From 3aa56f3bd038c2f51f5cc81157039fd23838fd64 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 23 Feb 2026 15:24:16 -0500 Subject: [PATCH] motan: Rename "adxl345" dataset to "accelerometer" Make it possible to use other types of accelerometers in the motan_graph.py tool. Signed-off-by: Kevin O'Connor --- scripts/motan/data_logger.py | 6 +++--- scripts/motan/readlog.py | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/motan/data_logger.py b/scripts/motan/data_logger.py index 844b1f7c0..ff1f17e42 100755 --- a/scripts/motan/data_logger.py +++ b/scripts/motan/data_logger.py @@ -12,9 +12,9 @@ ClientInfo = {'program': 'motan_data_logger', 'version': 'v0.1'} # Available subscriptions when a given config type is found ConfigSubscriptions = [ # (cfgtype, capture_name, api_request, request_params) - ('adxl345', '{ct}:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), - ('lis2dw', '{ct}:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), - ('mpu9250', '{ct}:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), + ('adxl345', 'accelerometer:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), + ('lis2dw', 'accelerometer:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), + ('mpu9250', 'accelerometer:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), ('angle', '{ct}:{csn}', '{ct}/dump_{ct}', {'sensor': '{csn}'}), ('probe_eddy_current', 'ldc1612:{csn}', 'ldc1612/dump_ldc1612', {'sensor': '{csn}'}), diff --git a/scripts/motan/readlog.py b/scripts/motan/readlog.py index d5ae0fe66..11b1a7e0d 100644 --- a/scripts/motan/readlog.py +++ b/scripts/motan/readlog.py @@ -393,25 +393,26 @@ class HandleStepPhase: LogHandlers["step_phase"] = HandleStepPhase # Extract accelerometer data -class HandleADXL345: +class HandleAccelerometer: SubscriptionIdParts = 2 ParametersMin = ParametersMax = 2 DataSets = [ - ('adxl345(,)', 'Accelerometer for given axis (x, y, or z)'), + ('accelerometer(,)', + 'Accelerometer for given axis (x, y, or z)'), ] def __init__(self, lmanager, name, name_parts): self.name = name - self.adxl_name = name_parts[1] + self.accel_name = name_parts[1] self.jdispatch = lmanager.get_jdispatch() self.next_accel_time = self.last_accel_time = 0. self.next_accel = self.last_accel = (0., 0., 0.) self.cur_data = [] self.data_pos = 0 if name_parts[2] not in 'xyz': - raise error("Unknown adxl345 data selection '%s'" % (name,)) + raise error("Unknown accelerometer data selection '%s'" % (name,)) self.axis = 'xyz'.index(name_parts[2]) def get_label(self): - label = '%s %s acceleration' % (self.adxl_name, 'xyz'[self.axis]) + label = '%s %s acceleration' % (self.accel_name, 'xyz'[self.axis]) return {'label': label, 'units': 'Acceleration\n(mm/s^2)'} def pull_data(self, req_time): axis = self.axis @@ -434,7 +435,8 @@ class HandleADXL345: self.next_accel_time, x, y, z = self.cur_data[self.data_pos] self.next_accel = (x, y, z) self.data_pos += 1 -LogHandlers["adxl345"] = HandleADXL345 +LogHandlers["accelerometer"] = HandleAccelerometer +LogHandlers["adxl345"] = HandleAccelerometer # XXX - old capture name # Extract positions from magnetic angle sensor class HandleAngle: