aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-08-23 13:56:01 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-08-30 12:26:36 -0400
commit404b64fd627e04f68f64db4fef605fae1a18a747 (patch)
tree8272287739f4c25f6d7420855ff4941ab3574bb4
parent22167f951022935d0f4eee1f02c3f2635861576e (diff)
downloadkutter-404b64fd627e04f68f64db4fef605fae1a18a747.tar.gz
kutter-404b64fd627e04f68f64db4fef605fae1a18a747.tar.xz
kutter-404b64fd627e04f68f64db4fef605fae1a18a747.zip
adxl345: Change default chip name from "default" to "adxl345"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--docs/Config_Changes.md4
-rw-r--r--docs/G-Codes.md4
-rw-r--r--klippy/extras/adxl345.py12
3 files changed, 10 insertions, 10 deletions
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index 24d4b3e4..13fefdad 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -8,6 +8,10 @@ All dates in this document are approximate.
## Changes
+20210830: The default adxl345 name is now "adxl345". The default CHIP
+parameter for the `ACCELEROMETER_MEASURE` and `ACCELEROMETER_QUERY` is
+now also "adxl345".
+
20210830: The adxl345 ACCELEROMETER_MEASURE command no longer supports
a RATE parameter. To alter the query rate, update the printer.cfg
file and issue a RESTART command.
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index 1c2644f3..dbc176ac 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -727,7 +727,7 @@ The following commands are available when an
[adxl345 config section](Config_Reference.md#adxl345) is enabled:
- `ACCELEROMETER_MEASURE [CHIP=<config_name>] [NAME=<value>]`: Starts
accelerometer measurements at the requested number of samples per
- second. If CHIP is not specified it defaults to "default". The
+ second. If CHIP is not specified it defaults to "adxl345". The
command works in a start-stop mode: when executed for the first
time, it starts the measurements, next execution stops them. The
results of measurements are written to a file named
@@ -740,7 +740,7 @@ The following commands are available when an
generated.
- `ACCELEROMETER_QUERY [CHIP=<config_name>] [RATE=<value>]`: queries
accelerometer for the current value. If CHIP is not specified it
- defaults to "default". If RATE is not specified, the default value
+ defaults to "adxl345". If RATE is not specified, the default value
is used. This command is useful to test the connection to the
ADXL345 accelerometer: one of the returned values should be a
free-fall acceleration (+/- some noise of the chip).
diff --git a/klippy/extras/adxl345.py b/klippy/extras/adxl345.py
index 9d2f8945..428da1e3 100644
--- a/klippy/extras/adxl345.py
+++ b/klippy/extras/adxl345.py
@@ -83,11 +83,9 @@ class ADXLCommandHelper:
self.printer = config.get_printer()
self.chip = chip
self.bg_client = None
- self.name = "default"
- if len(config.get_name().split()) > 1:
- self.name = config.get_name().split()[1]
+ self.name = config.get_name().split()[-1]
self.register_commands(self.name)
- if self.name == "default":
+ if self.name == "adxl345":
self.register_commands(None)
def register_commands(self, name):
# Register commands
@@ -121,7 +119,7 @@ class ADXLCommandHelper:
self.bg_client = None
bg_client.finish_measurements()
# Write data to file
- if self.name == "default":
+ if self.name == "adxl345":
filename = "/tmp/adxl345-%s.csv" % (name,)
else:
filename = "/tmp/adxl345-%s-%s.csv" % (self.name, name,)
@@ -246,9 +244,7 @@ class ADXL345:
# API server endpoints
self.api_dump = motion_report.APIDumpHelper(
self.printer, self._api_update, self._api_startstop, 0.100)
- self.name = "default"
- if len(config.get_name().split()) > 1:
- self.name = config.get_name().split()[1]
+ self.name = config.get_name().split()[-1]
wh = self.printer.lookup_object('webhooks')
wh.register_mux_endpoint("adxl345/dump_adxl345", "sensor", self.name,
self._handle_dump_adxl345)