Prusa MINI Firmware overview
I2CPositionEncoder Class Reference

#include <I2CPositionEncoder.h>

Public Member Functions

void init (const uint8_t address, const AxisEnum axis)
 
void reset ()
 
void update ()
 
void set_homed ()
 
void set_unhomed ()
 
int32_t get_raw_count ()
 
FORCE_INLINE float mm_from_count (const int32_t count)
 
FORCE_INLINE float get_position_mm ()
 
FORCE_INLINE int32_t get_position ()
 
int32_t get_axis_error_steps (const bool report)
 
float get_axis_error_mm (const bool report)
 
void calibrate_steps_mm (const uint8_t iter)
 
bool passes_test (const bool report)
 
bool test_axis ()
 
FORCE_INLINE int get_error_count ()
 
FORCE_INLINE void set_error_count (const int newCount)
 
FORCE_INLINE uint8_t get_address ()
 
FORCE_INLINE void set_address (const uint8_t addr)
 
FORCE_INLINE bool get_active ()
 
FORCE_INLINE void set_active (const bool a)
 
FORCE_INLINE void set_inverted (const bool i)
 
FORCE_INLINE AxisEnum get_axis ()
 
FORCE_INLINE bool get_ec_enabled ()
 
FORCE_INLINE void set_ec_enabled (const bool enabled)
 
FORCE_INLINE uint8_t get_ec_method ()
 
FORCE_INLINE void set_ec_method (const byte method)
 
FORCE_INLINE float get_ec_threshold ()
 
FORCE_INLINE void set_ec_threshold (const float newThreshold)
 
FORCE_INLINE int get_encoder_ticks_mm ()
 
FORCE_INLINE int get_ticks_unit ()
 
FORCE_INLINE void set_ticks_unit (const int ticks)
 
FORCE_INLINE uint8_t get_type ()
 
FORCE_INLINE void set_type (const byte newType)
 
FORCE_INLINE int get_stepper_ticks ()
 
FORCE_INLINE void set_stepper_ticks (const int ticks)
 

Member Function Documentation

◆ init()

void I2CPositionEncoder::init ( const uint8_t  address,
const AxisEnum  axis 
)

◆ reset()

void I2CPositionEncoder::reset ( )

◆ update()

void I2CPositionEncoder::update ( )
Here is the caller graph for this function:

◆ set_homed()

void I2CPositionEncoder::set_homed ( )
Here is the caller graph for this function:

◆ set_unhomed()

void I2CPositionEncoder::set_unhomed ( )
Here is the caller graph for this function:

◆ get_raw_count()

int32_t I2CPositionEncoder::get_raw_count ( )
Here is the caller graph for this function:

◆ mm_from_count()

FORCE_INLINE float I2CPositionEncoder::mm_from_count ( const int32_t  count)
149  {
150  switch (type) {
151  default: return -1;
153  return count / encoderTicksPerUnit;
155  return (count * stepperTicks) / (encoderTicksPerUnit * planner.settings.axis_steps_per_mm[encoderAxis]);
156  }
157  }
Here is the caller graph for this function:

◆ get_position_mm()

FORCE_INLINE float I2CPositionEncoder::get_position_mm ( )
159 { return mm_from_count(get_position()); }
Here is the call graph for this function:

◆ get_position()

FORCE_INLINE int32_t I2CPositionEncoder::get_position ( )
160 { return get_raw_count() - zeroOffset; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_axis_error_steps()

int32_t I2CPositionEncoder::get_axis_error_steps ( const bool  report)
Here is the caller graph for this function:

◆ get_axis_error_mm()

float I2CPositionEncoder::get_axis_error_mm ( const bool  report)

◆ calibrate_steps_mm()

void I2CPositionEncoder::calibrate_steps_mm ( const uint8_t  iter)
Here is the caller graph for this function:

◆ passes_test()

bool I2CPositionEncoder::passes_test ( const bool  report)
Here is the caller graph for this function:

◆ test_axis()

bool I2CPositionEncoder::test_axis ( )
Here is the caller graph for this function:

◆ get_error_count()

FORCE_INLINE int I2CPositionEncoder::get_error_count ( )
171 { return errorCount; }

◆ set_error_count()

FORCE_INLINE void I2CPositionEncoder::set_error_count ( const int  newCount)
172 { errorCount = newCount; }
Here is the caller graph for this function:

◆ get_address()

FORCE_INLINE uint8_t I2CPositionEncoder::get_address ( )
174 { return i2cAddress; }

◆ set_address()

FORCE_INLINE void I2CPositionEncoder::set_address ( const uint8_t  addr)
175 { i2cAddress = addr; }

◆ get_active()

FORCE_INLINE bool I2CPositionEncoder::get_active ( )
177 { return active; }

◆ set_active()

FORCE_INLINE void I2CPositionEncoder::set_active ( const bool  a)
178 { active = a; }

◆ set_inverted()

FORCE_INLINE void I2CPositionEncoder::set_inverted ( const bool  i)
180 { invert = i; }

◆ get_axis()

FORCE_INLINE AxisEnum I2CPositionEncoder::get_axis ( )
182 { return encoderAxis; }

◆ get_ec_enabled()

FORCE_INLINE bool I2CPositionEncoder::get_ec_enabled ( )
184 { return ec; }

◆ set_ec_enabled()

FORCE_INLINE void I2CPositionEncoder::set_ec_enabled ( const bool  enabled)
185 { ec = enabled; }
Here is the caller graph for this function:

◆ get_ec_method()

FORCE_INLINE uint8_t I2CPositionEncoder::get_ec_method ( )
187 { return ecMethod; }

◆ set_ec_method()

FORCE_INLINE void I2CPositionEncoder::set_ec_method ( const byte  method)
188 { ecMethod = method; }

◆ get_ec_threshold()

FORCE_INLINE float I2CPositionEncoder::get_ec_threshold ( )
190 { return ecThreshold; }
Here is the caller graph for this function:

◆ set_ec_threshold()

FORCE_INLINE void I2CPositionEncoder::set_ec_threshold ( const float  newThreshold)
191 { ecThreshold = newThreshold; }
Here is the caller graph for this function:

◆ get_encoder_ticks_mm()

FORCE_INLINE int I2CPositionEncoder::get_encoder_ticks_mm ( )
193  {
194  switch (type) {
195  default: return 0;
197  return encoderTicksPerUnit;
199  return (int)((encoderTicksPerUnit / stepperTicks) * planner.settings.axis_steps_per_mm[encoderAxis]);
200  }
201  }

◆ get_ticks_unit()

FORCE_INLINE int I2CPositionEncoder::get_ticks_unit ( )
203 { return encoderTicksPerUnit; }

◆ set_ticks_unit()

FORCE_INLINE void I2CPositionEncoder::set_ticks_unit ( const int  ticks)
204 { encoderTicksPerUnit = ticks; }

◆ get_type()

FORCE_INLINE uint8_t I2CPositionEncoder::get_type ( )
206 { return type; }

◆ set_type()

FORCE_INLINE void I2CPositionEncoder::set_type ( const byte  newType)
207 { type = newType; }

◆ get_stepper_ticks()

FORCE_INLINE int I2CPositionEncoder::get_stepper_ticks ( )
209 { return stepperTicks; }

◆ set_stepper_ticks()

FORCE_INLINE void I2CPositionEncoder::set_stepper_ticks ( const int  ticks)
210 { stepperTicks = ticks; }
I2CPE_ENC_TYPE_LINEAR
#define I2CPE_ENC_TYPE_LINEAR
Definition: I2CPositionEncoder.h:87
i
uint8_t i
Definition: screen_test_graph.c:72
I2CPositionEncoder::get_raw_count
int32_t get_raw_count()
planner_settings_t::axis_steps_per_mm
float axis_steps_per_mm[XYZE_N]
Definition: planner.h:181
createSpeedLookupTable.a
list a
Definition: createSpeedLookupTable.py:29
I2CPE_ENC_TYPE_ROTARY
#define I2CPE_ENC_TYPE_ROTARY
Definition: I2CPositionEncoder.h:86
I2CPositionEncoder::get_position
FORCE_INLINE int32_t get_position()
Definition: I2CPositionEncoder.h:160
I2CPositionEncoder::mm_from_count
FORCE_INLINE float mm_from_count(const int32_t count)
Definition: I2CPositionEncoder.h:149
pbuf::type
u8_t type
Definition: pbuf.h:162
Planner::settings
static planner_settings_t settings
Definition: planner.h:251
planner
Planner planner
Definition: planner.cpp:111