123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
-
-
-
-
-
- #ifndef PLANNER_H
- #define PLANNER_H
-
- #include "Marlin.h"
-
-
-
- typedef struct {
-
- long steps[NUM_AXIS];
- unsigned long step_event_count;
- long accelerate_until;
- long decelerate_after;
- long acceleration_rate;
- unsigned char direction_bits;
- unsigned char active_extruder;
- #ifdef ADVANCE
- long advance_rate;
- volatile long initial_advance;
- volatile long final_advance;
- float advance;
- #endif
-
-
-
- float nominal_speed;
- float entry_speed;
- float max_entry_speed;
- float millimeters;
- float acceleration;
- unsigned char recalculate_flag;
- unsigned char nominal_length_flag;
-
-
- unsigned long nominal_rate;
- unsigned long initial_rate;
- unsigned long final_rate;
- unsigned long acceleration_st;
- unsigned long fan_speed;
- #ifdef BARICUDA
- unsigned long valve_pressure;
- unsigned long e_to_p_pressure;
- #endif
- volatile char busy;
- } block_t;
-
- #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
-
-
- void plan_init();
-
- void check_axes_activity();
-
-
- extern volatile unsigned char block_buffer_head;
- extern volatile unsigned char block_buffer_tail;
- FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
-
- #if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
-
- #if defined(ENABLE_AUTO_BED_LEVELING)
- #include "vector_3.h"
-
-
- extern matrix_3x3 plan_bed_level_matrix;
-
-
-
- vector_3 plan_get_position();
- #endif
-
-
-
- void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder);
-
-
-
- void plan_set_position(float x, float y, float z, const float &e);
-
- #else
-
- void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
- void plan_set_position(const float &x, const float &y, const float &z, const float &e);
-
- #endif
-
- void plan_set_e_position(const float &e);
-
-
-
-
-
- extern millis_t minsegmenttime;
- extern float max_feedrate[NUM_AXIS];
- extern float axis_steps_per_unit[NUM_AXIS];
- extern unsigned long max_acceleration_units_per_sq_second[NUM_AXIS];
- extern float minimumfeedrate;
- extern float acceleration;
- extern float retract_acceleration;
- extern float travel_acceleration;
- extern float max_xy_jerk;
- extern float max_z_jerk;
- extern float max_e_jerk;
- extern float mintravelfeedrate;
- extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
-
- #ifdef AUTOTEMP
- extern bool autotemp_enabled;
- extern float autotemp_max;
- extern float autotemp_min;
- extern float autotemp_factor;
- #endif
-
- extern block_t block_buffer[BLOCK_BUFFER_SIZE];
- extern volatile unsigned char block_buffer_head;
- extern volatile unsigned char block_buffer_tail;
-
-
- FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
-
-
-
- FORCE_INLINE void plan_discard_current_block() {
- if (blocks_queued())
- block_buffer_tail = BLOCK_MOD(block_buffer_tail + 1);
- }
-
-
- FORCE_INLINE block_t *plan_get_current_block() {
- if (blocks_queued()) {
- block_t *block = &block_buffer[block_buffer_tail];
- block->busy = true;
- return block;
- }
- else
- return NULL;
- }
-
- void reset_acceleration_rates();
-
- #endif
|