HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0::StallGuardTuningResult Struct Reference

Result structure for StallGuard2 threshold (SGT) tuning. More...

#include <tmc51x0_types.hpp>

Public Member Functions

 StallGuardTuningResult ()=default
 Default constructor.
 

Public Attributes

int8_t optimal_sgt {0}
 Optimal SGT value found at target velocity.
 
bool tuning_success {false}
 Whether tuning succeeded at target velocity.
 
int8_t min_velocity_sgt {0}
 SGT value that works at minimum velocity (if requested)
 
bool min_velocity_success {false}
 Whether min velocity verification succeeded.
 
int8_t max_velocity_sgt {0}
 SGT value that works at maximum velocity (if requested)
 
bool max_velocity_success {false}
 Whether max velocity verification succeeded.
 
float actual_min_velocity {0.0F}
 Actual minimum velocity that works with optimal SGT.
 
float actual_max_velocity {0.0F}
 Actual maximum velocity that works with optimal SGT.
 
uint16_t target_velocity_sg_result {0}
 SG_RESULT value at target velocity with optimal SGT.
 
uint16_t min_velocity_sg_result {0}
 SG_RESULT value at min velocity (if verified)
 
uint16_t max_velocity_sg_result {0}
 SG_RESULT value at max velocity (if verified)
 

Detailed Description

Result structure for StallGuard2 threshold (SGT) tuning.

Contains comprehensive results from automatic SGT tuning, including optimal SGT values for target velocity and velocity range analysis. The tuning process prioritizes finding the best SGT value at the target velocity, then verifies and reports compatibility with the requested min/max velocity range.

Note
Target velocity is the most important parameter - the optimal SGT is determined primarily based on stable operation at target velocity.
If requested min/max velocities are not achievable with good SGT values, the actual achievable velocities are reported in actual_min_velocity and actual_max_velocity fields.

Constructor & Destructor Documentation

◆ StallGuardTuningResult()

tmc51x0::StallGuardTuningResult::StallGuardTuningResult ( )
default

Default constructor.

Initializes all fields to default/zero values indicating no tuning performed.

Member Data Documentation

◆ actual_max_velocity

float tmc51x0::StallGuardTuningResult::actual_max_velocity {0.0F}

Actual maximum velocity that works with optimal SGT.

If the requested max_velocity does not work with the optimal SGT, this field contains the highest velocity that does work. This allows the user to understand the actual operating range.

Valid only if max_velocity_success is false (i.e., requested max didn't work). Value is in the same unit as the tuning request. Actual max velocity that works (if requested max failed)

◆ actual_min_velocity

float tmc51x0::StallGuardTuningResult::actual_min_velocity {0.0F}

Actual minimum velocity that works with optimal SGT.

If the requested min_velocity does not work with the optimal SGT, this field contains the lowest velocity that does work. This allows the user to understand the actual operating range.

Valid only if min_velocity_success is false (i.e., requested min didn't work). Value is in the same unit as the tuning request. Actual min velocity that works (if requested min failed)

◆ max_velocity_sg_result

uint16_t tmc51x0::StallGuardTuningResult::max_velocity_sg_result {0}

SG_RESULT value at max velocity (if verified)

The actual StallGuard result value when operating at max velocity. Useful for understanding the load measurement range at high speeds. SG_RESULT at max velocity

◆ max_velocity_sgt

int8_t tmc51x0::StallGuardTuningResult::max_velocity_sgt {0}

SGT value that works at maximum velocity (if requested)

If max_velocity was specified and verified, this contains the SGT value that works at that velocity. May differ from optimal_sgt if velocities have different SGT requirements.

Valid only if max_velocity_success is true. SGT that works at max velocity

◆ max_velocity_success

bool tmc51x0::StallGuardTuningResult::max_velocity_success {false}

Whether max velocity verification succeeded.

If true, max_velocity_sgt is valid and the requested max_velocity works with the optimal SGT (or max_velocity_sgt if different). True if max velocity works with optimal SGT

◆ min_velocity_sg_result

uint16_t tmc51x0::StallGuardTuningResult::min_velocity_sg_result {0}

SG_RESULT value at min velocity (if verified)

The actual StallGuard result value when operating at min velocity. Useful for understanding the load measurement range at low speeds. SG_RESULT at min velocity

◆ min_velocity_sgt

int8_t tmc51x0::StallGuardTuningResult::min_velocity_sgt {0}

SGT value that works at minimum velocity (if requested)

If min_velocity was specified and verified, this contains the SGT value that works at that velocity. May differ from optimal_sgt if velocities have different SGT requirements.

Valid only if min_velocity_success is true. SGT that works at min velocity

◆ min_velocity_success

bool tmc51x0::StallGuardTuningResult::min_velocity_success {false}

Whether min velocity verification succeeded.

If true, min_velocity_sgt is valid and the requested min_velocity works with the optimal SGT (or min_velocity_sgt if different). True if min velocity works with optimal SGT

◆ optimal_sgt

int8_t tmc51x0::StallGuardTuningResult::optimal_sgt {0}

Optimal SGT value found at target velocity.

This is the primary result - the SGT value that provides stable, non-zero SG_RESULT readings at the target velocity. This value should be used for normal operation.

Range: -64 to +63 Valid only if tuning_success is true. Optimal SGT at target velocity

◆ target_velocity_sg_result

uint16_t tmc51x0::StallGuardTuningResult::target_velocity_sg_result {0}

SG_RESULT value at target velocity with optimal SGT.

The actual StallGuard result value when operating at target velocity with the optimal SGT. Useful for understanding the load measurement range.

Range: 0-1023 (0 = stall detected, higher = lower load) SG_RESULT at target velocity

◆ tuning_success

bool tmc51x0::StallGuardTuningResult::tuning_success {false}

Whether tuning succeeded at target velocity.

If true, optimal_sgt contains a valid SGT value that works at target velocity. If false, no suitable SGT value was found within the specified range. True if optimal SGT found at target velocity


The documentation for this struct was generated from the following file: