adxl345: Move g-code commands to new helper class

Separate out the G-Code command handlers to a new ADXLCommandHelper()
class.  This helps separate the sensing code from the user interface
code.

Deprecate the RATE parameter of the ACCELEROMETER_MEASURE command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-08-11 21:54:19 -04:00
parent 6999ff6256
commit e03e0e9dac
3 changed files with 95 additions and 105 deletions

View file

@ -8,6 +8,10 @@ All dates in this document are approximate.
## Changes
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.
20210821: Several config settings in `printer.configfile.settings`
will now be reported as lists instead of raw strings. If the actual
raw string is desired, use `printer.configfile.config` instead.

View file

@ -725,21 +725,19 @@ is enabled:
The following commands are available when an
[adxl345 config section](Config_Reference.md#adxl345) is enabled:
- `ACCELEROMETER_MEASURE [CHIP=<config_name>] [RATE=<value>]
[NAME=<value>]`: Starts accelerometer measurements at the requested
number of samples per second. If CHIP is not specified it defaults
to "default". Valid rates are 25, 50, 100, 200, 400, 800, 1600,
and 3200. The command works in a start-stop mode: when executed for
the first time, it starts the measurements, next execution stops
them. If RATE is not specified, then the default value is used
(either from `printer.cfg` or `3200` default value). The results of
measurements are written to a file named
- `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
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
`/tmp/adxl345-<chip>-<name>.csv` where `<chip>` is the name of the
accelerometer chip (`my_chip_name` from `[adxl345 my_chip_name]`) and
`<name>` is the optional NAME parameter. If NAME is not specified it
defaults to the current time in "YYYYMMDD_HHMMSS" format. If the
accelerometer does not have a name in its config section (simply
`[adxl345]`) <chip> part of the name is not generated.
accelerometer chip (`my_chip_name` from `[adxl345 my_chip_name]`)
and `<name>` is the optional NAME parameter. If NAME is not
specified it defaults to the current time in "YYYYMMDD_HHMMSS"
format. If the accelerometer does not have a name in its config
section (simply `[adxl345]`) then `<chip>` part of the name is not
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