ESPHome  2024.10.2
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::stepper::Stepper Class Reference

#include <stepper.h>

Inheritance diagram for esphome::stepper::Stepper:
esphome::a4988::A4988 esphome::uln2003::ULN2003

Public Member Functions

void set_target (int32_t steps)
 
void report_position (int32_t steps)
 
void set_acceleration (float acceleration)
 
void set_deceleration (float deceleration)
 
void set_max_speed (float max_speed)
 
virtual void on_update_speed ()
 
bool has_reached_target ()
 

Data Fields

int32_t current_position {0}
 
int32_t target_position {0}
 

Protected Member Functions

void calculate_speed_ (uint32_t now)
 
int32_t should_step_ ()
 

Protected Attributes

float acceleration_ {1e6f}
 
float deceleration_ {1e6f}
 
float current_speed_ {0.0f}
 
float max_speed_ {1e6f}
 
uint32_t last_calculation_ {0}
 
uint32_t last_step_ {0}
 

Detailed Description

Definition at line 15 of file stepper.h.

Member Function Documentation

◆ calculate_speed_()

void esphome::stepper::Stepper::calculate_speed_ ( uint32_t  now)
protected

Definition at line 10 of file stepper.cpp.

◆ has_reached_target()

bool esphome::stepper::Stepper::has_reached_target ( )
inline

Definition at line 23 of file stepper.h.

◆ on_update_speed()

virtual void esphome::stepper::Stepper::on_update_speed ( )
inlinevirtual

Definition at line 22 of file stepper.h.

◆ report_position()

void esphome::stepper::Stepper::report_position ( int32_t  steps)
inline

Definition at line 18 of file stepper.h.

◆ set_acceleration()

void esphome::stepper::Stepper::set_acceleration ( float  acceleration)
inline

Definition at line 19 of file stepper.h.

◆ set_deceleration()

void esphome::stepper::Stepper::set_deceleration ( float  deceleration)
inline

Definition at line 20 of file stepper.h.

◆ set_max_speed()

void esphome::stepper::Stepper::set_max_speed ( float  max_speed)
inline

Definition at line 21 of file stepper.h.

◆ set_target()

void esphome::stepper::Stepper::set_target ( int32_t  steps)
inline

Definition at line 17 of file stepper.h.

◆ should_step_()

int32_t esphome::stepper::Stepper::should_step_ ( )
protected

Definition at line 32 of file stepper.cpp.

Field Documentation

◆ acceleration_

float esphome::stepper::Stepper::acceleration_ {1e6f}
protected

Definition at line 32 of file stepper.h.

◆ current_position

int32_t esphome::stepper::Stepper::current_position {0}

Definition at line 25 of file stepper.h.

◆ current_speed_

float esphome::stepper::Stepper::current_speed_ {0.0f}
protected

Definition at line 34 of file stepper.h.

◆ deceleration_

float esphome::stepper::Stepper::deceleration_ {1e6f}
protected

Definition at line 33 of file stepper.h.

◆ last_calculation_

uint32_t esphome::stepper::Stepper::last_calculation_ {0}
protected

Definition at line 36 of file stepper.h.

◆ last_step_

uint32_t esphome::stepper::Stepper::last_step_ {0}
protected

Definition at line 37 of file stepper.h.

◆ max_speed_

float esphome::stepper::Stepper::max_speed_ {1e6f}
protected

Definition at line 35 of file stepper.h.

◆ target_position

int32_t esphome::stepper::Stepper::target_position {0}

Definition at line 26 of file stepper.h.


The documentation for this class was generated from the following files: