trapq: Initial support for building a queue of trapezoidal velocity moves

Add support for building a list of moves in the trapq.c code.  Update
the toolhead code so that moves generated from the look-ahead code are
added to that list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-10-27 18:50:53 -04:00
parent c06f6943a6
commit d3afe4f1d8
4 changed files with 81 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
#ifndef TRAPQ_H
#define TRAPQ_H
#include "list.h" // list_node
struct coord {
double x, y, z;
};
@@ -16,6 +18,8 @@ struct move {
double cruise_v;
struct move_accel accel, decel;
struct coord start_pos, axes_r;
struct list_node node;
};
struct move *move_alloc(void);
@@ -27,4 +31,13 @@ void move_fill(struct move *m, double print_time
double move_get_distance(struct move *m, double move_time);
struct coord move_get_coord(struct move *m, double move_time);
struct trapq {
struct list_head moves;
};
struct trapq *trapq_alloc(void);
void trapq_free(struct trapq *tq);
void trapq_add_move(struct trapq *tq, struct move *m);
void trapq_free_moves(struct trapq *tq, double print_time);
#endif // trapq.h