stepper: Remove min_stop_interval from mcu code

Now that the host never uses a min_stop_interval, remove it from the
mcu code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-04-25 15:02:42 -04:00
parent b1ea4f3bef
commit 8f76e53c0e
6 changed files with 58 additions and 76 deletions

View File

@ -92,9 +92,9 @@ The following configuration sequence is used on AVR chips:
``` ```
PINS arduino PINS arduino
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=ar29 dir_pin=ar28 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=ar29 dir_pin=ar28 invert_step=0
config_stepper oid=1 step_pin=ar27 dir_pin=ar26 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=ar27 dir_pin=ar26 invert_step=0
config_stepper oid=2 step_pin=ar23 dir_pin=ar22 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=ar23 dir_pin=ar22 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -114,9 +114,9 @@ results match tests on both a 16Mhz at90usb and a 16Mhz atmega2560).
The following configuration sequence is used on the Due: The following configuration sequence is used on the Due:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=PB27 dir_pin=PA21 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PB27 dir_pin=PA21 invert_step=0
config_stepper oid=1 step_pin=PB26 dir_pin=PC30 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PB26 dir_pin=PC30 invert_step=0
config_stepper oid=2 step_pin=PA21 dir_pin=PC30 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PA21 dir_pin=PC30 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -136,9 +136,9 @@ The test was last run on commit `8d4a5c16` with gcc version
The following configuration sequence is used on the Duet Maestro: The following configuration sequence is used on the Duet Maestro:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=PC26 dir_pin=PC18 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PC26 dir_pin=PC18 invert_step=0
config_stepper oid=1 step_pin=PC26 dir_pin=PA8 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PC26 dir_pin=PA8 invert_step=0
config_stepper oid=2 step_pin=PC26 dir_pin=PB4 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PC26 dir_pin=PB4 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -158,10 +158,10 @@ The test was last run on commit `8d4a5c16` with gcc version
The following configuration sequence is used on the Duet Wifi: The following configuration sequence is used on the Duet Wifi:
``` ```
allocate_oids count=4 allocate_oids count=4
config_stepper oid=0 step_pin=PD6 dir_pin=PD11 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PD6 dir_pin=PD11 invert_step=0
config_stepper oid=1 step_pin=PD7 dir_pin=PD12 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PD7 dir_pin=PD12 invert_step=0
config_stepper oid=2 step_pin=PD8 dir_pin=PD13 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PD8 dir_pin=PD13 invert_step=0
config_stepper oid=3 step_pin=PD5 dir_pin=PA1 min_stop_interval=0 invert_step=0 config_stepper oid=3 step_pin=PD5 dir_pin=PA1 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -183,9 +183,9 @@ The following configuration sequence is used on the PRU:
``` ```
PINS beaglebone PINS beaglebone
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=P8_13 dir_pin=P8_12 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=P8_13 dir_pin=P8_12 invert_step=0
config_stepper oid=1 step_pin=P8_15 dir_pin=P8_14 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=P8_15 dir_pin=P8_14 invert_step=0
config_stepper oid=2 step_pin=P8_19 dir_pin=P8_18 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=P8_19 dir_pin=P8_18 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -203,9 +203,9 @@ The test was last run on commit `b161a69e` with gcc version `pru-gcc
The following configuration sequence is used on the STM32F042: The following configuration sequence is used on the STM32F042:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=PA1 dir_pin=PA2 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PA1 dir_pin=PA2 invert_step=0
config_stepper oid=1 step_pin=PA3 dir_pin=PA2 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PA3 dir_pin=PA2 invert_step=0
config_stepper oid=2 step_pin=PB8 dir_pin=PA2 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PB8 dir_pin=PA2 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -223,9 +223,9 @@ The test was last run on commit `0b0c47c5` with gcc version
The following configuration sequence is used on the STM32F103: The following configuration sequence is used on the STM32F103:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=PC13 dir_pin=PB5 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PC13 dir_pin=PB5 invert_step=0
config_stepper oid=1 step_pin=PB3 dir_pin=PB6 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PB3 dir_pin=PB6 invert_step=0
config_stepper oid=2 step_pin=PA4 dir_pin=PB7 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PA4 dir_pin=PB7 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -245,10 +245,10 @@ The test was last run on commit `8d4a5c16` with gcc version
The following configuration sequence is used on the STM32F4: The following configuration sequence is used on the STM32F4:
``` ```
allocate_oids count=4 allocate_oids count=4
config_stepper oid=0 step_pin=PA5 dir_pin=PB5 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PA5 dir_pin=PB5 invert_step=0
config_stepper oid=1 step_pin=PB2 dir_pin=PB6 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PB2 dir_pin=PB6 invert_step=0
config_stepper oid=2 step_pin=PB3 dir_pin=PB7 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PB3 dir_pin=PB7 invert_step=0
config_stepper oid=3 step_pin=PB3 dir_pin=PB8 min_stop_interval=0 invert_step=0 config_stepper oid=3 step_pin=PB3 dir_pin=PB8 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -280,9 +280,9 @@ using a 168Mhz clock).
The following configuration sequence is used on the LPC176x: The following configuration sequence is used on the LPC176x:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=P1.20 dir_pin=P1.18 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=P1.20 dir_pin=P1.18 invert_step=0
config_stepper oid=1 step_pin=P1.21 dir_pin=P1.18 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=P1.21 dir_pin=P1.18 invert_step=0
config_stepper oid=2 step_pin=P1.23 dir_pin=P1.18 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=P1.23 dir_pin=P1.18 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -311,9 +311,9 @@ results were obtained by overclocking an LPC1768 to 120Mhz.
The following configuration sequence is used on the SAMD21: The following configuration sequence is used on the SAMD21:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=PA27 dir_pin=PA20 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PA27 dir_pin=PA20 invert_step=0
config_stepper oid=1 step_pin=PB3 dir_pin=PA21 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PB3 dir_pin=PA21 invert_step=0
config_stepper oid=2 step_pin=PA17 dir_pin=PA21 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PA17 dir_pin=PA21 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -334,11 +334,11 @@ micro-controller.
The following configuration sequence is used on the SAMD51: The following configuration sequence is used on the SAMD51:
``` ```
allocate_oids count=5 allocate_oids count=5
config_stepper oid=0 step_pin=PA22 dir_pin=PA20 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=PA22 dir_pin=PA20 invert_step=0
config_stepper oid=1 step_pin=PA22 dir_pin=PA21 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=PA22 dir_pin=PA21 invert_step=0
config_stepper oid=2 step_pin=PA22 dir_pin=PA19 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=PA22 dir_pin=PA19 invert_step=0
config_stepper oid=3 step_pin=PA22 dir_pin=PA18 min_stop_interval=0 invert_step=0 config_stepper oid=3 step_pin=PA22 dir_pin=PA18 invert_step=0
config_stepper oid=4 step_pin=PA23 dir_pin=PA17 min_stop_interval=0 invert_step=0 config_stepper oid=4 step_pin=PA23 dir_pin=PA17 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```
@ -365,9 +365,9 @@ micro-controller.
The following configuration sequence is used on a Raspberry Pi: The following configuration sequence is used on a Raspberry Pi:
``` ```
allocate_oids count=3 allocate_oids count=3
config_stepper oid=0 step_pin=gpio2 dir_pin=gpio3 min_stop_interval=0 invert_step=0 config_stepper oid=0 step_pin=gpio2 dir_pin=gpio3 invert_step=0
config_stepper oid=1 step_pin=gpio4 dir_pin=gpio5 min_stop_interval=0 invert_step=0 config_stepper oid=1 step_pin=gpio4 dir_pin=gpio5 invert_step=0
config_stepper oid=2 step_pin=gpio6 dir_pin=gpio7 min_stop_interval=0 invert_step=0 config_stepper oid=2 step_pin=gpio6 dir_pin=gpio7 invert_step=0
finalize_config crc=0 finalize_config crc=0
``` ```

View File

@ -517,15 +517,13 @@ enabled:
the given distance (in mm) at the given constant velocity (in the given distance (in mm) at the given constant velocity (in
mm/s). If ACCEL is specified and is greater than zero, then the mm/s). If ACCEL is specified and is greater than zero, then the
given acceleration (in mm/s^2) will be used; otherwise no given acceleration (in mm/s^2) will be used; otherwise no
acceleration is performed. If acceleration is not performed then it acceleration is performed. No boundary checks are performed; no
can lead to the micro-controller reporting "No next step" errors kinematic updates are made; other parallel steppers on an axis will
(avoid these errors by specifying an ACCEL value or use a very low not be moved. Use caution as an incorrect command could cause
VELOCITY). No boundary checks are performed; no kinematic updates damage! Using this command will almost certainly place the low-level
are made; other parallel steppers on an axis will not be moved. Use kinematics in an incorrect state; issue a G28 afterwards to reset
caution as an incorrect command could cause damage! Using this the kinematics. This command is intended for low-level diagnostics
command will almost certainly place the low-level kinematics in an and debugging.
incorrect state; issue a G28 afterwards to reset the kinematics.
This command is intended for low-level diagnostics and debugging.
- `SET_KINEMATIC_POSITION [X=<value>] [Y=<value>] [Z=<value>]`: Force - `SET_KINEMATIC_POSITION [X=<value>] [Y=<value>] [Z=<value>]`: Force
the low-level kinematic code to believe the toolhead is at the given the low-level kinematic code to believe the toolhead is at the given
cartesian position. This is a diagnostic and debugging command; use cartesian position. This is a diagnostic and debugging command; use

View File

@ -138,17 +138,12 @@ This section lists some commonly used config commands.
sampled at regular interval using the query_analog_in command (see sampled at regular interval using the query_analog_in command (see
below). below).
* `config_stepper oid=%c step_pin=%c dir_pin=%c min_stop_interval=%u * `config_stepper oid=%c step_pin=%c dir_pin=%c invert_step=%c` : This
invert_step=%c` : This command creates an internal stepper command creates an internal stepper object. The 'step_pin' and
object. The 'step_pin' and 'dir_pin' parameters specify the step and 'dir_pin' parameters specify the step and direction pins
direction pins respectively; this command will configure them in respectively; this command will configure them in digital output
digital output mode. The 'invert_step' parameter specifies whether a mode. The 'invert_step' parameter specifies whether a step occurs on
step occurs on a rising edge (invert_step=0) or falling edge a rising edge (invert_step=0) or falling edge (invert_step=1).
(invert_step=1). The 'min_stop_interval' implements a safety
feature - it is checked when the micro-controller finishes all moves
for a stepper - if it is non-zero it specifies the minimum number of
clock ticks since the last step. It is used as a check on the
maximum stepper velocity that a stepper may have before stopping.
* `config_endstop oid=%c pin=%c pull_up=%c stepper_count=%c` : This * `config_endstop oid=%c pin=%c pull_up=%c stepper_count=%c` : This
command creates an internal "endstop" object. It is used to specify command creates an internal "endstop" object. It is used to specify

View File

@ -824,7 +824,7 @@ class MCU:
return False, '%s: %s' % (self._name, stats) return False, '%s: %s' % (self._name, stats)
Common_MCU_errors = { Common_MCU_errors = {
("Timer too close", "No next step"): """ ("Timer too close",): """
This often indicates the host computer is overloaded. Check This often indicates the host computer is overloaded. Check
for other processes consuming excessive CPU time, high swap for other processes consuming excessive CPU time, high swap
usage, disk errors, overheating, unstable voltage, or usage, disk errors, overheating, unstable voltage, or

View File

@ -61,8 +61,7 @@ class MCU_stepper:
self.set_stepper_kinematics(sk) self.set_stepper_kinematics(sk)
def _build_config(self): def _build_config(self):
self._mcu.add_config_cmd( self._mcu.add_config_cmd(
"config_stepper oid=%d step_pin=%s dir_pin=%s" "config_stepper oid=%d step_pin=%s dir_pin=%s invert_step=%d" % (
" min_stop_interval=0 invert_step=%d" % (
self._oid, self._step_pin, self._dir_pin, self._invert_step)) self._oid, self._step_pin, self._dir_pin, self._invert_step))
self._mcu.add_config_cmd("reset_step_clock oid=%d clock=0" self._mcu.add_config_cmd("reset_step_clock oid=%d clock=0"
% (self._oid,), on_restart=True) % (self._oid,), on_restart=True)

View File

@ -44,7 +44,6 @@ struct stepper {
struct gpio_out step_pin, dir_pin; struct gpio_out step_pin, dir_pin;
uint32_t position; uint32_t position;
struct move_queue_head mq; struct move_queue_head mq;
uint32_t min_stop_interval;
// gcc (pre v6) does better optimization when uint8_t are bitfields // gcc (pre v6) does better optimization when uint8_t are bitfields
uint8_t flags : 8; uint8_t flags : 8;
}; };
@ -53,7 +52,7 @@ enum { POSITION_BIAS=0x40000000 };
enum { enum {
SF_LAST_DIR=1<<0, SF_NEXT_DIR=1<<1, SF_INVERT_STEP=1<<2, SF_HAVE_ADD=1<<3, SF_LAST_DIR=1<<0, SF_NEXT_DIR=1<<1, SF_INVERT_STEP=1<<2, SF_HAVE_ADD=1<<3,
SF_LAST_RESET=1<<4, SF_NO_NEXT_CHECK=1<<5, SF_NEED_RESET=1<<6 SF_LAST_RESET=1<<4, SF_NEED_RESET=1<<5
}; };
// Setup a stepper for the next move in its queue // Setup a stepper for the next move in its queue
@ -62,9 +61,6 @@ stepper_load_next(struct stepper *s, uint32_t min_next_time)
{ {
if (move_queue_empty(&s->mq)) { if (move_queue_empty(&s->mq)) {
// There is no next move - the queue is empty // There is no next move - the queue is empty
if (s->interval - s->add < s->min_stop_interval
&& !(s->flags & SF_NO_NEXT_CHECK))
shutdown("No next step");
s->count = 0; s->count = 0;
return SF_DONE; return SF_DONE;
} }
@ -186,16 +182,14 @@ command_config_stepper(uint32_t *args)
struct stepper *s = oid_alloc(args[0], command_config_stepper, sizeof(*s)); struct stepper *s = oid_alloc(args[0], command_config_stepper, sizeof(*s));
if (!CONFIG_INLINE_STEPPER_HACK) if (!CONFIG_INLINE_STEPPER_HACK)
s->time.func = stepper_event; s->time.func = stepper_event;
s->flags = args[4] ? SF_INVERT_STEP : 0; s->flags = args[3] ? SF_INVERT_STEP : 0;
s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP); s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP);
s->dir_pin = gpio_out_setup(args[2], 0); s->dir_pin = gpio_out_setup(args[2], 0);
s->min_stop_interval = args[3];
s->position = -POSITION_BIAS; s->position = -POSITION_BIAS;
move_queue_setup(&s->mq, sizeof(struct stepper_move)); move_queue_setup(&s->mq, sizeof(struct stepper_move));
} }
DECL_COMMAND(command_config_stepper, DECL_COMMAND(command_config_stepper,
"config_stepper oid=%c step_pin=%c dir_pin=%c" "config_stepper oid=%c step_pin=%c dir_pin=%c invert_step=%c");
" min_stop_interval=%u invert_step=%c");
// Return the 'struct stepper' for a given stepper oid // Return the 'struct stepper' for a given stepper oid
struct stepper * struct stepper *
@ -223,10 +217,6 @@ command_queue_step(uint32_t *args)
flags ^= SF_LAST_DIR; flags ^= SF_LAST_DIR;
m->flags |= MF_DIR; m->flags |= MF_DIR;
} }
flags &= ~SF_NO_NEXT_CHECK;
if (m->count == 1 && (m->flags || flags & SF_LAST_RESET))
// count=1 moves after a reset or dir change can have small intervals
flags |= SF_NO_NEXT_CHECK;
flags &= ~SF_LAST_RESET; flags &= ~SF_LAST_RESET;
if (s->count) { if (s->count) {
s->flags = flags; s->flags = flags;