mirror of
https://github.com/Klipper3d/klipper.git
synced 2026-02-08 17:21:04 -07:00
Merge 6ba6e4fea8 into 6d7d3403e4
This commit is contained in:
commit
cb2aa55cd5
1 changed files with 20 additions and 1 deletions
|
|
@ -398,6 +398,8 @@ class HandleADXL345:
|
|||
ParametersMin = ParametersMax = 2
|
||||
DataSets = [
|
||||
('adxl345(<name>,<axis>)', 'Accelerometer for given axis (x, y, or z)'),
|
||||
('mpu9250(<name>,<axis>)', 'Accelerometer for given axis (x, y, or z)'),
|
||||
('lis2dw(<name>,<axis>)', 'Accelerometer for given axis (x, y, or z)'),
|
||||
]
|
||||
def __init__(self, lmanager, name, name_parts):
|
||||
self.name = name
|
||||
|
|
@ -435,6 +437,8 @@ class HandleADXL345:
|
|||
self.next_accel = (x, y, z)
|
||||
self.data_pos += 1
|
||||
LogHandlers["adxl345"] = HandleADXL345
|
||||
LogHandlers["mpu9250"] = HandleADXL345
|
||||
LogHandlers["lis2dw"] = HandleADXL345
|
||||
|
||||
# Extract positions from magnetic angle sensor
|
||||
class HandleAngle:
|
||||
|
|
@ -737,6 +741,19 @@ class LogManager:
|
|||
self.status_tracker = TrackStatus(self, "status", self.start_status)
|
||||
self.jdispatch.add_handler("status", "status")
|
||||
return self.status_tracker
|
||||
def get_tip_msg(self, subscription_id):
|
||||
available = []
|
||||
dataset_name = subscription_id.split(":")[0]
|
||||
for k in self.log_subscriptions:
|
||||
if dataset_name in k:
|
||||
# Extract available keys
|
||||
name = k.split(":")[1:]
|
||||
if len(name) == 1:
|
||||
suggest = "%s(%s,...)" % (dataset_name, name[0])
|
||||
available.append(suggest)
|
||||
else:
|
||||
available.append(name)
|
||||
return "Available options: %s" % (", ".join(available))
|
||||
def setup_dataset(self, name):
|
||||
if name in self.datasets:
|
||||
return self.datasets[name]
|
||||
|
|
@ -750,7 +767,9 @@ class LogManager:
|
|||
if cls.SubscriptionIdParts:
|
||||
subscription_id = ":".join(name_parts[:cls.SubscriptionIdParts])
|
||||
if subscription_id not in self.log_subscriptions:
|
||||
raise error("Dataset '%s' not in capture" % (subscription_id,))
|
||||
tip_msg = self.get_tip_msg(subscription_id)
|
||||
raise error("Dataset '%s' not in capture\n%s" % (
|
||||
subscription_id, tip_msg))
|
||||
self.jdispatch.add_handler(name, subscription_id)
|
||||
self.datasets[name] = hdl = cls(self, name, name_parts)
|
||||
return hdl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue