diff --git a/g2core/config_app.cpp b/g2core/config_app.cpp
index cb3a17d5..489cfe2b 100644
--- a/g2core/config_app.cpp
+++ b/g2core/config_app.cpp
@@ -839,7 +839,7 @@ const cfgItem_t cfgArray[] = {
{ "sp","spmo", _fip, 0, sp_print_spmo, sp_get_spmo, sp_set_spmo, (float *)&cs.null, SPINDLE_MODE },
{ "sp","spph", _fip, 0, sp_print_spph, sp_get_spph, sp_set_spph, (float *)&cs.null, SPINDLE_PAUSE_ON_HOLD },
{ "sp","spde", _fip, 2, sp_print_spde, sp_get_spde, sp_set_spde, (float *)&cs.null, SPINDLE_SPINUP_DELAY },
- { "sp","spdn", _fip, 2, sp_print_spdn, sp_get_spdn, sp_set_spdn, (float *)&cs.null, SPINDLE_SPINDOWN_DELAY },
+// { "sp","spdn", _fip, 2, sp_print_spdn, sp_get_spdn, sp_set_spdn, (float *)&cs.null, SPINDLE_SPINDOWN_DELAY },
{ "sp","spsn", _fip, 2, sp_print_spsn, sp_get_spsn, sp_set_spsn, (float *)&cs.null, SPINDLE_SPEED_MIN},
{ "sp","spsm", _fip, 2, sp_print_spsm, sp_get_spsm, sp_set_spsm, (float *)&cs.null, SPINDLE_SPEED_MAX},
{ "sp","spep", _fip, 0, sp_print_spep, sp_get_spep, sp_set_spep, (float *)&cs.null, SPINDLE_ENABLE_POLARITY },
diff --git a/g2core/g2core.cppproj b/g2core/g2core.cppproj
index 36e55b55..af27d1e0 100644
--- a/g2core/g2core.cppproj
+++ b/g2core/g2core.cppproj
@@ -73,7 +73,7 @@
SWD
com.atmel.avrdbg.tool.atmelice
- J41800036434
+ J41800030015
Atmel-ICE
True
@@ -100,7 +100,7 @@
True
true
- J41800036434
+ J41800030015
0x284E0A60
10000000
diff --git a/g2core/plan_exec.cpp b/g2core/plan_exec.cpp
index 13ab102b..9cfc373f 100644
--- a/g2core/plan_exec.cpp
+++ b/g2core/plan_exec.cpp
@@ -247,7 +247,14 @@ stat_t mp_exec_move()
{
mpBuf_t *bf;
- // NULL means nothing's running - this is OK
+ // Run an out of band dwell. It was probably set in the previous st_load_move()
+ if (mr->out_of_band_dwell_flag) {
+ mr->out_of_band_dwell_flag = false;
+ st_prep_out_of_band_dwell(mr->out_of_band_dwell_seconds * 1000000);
+ return (STAT_OK);
+ }
+
+ // Getting a NULL buffer means nothing's running in the queue - this is OK
if ((bf = mp_get_run_buffer()) == NULL) {
st_prep_null();
return (STAT_NOOP);
diff --git a/g2core/planner.cpp b/g2core/planner.cpp
index 2b69f14b..4450544b 100644
--- a/g2core/planner.cpp
+++ b/g2core/planner.cpp
@@ -290,7 +290,7 @@ void mp_set_steps_to_runtime_position()
}
}
-/************************************************************************************
+/***********************************************************************************
* mp_queue_command() - queue a synchronous Mcode, program control, or other command
* _exec_command() - callback to execute command
*
@@ -346,8 +346,7 @@ stat_t mp_runtime_command(mpBuf_t *bf)
return (STAT_OK);
}
-
-/*************************************************************************
+/***********************************************************************************
* mp_json_command() - queue a json command
* _exec_json_command() - execute json string
*/
@@ -373,7 +372,7 @@ static void _exec_json_command(float *value, bool *flag)
}
-/*************************************************************************
+/***********************************************************************************
* mp_json_wait() - queue a json wait command
* _exec_json_wait() - execute json wait string
*/
@@ -427,7 +426,7 @@ static stat_t _exec_json_wait(mpBuf_t *bf)
}
-/*************************************************************************
+/***********************************************************************************
* mp_dwell() - queue a dwell
* _exec_dwell() - dwell execution
*
@@ -435,6 +434,7 @@ static stat_t _exec_json_wait(mpBuf_t *bf)
* When the stepper driver sees a dwell it times the dwell on a separate
* timer than the stepper pulse timer.
*/
+
stat_t mp_dwell(float seconds)
{
mpBuf_t *bf;
@@ -458,19 +458,23 @@ static stat_t _exec_dwell(mpBuf_t *bf)
return (STAT_OK);
}
-//++++ stubbed ++++
+/***********************************************************************************
+ * mp_request_out_of_band_dwell() - request that an out-of-band dwell be run
+ *
+ * This command is used to request that a dwell be run outside of the planner.
+ * This is useful for queuing a dwell after a spindle change. The dwell will
+ * only run if the runtime has been stopped, otherwise it is skipped.
+ * This function is typically called from an exec such as _exec_spindle_control().
+ * The request is executed from mp_exec_move().
+ */
+
void mp_request_out_of_band_dwell(float seconds)
{
-// mr->out_of_band_dwell_time = seconds;
-}
-//++++ stubbed ++++
-stat_t mp_exec_out_of_band_dwell(void)
-{
-// return _advance_dwell(mr->out_of_band_dwell_time);
- return 0;
+ mr->out_of_band_dwell_flag = true;
+ mr->out_of_band_dwell_seconds = seconds;
}
-/**********************************************************************************
+/***********************************************************************************
* Planner helpers
*
* mp_get_planner_buffers() - return # of available planner buffers
diff --git a/g2core/planner.h b/g2core/planner.h
index a985c2e8..359b1d9a 100644
--- a/g2core/planner.h
+++ b/g2core/planner.h
@@ -438,6 +438,9 @@ typedef struct mpPlannerRuntime { // persistent runtime variables
moveSection section; // what section is the move in?
sectionState section_state; // state within a move section
+ bool out_of_band_dwell_flag; // set true to conditionally execute out-of-band dwell
+ float out_of_band_dwell_seconds; // time for out-of-band dwell
+
float unit[AXES]; // unit vector for axis scaling & planning
bool axis_flags[AXES]; // set true for axes participating in the move
float target[AXES]; // final target for bf (used to correct rounding errors)
@@ -552,7 +555,6 @@ stat_t mp_json_wait(char *json_string);
stat_t mp_dwell(const float seconds);
void mp_end_dwell(void);
void mp_request_out_of_band_dwell(float seconds);
-stat_t mp_exec_out_of_band_dwell(void);
//**** planner functions and helpers
uint8_t mp_get_planner_buffers(const mpPlanner_t *_mp);
diff --git a/g2core/pwm.cpp b/g2core/pwm.cpp
index 5e4c96b9..3f69cdf9 100644
--- a/g2core/pwm.cpp
+++ b/g2core/pwm.cpp
@@ -2,7 +2,7 @@
* pwm.cpp - pulse width modulation drivers
* This file is part of the g2core project
*
- * Copyright (c) 2012 - 2016 Alden S. Hart, Jr.
+ * Copyright (c) 2012 - 2017 Alden S. Hart, Jr.
*
* This file ("the software") is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 as published by the
@@ -100,12 +100,12 @@ stat_t pwm_set_duty(uint8_t chan, float duty)
if (chan == PWM_1) {
// if (spindle_pwm_pin.isNull()) {
-// cm_alarm(STAT_ALARM, "attempt to turn on a non-existant spindle");
+// cm_alarm(STAT_ALARM, "attempt to turn on a non-existent spindle");
// }
spindle_pwm_pin = duty;
} else if (chan == PWM_2) {
// if (secondary_pwm_pin.isNull()) {
-// cm_alarm(STAT_ALARM, "attempt to turn on a non-existant spindle");
+// cm_alarm(STAT_ALARM, "attempt to turn on a non-existent spindle");
// }
secondary_pwm_pin = duty;
}
diff --git a/g2core/spindle.cpp b/g2core/spindle.cpp
index 6b6d6215..aa696f64 100644
--- a/g2core/spindle.cpp
+++ b/g2core/spindle.cpp
@@ -76,9 +76,9 @@ void spindle_reset()
* spindle_control_sync() - queue a spindle control to the planner buffer
* _exec_spindle_control() - actually execute the spindle command
*
- * Basic operation: Spindle function is effected by _exec_spindle_control().
+ * Basic operation: Spindle function is executed by _exec_spindle_control().
* Spindle_control_immediate() performs the control as soon as it's received.
- * Spindle_control_sync() inserts spindle move into the planner, and handles spinup and spindowns
+ * Spindle_control_sync() inserts spindle move into the planner, and handles spinups.
*
* Valid inputs to Spindle_control_immediate() and Spindle_control_sync() are:
*
@@ -87,12 +87,13 @@ void spindle_reset()
* The spindle.direction value is not affected (although this doesn't really matter).
*
* - SPINDLE_CW or SPINDLE_CCW turns sets direction accordingly and spindle on.
- * In spindle_control_sync() a non-zero spinup delay puts a dwell in the planner queue.
- * In this case spindle.state is SPINDLE_SPINUP until spindle command is "played", and dwell completes.
+ * In spindle_control_sync() a non-zero spinup delay runs a dwell immediately following
+ * the spindle change, but only if the planner had planned the spindle operation to zero.
+ * (I.e. if the spindle controls / S words do not plan to zero the delay is not run).
* Spindle_control_immediate() has no spinup delay or dwell behavior.
*
- * - SPINDLE_PAUSE is only applicable to CW, CCW and SPINUP states. It forces the spindle OFF and
- * sets spindle.state to PAUSE. If PAUSE is received when not in CW or CCW state it is ignored.
+ * - SPINDLE_PAUSE is only applicable to CW and CCW states. It forces the spindle OFF and
+ * sets spindle.state to PAUSE. A PAUSE received when not in CW or CCW state is ignored.
*
* - SPINDLE_RESUME, if in a PAUSE state, reverts to previous SPINDLE_CW or SPINDLE_CCW.
* The SPEED is not changed, and if it were changed in the interim the "new" speed is used.
@@ -100,8 +101,8 @@ void spindle_reset()
* If RESUME is received when not in a PAUSED state it is ignored. This recognizes that the main
* reason an immediate command would be issued - either manually by the user or by an alarm or
* some other program function - is to stop a spindle. So the Resume should be ignored for safety.
- *
- * Notes:
+ */
+/* Notes:
* - Since it's possible to queue a sync'd control, and then set any spindle state with an
* immediate() before the queued command is reached, _exec_spindle_control() must gracefully
* handle any arbitrary state transition (not just the "legal" ones).
@@ -167,6 +168,7 @@ static void _exec_spindle_control(float *value, bool *flag)
SPINDLE_DIRECTION_ASSERT; // ensure that the spindle direction is sane
int8_t enable_bit = 0; // default to 0=off
int8_t dir_bit = -1; // -1 will skip setting the direction. 0 & 1 are valid values
+ bool spinup_delay = false;
switch (action) {
case SPINDLE_NOP: case SPINDLE_NOPCW: case SPINDLE_NOPCCW: { return; } // reversals not handled yet
@@ -181,6 +183,7 @@ static void _exec_spindle_control(float *value, bool *flag)
dir_bit = control-1; // adjust direction to be used as a bitmask
spindle.direction = control;
spindle.state = control;
+ spinup_delay = true;
break;
}
case SPINDLE_PAUSE : {
@@ -191,6 +194,7 @@ static void _exec_spindle_control(float *value, bool *flag)
enable_bit = 1;
dir_bit = spindle.direction-1; // spindle direction was stored as '1' & '2'
spindle.state = spindle.direction;
+ spinup_delay = true;
break;
}
default: {} // keeps the compiler happy
@@ -214,33 +218,15 @@ static void _exec_spindle_control(float *value, bool *flag)
spindle_enable_pin.set(); // drive pin HI
}
pwm_set_duty(PWM_1, _get_spindle_pwm(spindle, pwm));
+
+ if (spinup_delay) {
+ mp_request_out_of_band_dwell(spindle.spinup_delay);
+ }
}
/*
* spindle_control_immediate() - execute spindle control immediately
* spindle_control_sync() - queue a spindle control to the planner buffer
- *
- * Spinup and Spindown delays
- *
- * For starters, spinup and spindown delays are only meaningful for queued (sync'd)
- * spindle operations (M3/M4/M5) because they introduce delays before or after the
- * M code - relative to other Gcode commands. Immediate() spindle operations do not
- * observe these delays; that's the responsibility of the sender.
- *
- * The "right" way to do spinup and spindown delays is to conditionally execute them
- * in _exec_spindle_control() if you know you have an actual spindle state transition.
- * This is hard because the delays would need to run "out of band" of the planner/runtime.
- * This affects the planner, as it may or may not have already planned preceding/following
- * moves to zero, and for other reasons.
- *
- * The easy way is to queue dwells to the planner in advance, before and after the
- * actual spindle command. The problem with this is that you don't always know beforehand
- * if the spindle command will run any real action. The S word might be zero. Or the
- * feedhold PAUSE or RESUME might be executed, but no actual transition occurs because
- * the spindle might have been OFF when this happened.
- *
- * Our (admittedly imperfect) hack is to best determine the conditions that will be seen
- * when the queued delay is executed, and plan on that in spindle_control_sync().
*/
stat_t spindle_control_immediate(spControl control)
@@ -260,17 +246,6 @@ stat_t spindle_control_sync(spControl control) // uses spControl arg: OFF, CW,
// queue the spindle control
float value[] = { (float)control };
mp_queue_command(_exec_spindle_control, value, nullptr);
-
- // conditionally queue a dwell for spinup delay
- if ((spindle.mode == SPINDLE_PLAN_TO_STOP) && (fp_NOT_ZERO(spindle.spinup_delay))) {
- if ((control == SPINDLE_CW) || (control == SPINDLE_CCW)) {
- if (spindle.state != control) {
- if (spindle.speed > 0) {
- mp_dwell(spindle.spinup_delay);
- }
- }
- }
- }
return(STAT_OK);
}
@@ -425,8 +400,8 @@ stat_t sp_set_spph(nvObj_t *nv) { return(set_int(nv, (uint8_t &)spindle.pause_en
stat_t sp_get_spde(nvObj_t *nv) { return(get_float(nv, spindle.spinup_delay)); }
stat_t sp_set_spde(nvObj_t *nv) { return(set_float_range(nv, spindle.spinup_delay, 0, SPINDLE_DWELL_MAX)); }
-stat_t sp_get_spdn(nvObj_t *nv) { return(get_float(nv, spindle.spindown_delay)); }
-stat_t sp_set_spdn(nvObj_t *nv) { return(set_float_range(nv, spindle.spindown_delay, 0, SPINDLE_DWELL_MAX)); }
+//stat_t sp_get_spdn(nvObj_t *nv) { return(get_float(nv, spindle.spindown_delay)); }
+//stat_t sp_set_spdn(nvObj_t *nv) { return(set_float_range(nv, spindle.spindown_delay, 0, SPINDLE_DWELL_MAX)); }
stat_t sp_get_spsn(nvObj_t *nv) { return(get_float(nv, spindle.speed_min)); }
stat_t sp_set_spsn(nvObj_t *nv) { return(set_float_range(nv, spindle.speed_min, SPINDLE_SPEED_MIN, SPINDLE_SPEED_MAX)); }
@@ -458,7 +433,7 @@ const char fmt_spep[] = "[spep] spindle enable polarity%5d [0=active_low,1=activ
const char fmt_spdp[] = "[spdp] spindle direction polarity%2d [0=CW_low,1=CW_high]\n";
const char fmt_spph[] = "[spph] spindle pause on hold%7d [0=no,1=pause_on_hold]\n";
const char fmt_spde[] = "[spde] spindle spinup delay%10.1f seconds\n";
-const char fmt_spdn[] = "[spdn] spindle spindown delay%8.1f seconds\n";
+//const char fmt_spdn[] = "[spdn] spindle spindown delay%8.1f seconds\n";
const char fmt_spsn[] = "[spsn] spindle speed min%14.2f rpm\n";
const char fmt_spsm[] = "[spsm] spindle speed max%14.2f rpm\n";
const char fmt_spoe[] = "[spoe] spindle speed override ena%2d [0=disable,1=enable]\n";
@@ -471,7 +446,7 @@ void sp_print_spep(nvObj_t *nv) { text_print(nv, fmt_spep);} // TYPE_INT
void sp_print_spdp(nvObj_t *nv) { text_print(nv, fmt_spdp);} // TYPE_INT
void sp_print_spph(nvObj_t *nv) { text_print(nv, fmt_spph);} // TYPE_INT
void sp_print_spde(nvObj_t *nv) { text_print(nv, fmt_spde);} // TYPE_FLOAT
-void sp_print_spdn(nvObj_t *nv) { text_print(nv, fmt_spdn);} // TYPE_FLOAT
+//void sp_print_spdn(nvObj_t *nv) { text_print(nv, fmt_spdn);} // TYPE_FLOAT
void sp_print_spsn(nvObj_t *nv) { text_print(nv, fmt_spsn);} // TYPE_FLOAT
void sp_print_spsm(nvObj_t *nv) { text_print(nv, fmt_spsm);} // TYPE_FLOAT
void sp_print_spoe(nvObj_t *nv) { text_print(nv, fmt_spoe);} // TYPE INT
diff --git a/g2core/spindle.h b/g2core/spindle.h
index 15f466f4..9642022b 100644
--- a/g2core/spindle.h
+++ b/g2core/spindle.h
@@ -97,7 +97,7 @@ typedef struct spSpindle {
spPolarity dir_polarity; // {spdp:} 0=clockwise low, 1=clockwise high
bool pause_enable; // {spph:} pause on feedhold
float spinup_delay; // {spde:} optional delay on spindle start (set to 0 to disable)
- float spindown_delay; // {spds:} optional delay on spindle stop (set to 0 to disable)
+// float spindown_delay; // {spds:} optional delay on spindle stop (set to 0 to disable)
bool override_enable; // {spoe:} TRUE = spindle speed override enabled (see also m48_enable in canonical machine)
float override_factor; // {spo:} 1.0000 x S spindle speed. Go up or down from there
@@ -122,10 +122,6 @@ stat_t spindle_control_sync(spControl control);
stat_t spindle_speed_immediate(float speed); // S parameter
stat_t spindle_speed_sync(float speed); // S parameter
-//void spindle_off_immediate(void);
-//void spindle_optional_pause(bool option); // stop spindle based on system options selected
-//void spindle_resume(float dwell_seconds); // restart spindle after pause based on previous state
-
stat_t spindle_override_control(const float P_word, const bool P_flag); // M51
void spindle_start_override(const float ramp_time, const float override_factor);
void spindle_end_override(const float ramp_time);
@@ -141,8 +137,8 @@ stat_t sp_set_spph(nvObj_t *nv);
stat_t sp_get_spde(nvObj_t *nv);
stat_t sp_set_spde(nvObj_t *nv);
-stat_t sp_get_spdn(nvObj_t *nv);
-stat_t sp_set_spdn(nvObj_t *nv);
+//stat_t sp_get_spdn(nvObj_t *nv);
+//stat_t sp_set_spdn(nvObj_t *nv);
stat_t sp_get_spsn(nvObj_t *nv);
stat_t sp_set_spsn(nvObj_t *nv);
@@ -168,7 +164,7 @@ stat_t sp_set_sps(nvObj_t* nv);
void sp_print_spdp(nvObj_t* nv);
void sp_print_spph(nvObj_t* nv);
void sp_print_spde(nvObj_t* nv);
- void sp_print_spdn(nvObj_t* nv);
+// void sp_print_spdn(nvObj_t* nv);
void sp_print_spsn(nvObj_t* nv);
void sp_print_spsm(nvObj_t* nv);
void sp_print_spoe(nvObj_t* nv);
@@ -183,7 +179,7 @@ stat_t sp_set_sps(nvObj_t* nv);
#define sp_print_spdp tx_print_stub
#define sp_print_spph tx_print_stub
#define sp_print_spde tx_print_stub
- #define sp_print_spdn tx_print_stub
+// #define sp_print_spdn tx_print_stub
#define sp_print_spsn tx_print_stub
#define sp_print_spsm tx_print_stub
#define sp_print_spoe tx_print_stub
diff --git a/g2core/stepper.cpp b/g2core/stepper.cpp
index 31d99aa7..9136429c 100644
--- a/g2core/stepper.cpp
+++ b/g2core/stepper.cpp
@@ -44,8 +44,10 @@
#include "MotateDebug.h"
+/* Note: stepper_debug statements removed 1/16/17 in SHA ______. See earlier commits to recover
// Unless debugging, this should always read "#if 0 && ..."
// DON'T COMMIT with anything else!
+//
#if 0 && (IN_DEBUGGER == 1)
template
void stepper_debug(const char (&str)[len]) { Motate::debug.write(str); };
@@ -53,6 +55,7 @@ void stepper_debug(const char (&str)[len]) { Motate::debug.write(str); };
template
void stepper_debug(const char (&str)[len]) { ; };
#endif
+*/
/**** Allocate structures ****/
@@ -352,12 +355,10 @@ void dda_timer_type::interrupt()
void st_request_exec_move()
{
- stepper_debug("e");
if (st_pre.buffer_state == PREP_BUFFER_OWNED_BY_EXEC) { // bother interrupting
exec_timer.setInterruptPending();
return;
}
- stepper_debug("!\n");
}
namespace Motate { // Define timer inside Motate namespace
@@ -366,21 +367,17 @@ namespace Motate { // Define timer inside Motate namespace
{
exec_timer.getInterruptCause(); // clears the interrupt condition
if (st_pre.buffer_state == PREP_BUFFER_OWNED_BY_EXEC) {
- stepper_debug("E>");
if (mp_exec_move() != STAT_NOOP) {
- stepper_debug("E+\n");
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // flip it back
st_request_load_move();
return;
}
- stepper_debug("E-\n");
}
}
} // namespace Motate
void st_request_forward_plan()
{
- stepper_debug("p");
fwd_plan_timer.setInterruptPending();
}
@@ -389,13 +386,10 @@ namespace Motate { // Define timer inside Motate namespace
void fwd_plan_timer_type::interrupt()
{
fwd_plan_timer.getInterruptCause(); // clears the interrupt condition
- stepper_debug("P>");
if (mp_forward_plan() != STAT_NOOP) { // We now have a move to exec.
- stepper_debug("P+\n");
st_request_exec_move();
return;
}
- stepper_debug("P-\n");
}
} // namespace Motate
@@ -414,9 +408,7 @@ void st_request_load_move()
if (st_runtime_isbusy()) { // don't request a load if the runtime is busy
return;
}
- stepper_debug("l");
if (st_pre.buffer_state == PREP_BUFFER_OWNED_BY_LOADER) { // bother interrupting
- stepper_debug("_");
load_timer.setInterruptPending();
}
}
@@ -426,9 +418,7 @@ namespace Motate { // Define timer inside Motate namespace
void load_timer_type::interrupt()
{
load_timer.getInterruptCause(); // read SR to clear interrupt condition
- stepper_debug("L>");
_load_move();
- stepper_debug("L+\n");
}
} // namespace Motate
@@ -474,12 +464,9 @@ static void _load_move()
#if (MOTORS > 5)
motor_6.motionStopped();
#endif
- stepper_debug("•");
return;
} // if (st_pre.buffer_state != PREP_BUFFER_OWNED_BY_LOADER)
- stepper_debug("^");
-
// handle aline loads first (most common case) NB: there are no more lines, only alines
if (st_pre.block_type == BLOCK_TYPE_ALINE) {
@@ -667,7 +654,6 @@ static void _load_move()
stat_t st_prep_line(float travel_steps[], float following_error[], float segment_time)
{
- stepper_debug("😶");
// trap assertion failures and other conditions that would prevent queuing the line
if (st_pre.buffer_state != PREP_BUFFER_OWNED_BY_EXEC) { // never supposed to happen
return (cm_panic(STAT_INTERNAL_ERROR, "st_prep_line() prep sync error"));
@@ -746,7 +732,6 @@ stat_t st_prep_line(float travel_steps[], float following_error[], float segment
}
st_pre.block_type = BLOCK_TYPE_ALINE;
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
- stepper_debug("👍🏻");
return (STAT_OK);
}
@@ -784,20 +769,26 @@ void st_prep_dwell(float microseconds)
}
/*
- * st_request_out_of_band_dwell()
- * (only usable while exec isn't running, e.g. in feedhold or stopped states...)
- * add a dwell to the loader without going through the planner buffers
+ * st_prep_out_of_band_dwell()
+ *
+ * Add a dwell to the loader without going through the planner buffers.
+ * Only usable while exec isn't running, e.g. in feedhold or stopped states.
+ * Otherwise it is skipped.
*/
-void st_request_out_of_band_dwell(float microseconds)
+
+void st_prep_out_of_band_dwell(float microseconds)
{
- st_prep_dwell(microseconds);
- st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
- st_request_load_move();
+ if (!st_runtime_isbusy()) {
+ st_prep_dwell(microseconds);
+ st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
+ st_request_load_move();
+ }
}
/*
* _set_hw_microsteps() - set microsteps in hardware
*/
+
static void _set_hw_microsteps(const uint8_t motor, const uint8_t microsteps)
{
if (motor >= MOTORS) { return; }
diff --git a/g2core/stepper.h b/g2core/stepper.h
index 35f1770c..0038722d 100644
--- a/g2core/stepper.h
+++ b/g2core/stepper.h
@@ -575,7 +575,7 @@ void st_request_load_move(void);
void st_prep_null(void);
void st_prep_command(void *bf); // use a void pointer since we don't know about mpBuf_t yet)
void st_prep_dwell(float microseconds);
-void st_request_out_of_band_dwell(float microseconds);
+void st_prep_out_of_band_dwell(float microseconds);
stat_t st_prep_line(float travel_steps[], float following_error[], float segment_time);
stat_t st_get_ma(nvObj_t *nv);