From edf2b845b5b1641b56534b4745cd51dc2e3c21ab Mon Sep 17 00:00:00 2001 From: Alden Hart Date: Mon, 6 Feb 2017 08:59:13 -0500 Subject: [PATCH] Added {dw:n} as a way to examine the dwell timer down counter. Useful for testing --- g2core/config_app.cpp | 1 + g2core/g2core.cppproj | 4 ++-- g2core/spindle.cpp | 5 ----- g2core/stepper.cpp | 10 +++++++++- g2core/stepper.h | 1 + 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/g2core/config_app.cpp b/g2core/config_app.cpp index 5726922a..00590e53 100644 --- a/g2core/config_app.cpp +++ b/g2core/config_app.cpp @@ -669,6 +669,7 @@ const cfgItem_t cfgArray[] = { { "", "er", _f0, 0, tx_print_nul, rpt_er, set_nul, (float *)&cs.null, 0 }, // get bogus exception report for testing { "", "qf", _f0, 0, tx_print_nul, get_nul, cm_run_qf, (float *)&cs.null, 0 }, // SET to invoke queue flush { "", "rx", _f0, 0, tx_print_int, get_rx, set_nul, (float *)&cs.null, 0 }, // get RX buffer bytes or packets + { "", "dw", _f0, 0, tx_print_int, st_get_dw, set_nul, (float *)&cs.null, 0 }, // get dwell time remaining { "", "msg", _f0, 0, tx_print_str, get_nul, set_noop, (float *)&cs.null, 0 }, // no operation on messages { "", "alarm",_f0,0, tx_print_nul, cm_alrm, cm_alrm, (float *)&cs.null, 0 }, // trigger alarm { "", "panic",_f0,0, tx_print_nul, cm_pnic, cm_pnic, (float *)&cs.null, 0 }, // trigger panic diff --git a/g2core/g2core.cppproj b/g2core/g2core.cppproj index a4704359..3e17cbf8 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/spindle.cpp b/g2core/spindle.cpp index 35c8db51..2ff03bb8 100644 --- a/g2core/spindle.cpp +++ b/g2core/spindle.cpp @@ -399,11 +399,8 @@ stat_t sp_set_spdp(nvObj_t *nv) { stat_t sp_get_spph(nvObj_t *nv) { return(get_int(nv, spindle.pause_enable)); } stat_t sp_set_spph(nvObj_t *nv) { return(set_int(nv, (uint8_t &)spindle.pause_enable, 0, 1)); } - 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_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)); } @@ -435,7 +432,6 @@ 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_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"; @@ -448,7 +444,6 @@ 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_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/stepper.cpp b/g2core/stepper.cpp index dfbce1f3..0b7828af 100644 --- a/g2core/stepper.cpp +++ b/g2core/stepper.cpp @@ -607,7 +607,7 @@ static void _load_move() // We now use SysTick events to handle dwells SysTickTimer.registerEvent(&dwell_systick_event); - // handle synchronous commands + // handle synchronous commands } else if (st_pre.block_type == BLOCK_TYPE_COMMAND) { mp_runtime_command(st_pre.bf); @@ -973,6 +973,7 @@ stat_t st_get_pwr(nvObj_t *nv) * st_set_md() - disable motor power * st_set_me() - enable motor power * st_set_md() - disable motor power + * st_get_dw() - get remaining dwell time * * Calling me or md with NULL will enable or disable all motors * Setting a value of 0 will enable or disable all motors @@ -1017,6 +1018,13 @@ stat_t st_set_md(nvObj_t *nv) return (STAT_OK); } +stat_t st_get_dw(nvObj_t *nv) +{ + nv->value = st_run.dwell_ticks_downcount; + nv->valuetype = TYPE_INT; + return (STAT_OK); +} + /*********************************************************************************** * TEXT MODE SUPPORT * Functions to print variables from the cfgArray table diff --git a/g2core/stepper.h b/g2core/stepper.h index 0038722d..f3ef06d7 100644 --- a/g2core/stepper.h +++ b/g2core/stepper.h @@ -601,6 +601,7 @@ stat_t st_get_mt(nvObj_t *nv); stat_t st_set_mt(nvObj_t *nv); stat_t st_set_md(nvObj_t *nv); stat_t st_set_me(nvObj_t *nv); +stat_t st_get_dw(nvObj_t *nv); #ifdef __TEXT_MODE