|
HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
|
StallGuard2 configuration structure. More...
#include <tmc51x0_types.hpp>
Public Member Functions | |
| StallGuardConfig ()=default | |
| Default constructor. | |
| StallGuardConfig (int8_t sgt_threshold, bool enable_filt=false, float min_vel=0.0F, float max_vel=0.0F, Unit vel_unit=Unit::RevPerSec, bool stop_on_stall=false) | |
| Helper constructor for quick setup. | |
| StallGuardConfig (StallGuardSensitivity sensitivity, bool enable_filt=false, float min_vel=0.0F, float max_vel=0.0F, Unit vel_unit=Unit::Steps, bool stop_on_stall=false) | |
| Helper constructor using sensitivity enum. | |
Public Attributes | |
| int8_t | threshold {0} |
| StallGuard2 threshold value. | |
| bool | enable_filter {false} |
| Enable StallGuard2 filter. | |
| float | min_velocity {0.0F} |
| Lower velocity threshold for StallGuard2 operation. | |
| float | max_velocity {0.0F} |
| Upper velocity threshold for StallGuard2 operation. | |
| Unit | velocity_unit {Unit::Steps} |
| Unit for velocity thresholds. | |
| bool | stop_on_stall {false} |
| Stop motor when stall detected. | |
StallGuard2 configuration structure.
User-friendly configuration for StallGuard2 load measurement and stall detection. StallGuard2 provides accurate measurement of motor load and can detect stalls. It's used for sensorless homing, CoolStep load-adaptive current reduction, and diagnostics.
|
default |
Default constructor.
Initializes with recommended default values:
|
inline |
Helper constructor for quick setup.
Creates a StallGuard2 configuration with typical settings.
| sgt_threshold | StallGuard2 threshold (-64 to +63, 0 = starting value) |
| enable_filt | Enable filter for smoother readings |
| min_vel | Minimum velocity for StallGuard2 operation |
| max_vel | Maximum velocity for StallGuard2 operation (0 = no limit) |
| vel_unit | Unit for velocity thresholds |
| stop_on_stall | Stop motor when stall detected |
|
inline |
Helper constructor using sensitivity enum.
Creates a StallGuard2 configuration using intuitive sensitivity levels.
| bool tmc51x0::StallGuardConfig::enable_filter {false} |
Enable StallGuard2 filter.
Filter reduces measurement rate to one measurement per electrical period (4 fullsteps). Compensates for motor construction variations (e.g., misalignment of phase magnets).
| float tmc51x0::StallGuardConfig::max_velocity {0.0F} |
Upper velocity threshold for StallGuard2 operation.
StallGuard2 may not operate reliably above this velocity. Set to match the upper limit of velocity range where StallGuard2 gives stable results.
| float tmc51x0::StallGuardConfig::min_velocity {0.0F} |
Lower velocity threshold for StallGuard2 operation.
StallGuard2 is disabled below this velocity. Set to match the lower limit of velocity range where StallGuard2 gives stable results.
| bool tmc51x0::StallGuardConfig::stop_on_stall {false} |
Stop motor when stall detected.
If true, motor stops (VACTUAL = 0) when stall is detected. Motor remains stopped until RAMP_STAT.event_stop_sg flag is read.
| int8_t tmc51x0::StallGuardConfig::threshold {0} |
StallGuard2 threshold value.
Controls StallGuard2 sensitivity for stall detection and sets optimum measurement range.
Range: -64 to +63
Tuning: Adjust until SG_RESULT is between 0-100 at maximum load before stall.
| Unit tmc51x0::StallGuardConfig::velocity_unit {Unit::Steps} |
Unit for velocity thresholds.
Specifies the unit used for min_velocity and max_velocity fields. Unit for velocity thresholds