78 void SetGlobalBounds(
float min_bound_degrees,
float max_bound_degrees) noexcept;
97 void SetUnbounded(
float current_position_degrees,
float default_range_degrees = 175.0f) noexcept;
114 float edge_backoff_deg = 3.5f) noexcept;
160 bool SetDwellTimes(uint32_t dwell_at_min_ms, uint32_t dwell_at_max_ms) noexcept;
167 void GetDwellTimes(uint32_t& dwell_at_min_ms, uint32_t& dwell_at_max_ms) const noexcept;
206 bool Start() noexcept;
212 void Pause() noexcept;
217 void Stop() noexcept;
288#ifndef FATIGUE_MOTION_HEADER_INCLUDED
289#define FATIGUE_MOTION_HEADER_INCLUDED
292#undef FATIGUE_MOTION_HEADER_INCLUDED
ESP32 SPI implementation of TMC51x0 communication interface.
Definition esp32_tmc51x0_bus.hpp:120
ESP32 FreeRTOS mutex wrapper for TMC51x0 driver.
Definition esp32_tmc_mutex.hpp:24
Unified fatigue test motion controller.
Definition fatigue_motion.hpp:26
void Pause() noexcept
Pause active motion (stops movement but keeps motor energized for resume).
Definition fatigue_motion_impl.hpp:439
void GetLocalBoundsFromCenterDegrees(float &min_degrees, float &max_degrees) const noexcept
Read local bounds (degrees).
Definition fatigue_motion_impl.hpp:162
void SetGlobalBounds(float min_bound_degrees, float max_bound_degrees) noexcept
Set global (hardware) bounds in degrees.
Definition fatigue_motion_impl.hpp:60
bool bounded_
Definition fatigue_motion.hpp:252
uint32_t GetCurrentCycles() const noexcept
Get current completed cycles.
Definition fatigue_motion_impl.hpp:258
void RecalculateEstimatedFrequency() noexcept
Definition fatigue_motion_impl.hpp:493
float local_max_bound_
Definition fatigue_motion.hpp:250
uint32_t GetTargetCycles() const noexcept
Get configured target cycles.
Definition fatigue_motion_impl.hpp:263
Esp32TmcMutex & driver_mutex_
Definition fatigue_motion.hpp:277
uint32_t target_cycles_
Definition fatigue_motion.hpp:264
uint32_t dwell_at_min_ms_
Definition fatigue_motion.hpp:258
MotionState state_
Definition fatigue_motion.hpp:270
void Update() noexcept
Periodic update tick.
Definition fatigue_motion_impl.hpp:572
bool SetDwellTimes(uint32_t dwell_at_min_ms, uint32_t dwell_at_max_ms) noexcept
Set dwell times at local bounds.
Definition fatigue_motion_impl.hpp:230
tmc51x0::TMC51x0< Esp32SPI > * driver_
Definition fatigue_motion.hpp:244
~FatigueTestMotion() noexcept
Destructor.
void ClipLocalBoundsToGlobal() noexcept
Definition fatigue_motion_impl.hpp:551
float GetMaxVelocity() const noexcept
Get configured maximum velocity (RPM).
Definition fatigue_motion_impl.hpp:194
float GetAcceleration() const noexcept
Get configured acceleration (rev/s²).
Definition fatigue_motion_impl.hpp:220
void GetGlobalBoundsDegrees(float &min_degrees, float &max_degrees) const noexcept
Read current global bounds (degrees).
Definition fatigue_motion_impl.hpp:80
bool SetAcceleration(float amax_rev_s2) noexcept
Set acceleration for oscillation (direct TMC5160 AMAX control).
Definition fatigue_motion_impl.hpp:199
void ResetCycles() noexcept
Reset cycle counter and completion flags.
Definition fatigue_motion_impl.hpp:273
void SetUnbounded(float current_position_degrees, float default_range_degrees=175.0f) noexcept
Mark the system as unbounded and establish a default travel window.
Definition fatigue_motion_impl.hpp:86
float vmax_rpm_
Definition fatigue_motion.hpp:256
uint32_t current_cycles_
Definition fatigue_motion.hpp:265
bool IsRunning() const noexcept
Whether the motion controller is currently active.
Definition fatigue_motion_impl.hpp:488
bool Start() noexcept
Start active motion.
Definition fatigue_motion_impl.hpp:287
float amplitude_
Definition fatigue_motion.hpp:255
bool IsBounded() const noexcept
Whether the controller is in bounded mode (mechanical stops found).
Definition fatigue_motion_impl.hpp:282
float local_min_bound_
Definition fatigue_motion.hpp:249
FatigueTestMotion(tmc51x0::TMC51x0< Esp32SPI > *driver, Esp32TmcMutex &driver_mutex) noexcept
Construct a motion controller bound to a TMC51x0 driver instance.
Definition fatigue_motion_impl.hpp:45
uint32_t dwell_start_time_ms_
Definition fatigue_motion.hpp:271
MotionState
Definition fatigue_motion.hpp:269
float home_position_
Definition fatigue_motion.hpp:251
bool IsCycleComplete() const noexcept
Check whether the configured target cycle count has been reached.
Definition fatigue_motion_impl.hpp:268
Status GetStatus() const noexcept
Snapshot current controller status.
Definition fatigue_motion_impl.hpp:782
void Stop() noexcept
Stop active motion and command driver stop.
Definition fatigue_motion_impl.hpp:451
float global_min_bound_
Definition fatigue_motion.hpp:247
uint64_t start_time_us_
Definition fatigue_motion.hpp:261
float estimated_frequency_hz_
Definition fatigue_motion.hpp:274
void GetDwellTimes(uint32_t &dwell_at_min_ms, uint32_t &dwell_at_max_ms) const noexcept
Get dwell times at local bounds.
Definition fatigue_motion_impl.hpp:243
bool SetMaxVelocity(float vmax_rpm) noexcept
Set maximum velocity for oscillation (direct TMC5160 VMAX control).
Definition fatigue_motion_impl.hpp:174
uint32_t dwell_at_max_ms_
Definition fatigue_motion.hpp:259
bool SetLocalBoundsFromCenterDegrees(float min_degrees_from_center, float max_degrees_from_center, float edge_backoff_deg=3.5f) noexcept
Set local oscillation bounds (degrees) relative to the center.
Definition fatigue_motion_impl.hpp:105
float amax_rev_s2_
Definition fatigue_motion.hpp:257
bool SetTargetCycles(uint32_t cycles) noexcept
Set target cycle count (0 = infinite).
Definition fatigue_motion_impl.hpp:249
float global_max_bound_
Definition fatigue_motion.hpp:248
bool running_
Definition fatigue_motion.hpp:260
bool cycle_complete_
Definition fatigue_motion.hpp:266
float GetEstimatedCycleFrequency() const noexcept
Get estimated cycle frequency based on current velocity/accel/distance.
Definition fatigue_motion_impl.hpp:225
Main class representing a TMC51x0 stepper motor driver (TMC5130 & TMC5160)
Definition tmc51x0.hpp:119
ESP32-specific communication interfaces for TMC51x0 using SPI and UART (TMC5130 & TMC51x0)
ESP32 FreeRTOS mutex wrapper for TMC51x0 driver thread safety.
Full implementation of FatigueTestMotion class.
Definition fatigue_motion.hpp:18
Definition tmc51x0_register_defs.cpp:10
Status structure containing current motion controller state.
Definition fatigue_motion.hpp:31
uint32_t dwell_max_ms
Dwell time at max position (ms)
Definition fatigue_motion.hpp:42
uint32_t dwell_min_ms
Dwell time at min position (ms)
Definition fatigue_motion.hpp:41
float estimated_frequency_hz
Derived cycle frequency (informational)
Definition fatigue_motion.hpp:36
float amax_rev_s2
User-set acceleration (rev/s²)
Definition fatigue_motion.hpp:35
float max_degrees_from_center
Local max bound relative to center (degrees)
Definition fatigue_motion.hpp:38
float global_min_degrees
Global min bound (degrees)
Definition fatigue_motion.hpp:43
bool running
Whether motion is currently active.
Definition fatigue_motion.hpp:32
float min_degrees_from_center
Local min bound relative to center (degrees)
Definition fatigue_motion.hpp:37
float vmax_rpm
User-set max velocity (RPM)
Definition fatigue_motion.hpp:34
float global_max_degrees
Global max bound (degrees)
Definition fatigue_motion.hpp:44
uint32_t target_cycles
Target cycle count (0 = infinite)
Definition fatigue_motion.hpp:40
uint32_t current_cycles
Number of cycles completed.
Definition fatigue_motion.hpp:39
bool bounded
Whether mechanical bounds were detected.
Definition fatigue_motion.hpp:33
Main TMC51x0 stepper motor driver interface and subsystem classes.