stepcompress: Remove no longer needed stepcompress_set_homing()
Now that homing is implemented via "drip moves", it is no longer necessary for the stepcompress code to have special homing logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
07e8925e08
commit
c3fe3d0d2c
|
@ -31,7 +31,6 @@ defs_stepcompress = """
|
|||
, uint32_t set_next_step_dir_msgid);
|
||||
void stepcompress_free(struct stepcompress *sc);
|
||||
int stepcompress_reset(struct stepcompress *sc, uint64_t last_step_clock);
|
||||
int stepcompress_set_homing(struct stepcompress *sc, uint64_t homing_clock);
|
||||
int stepcompress_queue_msg(struct stepcompress *sc
|
||||
, uint32_t *data, int len);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ struct stepcompress {
|
|||
uint32_t max_error;
|
||||
double mcu_time_offset, mcu_freq;
|
||||
// Message generation
|
||||
uint64_t last_step_clock, homing_clock;
|
||||
uint64_t last_step_clock;
|
||||
struct list_head msg_queue;
|
||||
uint32_t queue_step_msgid, set_next_step_dir_msgid, oid;
|
||||
int sdir, invert_sdir;
|
||||
|
@ -281,9 +281,6 @@ stepcompress_flush(struct stepcompress *sc, uint64_t move_clock)
|
|||
int32_t addfactor = move.count*(move.count-1)/2;
|
||||
uint32_t ticks = move.add*addfactor + move.interval*move.count;
|
||||
sc->last_step_clock += ticks;
|
||||
if (sc->homing_clock)
|
||||
// When homing, all steps should be sent prior to homing_clock
|
||||
qm->min_clock = qm->req_clock = sc->homing_clock;
|
||||
list_add_tail(&qm->node, &sc->msg_queue);
|
||||
|
||||
if (sc->queue_pos + move.count >= sc->queue_next) {
|
||||
|
@ -306,9 +303,6 @@ stepcompress_flush_far(struct stepcompress *sc, uint64_t abs_step_clock)
|
|||
struct queue_message *qm = message_alloc_and_encode(msg, 5);
|
||||
qm->min_clock = sc->last_step_clock;
|
||||
sc->last_step_clock = qm->req_clock = abs_step_clock;
|
||||
if (sc->homing_clock)
|
||||
// When homing, all steps should be sent prior to homing_clock
|
||||
qm->min_clock = qm->req_clock = sc->homing_clock;
|
||||
list_add_tail(&qm->node, &sc->msg_queue);
|
||||
return 0;
|
||||
}
|
||||
|
@ -327,7 +321,7 @@ set_next_step_dir(struct stepcompress *sc, int sdir)
|
|||
sc->set_next_step_dir_msgid, sc->oid, sdir ^ sc->invert_sdir
|
||||
};
|
||||
struct queue_message *qm = message_alloc_and_encode(msg, 3);
|
||||
qm->req_clock = sc->homing_clock ?: sc->last_step_clock;
|
||||
qm->req_clock = sc->last_step_clock;
|
||||
list_add_tail(&qm->node, &sc->msg_queue);
|
||||
return 0;
|
||||
}
|
||||
|
@ -344,17 +338,6 @@ stepcompress_reset(struct stepcompress *sc, uint64_t last_step_clock)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Indicate the stepper is in homing mode (or done homing if zero)
|
||||
int __visible
|
||||
stepcompress_set_homing(struct stepcompress *sc, uint64_t homing_clock)
|
||||
{
|
||||
int ret = stepcompress_flush(sc, UINT64_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
sc->homing_clock = homing_clock;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Queue an mcu command to go out in order with stepper commands
|
||||
int __visible
|
||||
stepcompress_queue_msg(struct stepcompress *sc, uint32_t *data, int len)
|
||||
|
@ -364,7 +347,7 @@ stepcompress_queue_msg(struct stepcompress *sc, uint32_t *data, int len)
|
|||
return ret;
|
||||
|
||||
struct queue_message *qm = message_alloc_and_encode(data, len);
|
||||
qm->req_clock = sc->homing_clock ?: sc->last_step_clock;
|
||||
qm->req_clock = sc->last_step_clock;
|
||||
list_add_tail(&qm->node, &sc->msg_queue);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ void stepcompress_fill(struct stepcompress *sc, uint32_t max_error
|
|||
, uint32_t set_next_step_dir_msgid);
|
||||
void stepcompress_free(struct stepcompress *sc);
|
||||
int stepcompress_reset(struct stepcompress *sc, uint64_t last_step_clock);
|
||||
int stepcompress_set_homing(struct stepcompress *sc, uint64_t homing_clock);
|
||||
int stepcompress_queue_msg(struct stepcompress *sc, uint32_t *data, int len);
|
||||
double stepcompress_get_mcu_freq(struct stepcompress *sc);
|
||||
uint32_t stepcompress_get_oid(struct stepcompress *sc);
|
||||
|
|
|
@ -9,8 +9,6 @@ import serialhdl, pins, chelper, clocksync
|
|||
class error(Exception):
|
||||
pass
|
||||
|
||||
STEPCOMPRESS_ERROR_RET = -989898989
|
||||
|
||||
class MCU_stepper:
|
||||
def __init__(self, mcu, pin_params):
|
||||
self._mcu = mcu
|
||||
|
@ -104,15 +102,7 @@ class MCU_stepper:
|
|||
else:
|
||||
self._itersolve_gen_steps = self._ffi_lib.itersolve_gen_steps
|
||||
return was_ignore
|
||||
def note_homing_start(self, homing_clock):
|
||||
ret = self._ffi_lib.stepcompress_set_homing(
|
||||
self._stepqueue, homing_clock)
|
||||
if ret:
|
||||
raise error("Internal error in stepcompress")
|
||||
def note_homing_end(self, did_trigger=False):
|
||||
ret = self._ffi_lib.stepcompress_set_homing(self._stepqueue, 0)
|
||||
if ret:
|
||||
raise error("Internal error in stepcompress")
|
||||
ret = self._ffi_lib.stepcompress_reset(self._stepqueue, 0)
|
||||
if ret:
|
||||
raise error("Internal error in stepcompress")
|
||||
|
|
Loading…
Reference in New Issue