From 3ef6e2ba5692bebc3ea17f804af8e4223b3d8643 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 19 Aug 2021 13:27:46 -0400 Subject: [PATCH] adxl345: Use config.getlist() for axes_map config option Signed-off-by: Kevin O'Connor --- klippy/extras/adxl345.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klippy/extras/adxl345.py b/klippy/extras/adxl345.py index 49e2888f..23167ffc 100644 --- a/klippy/extras/adxl345.py +++ b/klippy/extras/adxl345.py @@ -104,8 +104,8 @@ class ADXL345: self.last_tx_time = 0. am = {'x': (0, SCALE), 'y': (1, SCALE), 'z': (2, SCALE), '-x': (0, -SCALE), '-y': (1, -SCALE), '-z': (2, -SCALE)} - axes_map = config.get('axes_map', 'x,y,z').split(',') - if len(axes_map) != 3 or any([a.strip() not in am for a in axes_map]): + axes_map = config.getlist('axes_map', ('x','y','z'), count=3) + if any([a not in am for a in axes_map]): raise config.error("Invalid adxl345 axes_map parameter") self.axes_map = [am[a.strip()] for a in axes_map] self.data_rate = config.getint('rate', 3200)