diff --git a/g2core/plan_exec.cpp b/g2core/plan_exec.cpp index 8fe4c084..3aab7b92 100644 --- a/g2core/plan_exec.cpp +++ b/g2core/plan_exec.cpp @@ -178,7 +178,8 @@ static stat_t _plan_move(mpBuf_t *bf, float entry_velocity) mp_calculate_ramps(block, bf, entry_velocity); // (which it will if you don't do this) // diagnostic traps -#ifdef IN_DEBUGGER + +#if IN_DEBUGGER == 1 if (block->exit_velocity > block->cruise_velocity) { __asm__("BKPT"); // exit > cruise after calculate_block } @@ -186,6 +187,7 @@ static stat_t _plan_move(mpBuf_t *bf, float entry_velocity) __asm__("BKPT"); // zero or negative length block } #endif + bf->buffer_state = MP_BUFFER_PLANNED; //...here bf->plannable = false; return (STAT_OK); // report that we planned something... @@ -256,7 +258,7 @@ stat_t mp_exec_move() // first-time operations if (bf->buffer_state != MP_BUFFER_RUNNING) { if ((bf->buffer_state < MP_BUFFER_PREPPED) && (cm.motion_state == MOTION_RUN)) { -#ifdef IN_DEBUGGER +#if IN_DEBUGGER == 1 __asm__("BKPT"); // mp_exec_move() buffer is not prepped #endif // IMPORTANT: We can't rpt_exception from here! @@ -271,7 +273,7 @@ stat_t mp_exec_move() if (bf->buffer_state == MP_BUFFER_PREPPED) { if (cm.motion_state == MOTION_RUN) { -#ifdef IN_DEBUGGER +#if IN_DEBUGGER == 1 __asm__("BKPT"); // we are running but don't have a block planned #endif } diff --git a/g2core/plan_zoid.cpp b/g2core/plan_zoid.cpp index 28a54ee4..236e69d4 100644 --- a/g2core/plan_zoid.cpp +++ b/g2core/plan_zoid.cpp @@ -49,13 +49,14 @@ static void _logger(const char *msg, const mpBuf_t *bf) // LOG_RETURN wi #define LOG_RETURN(msg) { _logger(msg, bf); } */ -//#define TRAP_ZERO(t,m) +#define TRAP_ZERO(t,m) +/* #define TRAP_ZERO(t, m) \ if (fp_ZERO(t)) { \ rpt_exception(STAT_MINIMUM_LENGTH_MOVE, m); \ _debug_trap(m); \ } - +*/ //+++++ END DIAGNOSTICS /* local functions */ diff --git a/g2core/util.h b/g2core/util.h old mode 100755 new mode 100644 index d419aaa2..a662463c --- a/g2core/util.h +++ b/g2core/util.h @@ -57,7 +57,7 @@ inline void _debug_trap(const char *reason) { // We might be able to put a print here, but it MIGHT interrupt other output // and might be deep in an ISR, so we had better just _NOP() and hope for the best. __NOP(); -#ifdef IN_DEBUGGER +#if IN_DEBUGGER == 1 __asm__("BKPT"); #endif }