diff --git a/g2core/canonical_machine.cpp b/g2core/canonical_machine.cpp index 6c12154a..2722158f 100644 --- a/g2core/canonical_machine.cpp +++ b/g2core/canonical_machine.cpp @@ -367,7 +367,7 @@ void cm_set_tool_number(GCodeState_t *gcode_state, const uint8_t tool) void cm_set_absolute_override(GCodeState_t *gcode_state, const uint8_t absolute_override) { gcode_state->absolute_override = (cmAbsoluteOverride)absolute_override; - cm_set_work_offsets(MODEL); // must reset offsets if you change absolute override +// cm_set_work_offsets(MODEL); // must reset offsets if you change absolute override } void cm_set_model_linenum(const uint32_t linenum) @@ -2082,7 +2082,7 @@ stat_t cm_set_tn(nvObj_t *nv) { return (set_float(nv, cm->a[_axis(nv)].travel_mi stat_t cm_get_tm(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv)].travel_max)); } stat_t cm_set_tm(nvObj_t *nv) { return (set_float(nv, cm->a[_axis(nv)].travel_max)); } stat_t cm_get_ra(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv)].radius)); } -stat_t cm_set_ra(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv)].radius)); } +stat_t cm_set_ra(nvObj_t *nv) { return (set_float_range(nv, cm->a[_axis(nv)].radius, RADIUS_MIN, 1000000)); } /**** Axis Jerk Primitives * cm_get_axis_jerk() - returns jerk for an axis diff --git a/g2core/canonical_machine.h b/g2core/canonical_machine.h index 48d1fdb1..a204d9b6 100644 --- a/g2core/canonical_machine.h +++ b/g2core/canonical_machine.h @@ -47,8 +47,9 @@ #define DISABLE_SOFT_LIMIT (999999) #define JERK_INPUT_MIN (0.01) // minimum allowable jerk setting in millions mm/min^3 -#define JERK_INPUT_MAX (1000000) // maximum allowable jerk setting in millions mm/min^3 +#define JERK_INPUT_MAX (1000000) // maximum allowable jerk setting in millions mm/min^3 #define PROBES_STORED 3 // we store three probes for coordinate rotation computation +#define RADIUS_MIN (0.0001) // minimum value for ABC radius settings /***************************************************************************** * MACHINE STATE MODEL diff --git a/g2core/config_app.cpp b/g2core/config_app.cpp index 00590e53..f55aa324 100644 --- a/g2core/config_app.cpp +++ b/g2core/config_app.cpp @@ -669,15 +669,15 @@ 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 + { "", "dw", _f0, 0, tx_print_int, st_get_dw, set_noop, (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 { "", "shutd",_f0,0, tx_print_nul, cm_shutd, cm_shutd, (float *)&cs.null, 0 }, // trigger shutdown { "", "clear",_f0,0, tx_print_nul, cm_clr, cm_clr, (float *)&cs.null, 0 }, // GET "clear" to clear alarm state - { "", "clr", _f0,0, tx_print_nul, cm_clr, cm_clr, (float *)&cs.null, 0 }, // synonym for "clear" - { "", "tick", _f0,0, tx_print_int, get_tick, set_nul, (float *)&cs.null, 0 }, // get system time tic - { "", "tram", _f0,0, cm_print_tram,cm_get_tram,cm_set_tram,(float *)&cs.null, 0 }, // SET to attempt setting rotation matrix from probes + { "", "clr", _f0, 0, tx_print_nul, cm_clr, cm_clr, (float *)&cs.null, 0 }, // synonym for "clear" + { "", "tick",_f0, 0, tx_print_int, get_tick, set_nul, (float *)&cs.null, 0 }, // get system time tic + { "", "tram",_f0, 0, cm_print_tram,cm_get_tram,cm_set_tram,(float *)&cs.null, 0 }, // SET to attempt setting rotation matrix from probes { "", "defa",_f0, 0, tx_print_nul, help_defa,set_defaults,(float *)&cs.null,0 }, // set/print defaults / help screen { "", "flash",_f0,0, tx_print_nul, help_flash,hw_flash, (float *)&cs.null,0 }, diff --git a/g2core/cycle_feedhold.cpp b/g2core/cycle_feedhold.cpp index dba2d29c..e4c059d7 100644 --- a/g2core/cycle_feedhold.cpp +++ b/g2core/cycle_feedhold.cpp @@ -348,8 +348,8 @@ static void _sync_to_p1_hold_entry_actions_done(float* vect, bool* flag) static stat_t _run_p1_hold_exit_actions() // LATER: if value == true return with offset corrections { // perform end-hold actions --- while still in secondary machine - spindle_control_sync(SPINDLE_RESUME); // resume spindle if paused coolant_control_sync(COOLANT_RESUME, COOLANT_BOTH); // resume coolant if paused + spindle_control_sync(SPINDLE_RESUME); // resume spindle if paused // do return move though an intermediate point; queue a wait cm2.return_flags[AXIS_Z] = false; diff --git a/g2core/error.h b/g2core/error.h index 4f4024c9..06884f5d 100644 --- a/g2core/error.h +++ b/g2core/error.h @@ -205,7 +205,6 @@ char *get_status_message(stat_t status); #define STAT_MAX_DEPTH_EXCEEDED 115 // JSON exceeded maximum nesting depth #define STAT_VALUE_TYPE_ERROR 116 // JSON value does not agree with variable type -//#define STAT_ERROR_DEVICE_NOT_ACTIVE 117 // Device cannot receive commands at this time #define STAT_INPUT_FROM_MUTED_CHANNEL_ERROR 117 // input from a muted channel was ignored #define STAT_ERROR_118 118 #define STAT_ERROR_119 119 diff --git a/g2core/planner.cpp b/g2core/planner.cpp index a7a5877c..8224af74 100644 --- a/g2core/planner.cpp +++ b/g2core/planner.cpp @@ -200,9 +200,11 @@ void planner_init(mpPlanner_t *_mp, mpPlannerRuntime_t *_mr, mpBuf_t *queue, uin _mr->p = &_mr->bf[1]; } -void planner_reset(mpPlanner_t *_mp) +void planner_reset(mpPlanner_t *_mp) // reset planner queue, cease MR activity, but leave positions alone { - planner_init(_mp, _mp->mr, _mp->q.bf, _mp->q.queue_size); // reset parent planner and linked Q and MR +// planner_init(_mp, _mp->mr, _mp->q.bf, _mp->q.queue_size); // reset parent planner and linked Q and MR +// _mp->mr.block_state == BLOCK_INACTIVE; + _init_planner_queue(_mp, _mp->q.bf, _mp->q.queue_size); } stat_t planner_test_assertions(const mpPlanner_t *_mp) diff --git a/g2core/settings.h b/g2core/settings.h old mode 100755 new mode 100644 index eaa2fb7d..5fd3b12e --- a/g2core/settings.h +++ b/g2core/settings.h @@ -2,7 +2,7 @@ * settings.h - default runtime settings * This file is part of the g2core project * - * Copyright (c) 2010 - 2016 Alden S. Hart Jr. + * Copyright (c) 2010 - 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 @@ -35,6 +35,8 @@ #ifndef SETTINGS_H_ONCE #define SETTINGS_H_ONCE +#include "canonical_machine.h" + /**** MACHINE PROFILES ****************************************************** * * Provide an optional SETTINGS_FILE in the makefile or compiler command line: @@ -54,4 +56,17 @@ // The defaults below generally disable that function #include "settings/settings_default.h" +// compile-time assertions - mostly checking the settings are not impossible + +#define stringify2(a) #a +#define stringify(a) stringify2(a) + +//static_assert ( bool_constexpr , message ) // bool_constexpr must be true or assertion will fail +static_assert ( (A_RADIUS > RADIUS_MIN), "A axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(A_RADIUS) ); +static_assert ( (B_RADIUS > RADIUS_MIN), "B axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(B_RADIUS) ); +static_assert ( (C_RADIUS > RADIUS_MIN), "C axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(C_RADIUS) ); + +#undef stringify +#undef stringify2 + #endif // End of include guard: SETTINGS_H_ONCE diff --git a/g2core/stepper.cpp b/g2core/stepper.cpp index 0b7828af..9bf39acc 100644 --- a/g2core/stepper.cpp +++ b/g2core/stepper.cpp @@ -603,9 +603,7 @@ static void _load_move() // handle dwells and commands } else if (st_pre.block_type == BLOCK_TYPE_DWELL) { st_run.dwell_ticks_downcount = st_pre.dwell_ticks; - - // We now use SysTick events to handle dwells - SysTickTimer.registerEvent(&dwell_systick_event); + SysTickTimer.registerEvent(&dwell_systick_event); // We now use SysTick events to handle dwells // handle synchronous commands } else if (st_pre.block_type == BLOCK_TYPE_COMMAND) {