Adjust dwell to internally be in milliseconds (giving more overhead before overflow)

This commit is contained in:
Rob Giseburt
2017-04-12 20:25:38 -05:00
parent 7b629124f7
commit 5b0aa6be8a
3 changed files with 7 additions and 7 deletions

View File

@@ -382,7 +382,7 @@ static stat_t _exec_json_wait(mpBuf_t *bf)
nv_get_nvObj(nv);
bool new_value = !fp_ZERO(nv->value);
if (old_value != new_value) {
st_prep_dwell((uint32_t)(0.1 * 1000000.0));// 1ms converted to uSec
st_prep_dwell(1.0); // 1ms exactly
return STAT_OK;
}
}
@@ -421,7 +421,7 @@ stat_t mp_dwell(float seconds)
static stat_t _exec_dwell(mpBuf_t *bf)
{
st_prep_dwell((uint32_t)(bf->block_time * 1000000.0));// convert seconds to uSec
st_prep_dwell(bf->block_time * 1000.0);// convert seconds to ms
if (mp_free_run_buffer()) {
cm_cycle_end(); // free buffer & perform cycle_end if planner is empty
}

View File

@@ -778,11 +778,11 @@ void st_prep_command(void *bf)
* st_prep_dwell() - Add a dwell to the move buffer
*/
void st_prep_dwell(float microseconds)
void st_prep_dwell(float milliseconds)
{
st_pre.block_type = BLOCK_TYPE_DWELL;
// we need dwell_ticks to be at least 1
st_pre.dwell_ticks = std::max((uint32_t)((microseconds/1000000) * FREQUENCY_DWELL), 1UL);
st_pre.dwell_ticks = std::max((uint32_t)((milliseconds/1000.0) * FREQUENCY_DWELL), 1UL);
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
}
@@ -791,9 +791,9 @@ void st_prep_dwell(float microseconds)
* (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
*/
void st_request_out_of_band_dwell(float microseconds)
void st_request_out_of_band_dwell(float milliseconds)
{
st_prep_dwell(microseconds);
st_prep_dwell(milliseconds);
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
st_request_load_move();
}

View File

@@ -566,7 +566,7 @@ void st_request_exec_move(void) HOT_FUNC;
void st_request_load_move(void) HOT_FUNC;
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_prep_dwell(float milliseconds);
void st_request_out_of_band_dwell(float microseconds);
stat_t st_prep_line(float travel_steps[], float following_error[], float segment_time) HOT_FUNC;