From 2675557b9b899a07f16f236ae8ead3535222570a Mon Sep 17 00:00:00 2001 From: Alden Hart Date: Sun, 12 Mar 2017 08:57:32 -0400 Subject: [PATCH] Fixed text mode compile; fixed zero length move ends in cycle regression --- g2core/canonical_machine.cpp | 17 +++++++++++------ g2core/canonical_machine.h | 2 ++ g2core/g2core.cppproj | 4 ++-- g2core/g2core.h | 12 ++++++------ g2core/gpio.h | 5 +++-- g2core/plan_line.cpp | 16 ++++++++-------- 6 files changed, 32 insertions(+), 24 deletions(-) mode change 100755 => 100644 g2core/gpio.h diff --git a/g2core/canonical_machine.cpp b/g2core/canonical_machine.cpp index 723705c2..706a3687 100644 --- a/g2core/canonical_machine.cpp +++ b/g2core/canonical_machine.cpp @@ -1320,9 +1320,12 @@ stat_t cm_straight_traverse(const float target[], const bool flags[]) cm_cycle_start(); // required for homing & other cycles stat_t status = mp_aline(&cm.gm); // send the move to the planner cm_finalize_move(); - if (status == STAT_MINIMUM_LENGTH_MOVE && !mp_has_runnable_buffer()) { - cm_cycle_end(); - return (STAT_OK); + + if (status == STAT_MINIMUM_LENGTH_MOVE) { + if (!mp_has_runnable_buffer()) { // handle condition where zero-length move is last or only move + cm_cycle_end(); // ...otherwise cycle will not end properly + } + status = STAT_OK; } return (status); } @@ -1478,9 +1481,11 @@ stat_t cm_straight_feed(const float target[], const bool flags[]) cm_finalize_move(); // <-- ONLY safe because we don't care about status... - if (status == STAT_MINIMUM_LENGTH_MOVE && !mp_has_runnable_buffer()) { - cm_cycle_end(); - return (STAT_OK); + if (status == STAT_MINIMUM_LENGTH_MOVE) { + if (!mp_has_runnable_buffer()) { // handle condition where zero-length move is last or only move + cm_cycle_end(); // ...otherwise cycle will not end properly + } + status = STAT_OK; } return (status); } diff --git a/g2core/canonical_machine.h b/g2core/canonical_machine.h index e2c165d6..7910e703 100644 --- a/g2core/canonical_machine.h +++ b/g2core/canonical_machine.h @@ -949,6 +949,8 @@ stat_t cm_get_tram(nvObj_t *nv); // return if the rotation matrix is non- #define cm_print_mtoe tx_print_stub #define cm_print_mto tx_print_stub + #define cm_print_tram tx_print_stub + #define cm_print_am tx_print_stub // axis print functions #define cm_print_fr tx_print_stub #define cm_print_vm tx_print_stub diff --git a/g2core/g2core.cppproj b/g2core/g2core.cppproj index 4e9ca4ea..b0b76047 100644 --- a/g2core/g2core.cppproj +++ b/g2core/g2core.cppproj @@ -5,7 +5,7 @@ 7.0 com.Atmel.ARMGCC.CPP {44ea8fec-55d7-4149-8a78-a574fc26bf51} - ATSAM3X8E + ATSAM3X8C none Executable CPP @@ -101,7 +101,7 @@ true J41800036434 - 0x285E0A60 + 0x284E0A60 2000000 diff --git a/g2core/g2core.h b/g2core/g2core.h index a575e29b..a02adb88 100644 --- a/g2core/g2core.h +++ b/g2core/g2core.h @@ -40,15 +40,15 @@ /****** COMPILE-TIME SETTINGS ******/ -#define __TEXT_MODE // enable text mode support (~14Kb) (also disables help screens) -#define __HELP_SCREENS // enable help screens (~3.5Kb) -#define __USER_DATA // enable user defined data groups -#define __STEP_CORRECTION // enable virtual encoder step correction +//#define __TEXT_MODE // enable text mode support (~14Kb) (also disables help screens) +//#define __HELP_SCREENS // enable help screens (~3.5Kb) +//#define __USER_DATA // enable user defined data groups +//#define __STEP_CORRECTION // enable virtual encoder step correction /****** DEVELOPMENT SETTINGS ******/ -#define __DIAGNOSTICS // enables various debug functions -#define __DIAGNOSTIC_PARAMETERS // enables system diagnostic parameters (_xx) in config_app +//#define __DIAGNOSTICS // enables various debug functions +//#define __DIAGNOSTIC_PARAMETERS // enables system diagnostic parameters (_xx) in config_app /****************************************************************************** ***** APPLICATION DEFINITIONS ************************************************ diff --git a/g2core/gpio.h b/g2core/gpio.h old mode 100755 new mode 100644 index e156caad..8f753171 --- a/g2core/gpio.h +++ b/g2core/gpio.h @@ -2,8 +2,8 @@ * gpio.h - Digital IO handling functions * This file is part of the g2core project * - * Copyright (c) 2015 - 2016 Alden S. Hart, Jr. - * Copyright (c) 2015 - 2016 Robert Giseburt + * Copyright (c) 2015 - 2017 Alden S. Hart, Jr. + * Copyright (c) 2015 - 2017 Robert Giseburt * * 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 @@ -155,6 +155,7 @@ stat_t io_set_output(nvObj_t *nv); #define io_print_fn tx_print_stub #define io_print_in tx_print_stub #define io_print_st tx_print_stub + #define io_print_domode tx_print_stub #define io_print_out tx_print_stub #endif // __TEXT_MODE diff --git a/g2core/plan_line.cpp b/g2core/plan_line.cpp index 39b602dc..ff14195c 100644 --- a/g2core/plan_line.cpp +++ b/g2core/plan_line.cpp @@ -197,12 +197,12 @@ stat_t mp_aline(GCodeState_t* gm_in) // exit if the move has zero movement. At all. if (fp_ZERO(length)) { - sr_request_status_report(SR_REQUEST_TIMED_FULL); // Was SR_REQUEST_IMMEDIATE_FULL - return (STAT_OK); // preferred over STAT_MINIMUM_LENGTH_MOVE + sr_request_status_report(SR_REQUEST_TIMED_FULL);// Was SR_REQUEST_IMMEDIATE_FULL + return (STAT_MINIMUM_LENGTH_MOVE); // STAT_MINIMUM_LENGTH_MOVE needed to end cycle } // get a cleared buffer and copy in the Gcode model state - if ((bf = mp_get_write_buffer()) == NULL) { // never supposed to fail + if ((bf = mp_get_write_buffer()) == NULL) { // never supposed to fail return (cm_panic(STAT_FAILED_GET_PLANNER_BUFFER, "aline()")); } memcpy(&bf->gm, gm_in, sizeof(GCodeState_t)); @@ -210,11 +210,11 @@ stat_t mp_aline(GCodeState_t* gm_in) copy_vector(bf->gm.target, target_rotated); // copy the rotated taget in place // setup the buffer - bf->bf_func = mp_exec_aline; // register the callback to the exec function - bf->length = length; // record the length - for (uint8_t axis = 0; axis < AXES; axis++) { // compute the unit vector and set flags - if ((bf->axis_flags[axis] = flags[axis])) { // yes, this is supposed to be = and not == - bf->unit[axis] = axis_length[axis] / length; // nb: bf-> unit was cleared by mp_get_write_buffer() + bf->bf_func = mp_exec_aline; // register the callback to the exec function + bf->length = length; // record the length + for (uint8_t axis = 0; axis < AXES; axis++) { // compute the unit vector and set flags + if ((bf->axis_flags[axis] = flags[axis])) { // yes, this is supposed to be = and not == + bf->unit[axis] = axis_length[axis] / length;// nb: bf-> unit was cleared by mp_get_write_buffer() } } _calculate_jerk(bf); // compute bf->jerk values