angle: Initial support for angle sensor calibration

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-08-21 22:05:53 -04:00
parent 74937326d3
commit aec742ece4
4 changed files with 286 additions and 3 deletions

View file

@ -354,7 +354,8 @@ A request may look like:
and might return:
`{"id": 123,"result":{"header":["time","angle"]}}`
and might later produce asynchronous messages such as:
`{"params":{"errors":0,"data":[[1290.951905,-5063],[1290.952321,-5065]]}}`
`{"params":{"position_offset":3.151562,"errors":0,
"data":[[1290.951905,-5063],[1290.952321,-5065]]}}`
The "header" field in the initial query response is used to describe
the fields found in later "data" responses.

View file

@ -4007,6 +4007,7 @@ Magnetic hall angle sensor support for reading stepper motor angle
shaft measurements using a1333, as5047d, or tle5012b SPI chips. The
measurements are available via the [API Server](API_Server.md) and
[motion analysis tool](Debugging.md#motion-analysis-and-data-logging).
See the [G-Code reference](G-Codes.md#angle) for available commands.
```
[angle my_angle_sensor]
@ -4017,6 +4018,12 @@ sensor_type:
#sample_period: 0.000400
# The query period (in seconds) to use during measurements. The
# default is 0.000400 (which is 2500 samples per second).
#stepper:
# The name of the stepper that the angle sensor is attached to (eg,
# "stepper_x"). Setting this value enables an angle calibration
# tool. To use this feature, the Python "numpy" package must be
# installed. The default is to not enable angle calibration for the
# angle sensor.
cs_pin:
# The SPI enable pin for the sensor. This parameter must be provided.
#spi_speed:

View file

@ -106,6 +106,27 @@ VAL=<value>`: Writes raw "value" into a register "register". Both
"value" and "register" can be a decimal or a hexadecimal integer. Use
with care, and refer to ADXL345 data sheet for the reference.
### [angle]
The following commands are available when an
[angle config section](Config_Reference.md#angle) is enabled.
#### ANGLE_CALIBRATE
`ANGLE_CALIBRATE CHIP=<chip_name>`: Perform angle calibration on the
given sensor (there must be an `[angle chip_name]` config section that
has specified a `stepper` parameter). IMPORTANT - this tool will
command the stepper motor to move without checking the normal
kinematic boundary limits. Ideally the motor should be disconnected
from any printer carriage before performing calibration. If the
stepper can not be disconnected from the printer, make sure the
carriage is near the center of its rail before starting calibration.
(The stepper motor may move forwards or backwards two full rotations
during this test.) After completing this test use the `SAVE_CONFIG`
command to save the calibration data to the config file. In order to
use this tool the Python "numpy" package must be installed (see the
[measuring resonance document](Measuring_Resonances.md#software-installation)
for more information).
### [bed_mesh]
The following commands are available when the