Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power management and shapeoko setting fixes #258

Merged
merged 2 commits into from Apr 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions g2core/board/ArduinoDue/gShield-pinout.h
Expand Up @@ -136,7 +136,7 @@ pin_number kSocket1_SPISlaveSelectPinNumber = -1; // 10;
pin_number kSocket1_InterruptPinNumber = -1;
pin_number kSocket1_StepPinNumber = 2;
pin_number kSocket1_DirPinNumber = 5;
pin_number kSocket1_EnablePinNumber = 22;
pin_number kSocket1_EnablePinNumber = 8; // Workaround for kGRBL_CommonEnablePinNumber not working (22 is default value)
pin_number kSocket1_Microstep_0PinNumber = 23;
pin_number kSocket1_Microstep_1PinNumber = 24;
pin_number kSocket1_Microstep_2PinNumber = -1;
Expand Down Expand Up @@ -208,7 +208,7 @@ pin_number kInput11_PinNumber = 65;
pin_number kInput12_PinNumber = 51;

pin_number kSpindle_EnablePinNumber = 12;
pin_number kSpindle_DirPinNumber = -1; // 13;
pin_number kSpindle_DirPinNumber = 13;
pin_number kSpindle_PwmPinNumber = 11;
pin_number kSpindle_Pwm2PinNumber = 9;
pin_number kCoolant_EnablePinNumber = 57;
Expand Down Expand Up @@ -258,12 +258,12 @@ pin_number kADC14_PinNumber = -1; // Not physially pinned out


// GRBL / gShield compatibility pins -- Due board ONLY

// NOTE: These dont appear to work
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. These should be removed, and inputs made on these pins and preconfigured with the correct actions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, however INPUT_ACTION_CYCLE_START and INPUT_ACTION_RESET aren't implemented (afaik) and my attempts to make them work were not successful. INPUT_ACTION_HOLD is weird because I cant figure out how to unhold...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INPUT_ACTION_CYCLE_START is interesting. We automatically cycle-start, so we'd have to find a way to make that non-automatic. I guess for now that can be removed and just treated as a plain input (if it's not already, it may be). It would be easy to fake the wait-for-button-push-to-start by making the first line in the gcode something like M101 ({in7:t}) (replacing 7 with whatever input it is).

INPUT_ACTION_RESET is also interesting. I don't recall the intention for that. I presume it's not board reset, there's already one of those, so maybe it's supposed to mean reset as in M30? @aldenhart would know.

INPUT_ACTION_HOLD should be identical to sending a ! with the important exception that Chili (or whatever UI) didn't see it, and if they're not watching stat to see if we went into hold, they might not offer to resume. If the UI allows it, a ~ should do the trick, just like after a !. (AFAIK, this has not been tested, and if it doesn't work then please make an issue.)

Again, thank you!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I assumed INPUT_ACTION_CYCLE_START would work exactly like a ~ but bypassing serial, same with INPUT_ACTION_HOLD (but it doesnt work as intended), anyways i will mess around with these and try to make them work in my branch.

Copy link
Author

@ghost ghost Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry I made a mistake its INPUT_ACTION_HALT not INPUT_ACTION_HOLD. I just tested and INPUT_ACTION_STOP appears to work properly and can be cleared with a ~.

pin_number kGRBL_ResetPinNumber = 54;
pin_number kGRBL_FeedHoldPinNumber = 55;
pin_number kGRBL_CycleStartPinNumber = 56;

pin_number kGRBL_CommonEnablePinNumber = 8;
pin_number kGRBL_CommonEnablePinNumber = -1;

/** NOTE: When adding pin definitions here, they must be
* added to ALL board pin assignment files, even if
Expand Down
8 changes: 5 additions & 3 deletions g2core/config_app.cpp
Expand Up @@ -847,9 +847,11 @@ const cfgItem_t cfgArray[] = {
{ "sys","mfo", _fipn,3, cm_print_mfo, get_flt,cm_set_mfo,(float *)&cm.gmx.mfo_factor, FEED_OVERRIDE_FACTOR},
{ "sys","mtoe",_fipn,0, cm_print_mtoe,get_ui8, set_01, (float *)&cm.gmx.mto_enable, TRAVERSE_OVERRIDE_ENABLE},
{ "sys","mto", _fipn,3, cm_print_mto, get_flt,cm_set_mto,(float *)&cm.gmx.mto_factor, TRAVERSE_OVERRIDE_FACTOR},
{ "sys","mt", _fipn,2, st_print_mt, get_flt, st_set_mt,(float *)&st_cfg.motor_power_timeout, MOTOR_POWER_TIMEOUT},
{ "", "me", _f0, 0, st_print_me, get_nul, st_set_me,(float *)&cs.null, 0 }, // GET or SET to enable motors
{ "", "md", _f0, 0, st_print_md, get_nul, st_set_md,(float *)&cs.null, 0 }, // GET or SET to disable motors

// Power management
{ "sys","mt", _fipn,2, st_print_mt, get_flt, st_set_mt, (float *)&st_cfg.motor_power_timeout, MOTOR_POWER_TIMEOUT},
{ "", "me", _f0, 0, st_print_me, st_set_me, st_set_me,(float *)&cs.null, 0 }, // SET to enable motors (null value sets to maintain compatability)
{ "", "md", _f0, 0, st_print_md, st_set_md, st_set_md,(float *)&cs.null, 0 }, // SET to disable motors (null value sets to maintain compatability)

// Spindle functions
{ "sys","spep",_fipn,0, cm_print_spep,get_ui8, set_01, (float *)&spindle.enable_polarity, SPINDLE_ENABLE_POLARITY },
Expand Down
17 changes: 5 additions & 12 deletions g2core/settings/settings_shapeoko2.h
Expand Up @@ -54,6 +54,7 @@

// Communications and reporting settings

#define USB_SERIAL_PORTS_EXPOSED 2 // 1=single endpoint usb, 2=dual endpoint usb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't chili have trouble when dual serial ports are exposed?

Copy link
Author

@ghost ghost Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I havent had any issues, on the contrary its nice to be able to send ! around the queue, however I dont know if anyone else had problems. The only issue may be that sometimes the due needs to be physically (button push) reset, and the serial ports refreshed before chili can connect.

#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS

Expand Down Expand Up @@ -101,21 +102,13 @@
#define M2_POWER_MODE MOTOR_POWER_MODE
#define M2_POWER_LEVEL 0.500

#define M3_MOTOR_MAP AXIS_Y
#define M3_MOTOR_MAP AXIS_Z
#define M3_STEP_ANGLE 1.8
#define M3_TRAVEL_PER_REV 40.00
#define M3_TRAVEL_PER_REV 1.25
#define M3_MICROSTEPS 8
#define M3_POLARITY 1
#define M3_POLARITY 0
#define M3_POWER_MODE MOTOR_POWER_MODE
#define M3_POWER_LEVEL 0.500

#define M4_MOTOR_MAP AXIS_Z
#define M4_STEP_ANGLE 1.8
#define M4_TRAVEL_PER_REV 1.25
#define M4_MICROSTEPS 8
#define M4_POLARITY 0
#define M4_POWER_MODE MOTOR_POWER_MODE
#define M4_POWER_LEVEL 0.750
#define M3_POWER_LEVEL 0.750

// *** axis settings **********************************************************************************

Expand Down
233 changes: 233 additions & 0 deletions g2core/settings/settings_shapeoko2dualY.h
@@ -0,0 +1,233 @@
/*
* settings_shapeoko2dualY.h - Shapeoko2 500mm table
* This file is part of the g2core project
*
* Copyright (c) 2010 - 2016 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
* Free Software Foundation. You should have received a copy of the GNU General Public
* License, version 2 along with the software. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, you may use this file as part of a software library without
* restriction. Specifically, if other files instantiate templates or use macros or
* inline functions from this file, or you compile this file and link it with other
* files to produce an executable, this file does not by itself cause the resulting
* executable to be covered by the GNU General Public License. This exception does not
* however invalidate any other reasons why the executable file might be covered by the
* GNU General Public License.
*
* THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/***********************************************************************/
/**** Shapeoko2 500mm profile ******************************************/
/***********************************************************************/

// ***> NOTE: The init message must be a single line with no CRs or LFs
#define INIT_MESSAGE "Initializing configs to Shapeoko2 500mm profile"

//**** GLOBAL / GENERAL SETTINGS ******************************************************

// Machine configuration settings

#define JUNCTION_INTEGRATION_TIME 0.75 // cornering - between 0.10 and 2.00 (higher is faster)
#define CHORDAL_TOLERANCE 0.01 // chordal tolerance for arcs (in mm)

#define SOFT_LIMIT_ENABLE 0 // 0=off, 1=on
#define HARD_LIMIT_ENABLE 0 // 0=off, 1=on
#define SAFETY_INTERLOCK_ENABLE 1 // 0=off, 1=on

#define SPINDLE_ENABLE_POLARITY 1 // 0=active low, 1=active high
#define SPINDLE_DIR_POLARITY 0 // 0=clockwise is low, 1=clockwise is high
#define SPINDLE_PAUSE_ON_HOLD true
#define SPINDLE_DWELL_TIME 1.0

#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high
#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high
#define COOLANT_PAUSE_ON_HOLD false

// Communications and reporting settings

#define USB_SERIAL_PORTS_EXPOSED 2 // 1=single endpoint usb, 2=dual endpoint usb
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS

#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
#define QUEUE_REPORT_VERBOSITY QR_OFF // one of: QR_OFF, QR_SINGLE, QR_TRIPLE

#define STATUS_REPORT_VERBOSITY SR_FILTERED // one of: SR_OFF, SR_FILTERED, SR_VERBOSE

#define STATUS_REPORT_MIN_MS 100 // milliseconds - enforces a viable minimum
#define STATUS_REPORT_INTERVAL_MS 250 // milliseconds - set $SV=0 to disable

//#define STATUS_REPORT_DEFAULTS "line","posx","posy","posz","posa","feed","vel","unit","coor","dist","admo","frmo","momo","stat"
#define STATUS_REPORT_DEFAULTS "line","posx","posy","posz","feed","vel","momo","stat"

// Alternate SRs that report in drawable units
//#define STATUS_REPORT_DEFAULTS "line","vel","mpox","mpoy","mpoz","mpoa","coor","ofsa","ofsx","ofsy","ofsz","dist","unit","stat","homz","homy","homx","momo"
//#define STATUS_REPORT_DEFAULTS "_ts1","_cs1","_es1","_xs1","_fe1","line","posx","posy","posz","vel","stat"

// Gcode startup defaults
#define GCODE_DEFAULT_UNITS MILLIMETERS // MILLIMETERS or INCHES
#define GCODE_DEFAULT_PLANE CANON_PLANE_XY // CANON_PLANE_XY, CANON_PLANE_XZ, or CANON_PLANE_YZ
#define GCODE_DEFAULT_COORD_SYSTEM G54 // G54, G55, G56, G57, G58 or G59
#define GCODE_DEFAULT_PATH_CONTROL PATH_CONTINUOUS
#define GCODE_DEFAULT_DISTANCE_MODE ABSOLUTE_DISTANCE_MODE

// *** motor settings ************************************************************************************

#define MOTOR_POWER_MODE MOTOR_POWERED_IN_CYCLE // default motor power mode (see cmMotorPowerMode in stepper.h)
#define MOTOR_POWER_TIMEOUT 2.00 // motor power timeout in seconds

#define M1_MOTOR_MAP AXIS_X // 1ma
#define M1_STEP_ANGLE 1.8 // 1sa
#define M1_TRAVEL_PER_REV 40.00 // 1tr
#define M1_MICROSTEPS 8 // 1mi 1,2,4,8,16,32
#define M1_POLARITY 0 // 1po 0=normal, 1=reversed
#define M1_POWER_MODE MOTOR_POWER_MODE // 1pm TRUE=low power idle enabled
#define M1_POWER_LEVEL 0.500

#define M2_MOTOR_MAP AXIS_Y
#define M2_STEP_ANGLE 1.8
#define M2_TRAVEL_PER_REV 40.00
#define M2_MICROSTEPS 8
#define M2_POLARITY 0
#define M2_POWER_MODE MOTOR_POWER_MODE
#define M2_POWER_LEVEL 0.500

#define M3_MOTOR_MAP AXIS_Y
#define M3_STEP_ANGLE 1.8
#define M3_TRAVEL_PER_REV 40.00
#define M3_MICROSTEPS 8
#define M3_POLARITY 1
#define M3_POWER_MODE MOTOR_POWER_MODE
#define M3_POWER_LEVEL 0.500

#define M4_MOTOR_MAP AXIS_Z
#define M4_STEP_ANGLE 1.8
#define M4_TRAVEL_PER_REV 1.25
#define M4_MICROSTEPS 8
#define M4_POLARITY 0
#define M4_POWER_MODE MOTOR_POWER_MODE
#define M4_POWER_LEVEL 0.750

// *** axis settings **********************************************************************************

#define JERK_MAX 5000

#define X_AXIS_MODE AXIS_STANDARD // xam see canonical_machine.h cmAxisMode for valid values
#define X_VELOCITY_MAX 50000 // xvm G0 max velocity in mm/min
#define X_FEEDRATE_MAX X_VELOCITY_MAX // xfr G1 max feed rate in mm/min
#define X_TRAVEL_MIN 0 // xtn minimum travel for soft limits
#define X_TRAVEL_MAX 420 // xtm travel between switches or crashes
#define X_JERK_MAX JERK_MAX // xjm jerk * 1,000,000
#define X_JERK_HIGH_SPEED 20000 // xjh
#define X_HOMING_INPUT 1 // xhi input used for homing or 0 to disable
#define X_HOMING_DIRECTION 0 // xhd 0=search moves negative, 1= search moves positive
#define X_SEARCH_VELOCITY 3000 // xsv minus means move to minimum switch
#define X_LATCH_VELOCITY 100 // xlv mm/min
#define X_LATCH_BACKOFF 4 // xlb mm
#define X_ZERO_BACKOFF 2 // xzb mm

#define Y_AXIS_MODE AXIS_STANDARD
#define Y_VELOCITY_MAX 50000
#define Y_FEEDRATE_MAX Y_VELOCITY_MAX
#define Y_TRAVEL_MIN 0
#define Y_TRAVEL_MAX 420
#define Y_JERK_MAX JERK_MAX
#define Y_JERK_HIGH_SPEED 20000
#define Y_HOMING_INPUT 3
#define Y_HOMING_DIRECTION 0
#define Y_SEARCH_VELOCITY 3000
#define Y_LATCH_VELOCITY 100
#define Y_LATCH_BACKOFF 4
#define Y_ZERO_BACKOFF 2

#define Z_AXIS_MODE AXIS_STANDARD
#define Z_VELOCITY_MAX 1200
#define Z_FEEDRATE_MAX Z_VELOCITY_MAX
#define Z_TRAVEL_MAX 0
#define Z_TRAVEL_MIN -95
#define Z_JERK_MAX 500
#define Z_JERK_HIGH_SPEED 1000
#define Z_HOMING_INPUT 6
#define Z_HOMING_DIRECTION 1
#define Z_SEARCH_VELOCITY (Z_VELOCITY_MAX * 0.66666)
#define Z_LATCH_VELOCITY 25
#define Z_LATCH_BACKOFF 4
#define Z_ZERO_BACKOFF 2

//*** Input / output settings ***
/*
IO_MODE_DISABLED
IO_ACTIVE_LOW aka NORMALLY_OPEN
IO_ACTIVE_HIGH aka NORMALLY_CLOSED

INPUT_ACTION_NONE
INPUT_ACTION_STOP
INPUT_ACTION_FAST_STOP
INPUT_ACTION_HALT
INPUT_ACTION_RESET

INPUT_FUNCTION_NONE
INPUT_FUNCTION_LIMIT
INPUT_FUNCTION_INTERLOCK
INPUT_FUNCTION_SHUTDOWN
INPUT_FUNCTION_PANIC
*/
// Xmin on v9 board
#define DI1_MODE NORMALLY_CLOSED
//#define DI1_ACTION INPUT_ACTION_STOP
#define DI1_ACTION INPUT_ACTION_NONE
#define DI1_FUNCTION INPUT_FUNCTION_LIMIT

// Xmax
#define DI2_MODE NORMALLY_CLOSED
//#define DI2_ACTION INPUT_ACTION_STOP
#define DI2_ACTION INPUT_ACTION_NONE
#define DI2_FUNCTION INPUT_FUNCTION_LIMIT

// Ymin
#define DI3_MODE NORMALLY_CLOSED
//#define DI3_ACTION INPUT_ACTION_STOP
#define DI3_ACTION INPUT_ACTION_NONE
#define DI3_FUNCTION INPUT_FUNCTION_LIMIT

// Ymax
#define DI4_MODE NORMALLY_CLOSED
//#define DI4_ACTION INPUT_ACTION_STOP
#define DI4_ACTION INPUT_ACTION_NONE
#define DI4_FUNCTION INPUT_FUNCTION_LIMIT

// Zmin
#define DI5_MODE IO_ACTIVE_HIGH // Z probe
#define DI5_ACTION INPUT_ACTION_NONE
#define DI5_FUNCTION INPUT_FUNCTION_NONE

// Zmax
#define DI6_MODE NORMALLY_CLOSED
//#define DI6_ACTION INPUT_ACTION_STOP
#define DI6_ACTION INPUT_ACTION_NONE
#define DI6_FUNCTION INPUT_FUNCTION_LIMIT

// Amin
#define DI7_MODE IO_MODE_DISABLED
#define DI7_ACTION INPUT_ACTION_NONE
#define DI7_FUNCTION INPUT_FUNCTION_NONE

// Amax
#define DI8_MODE IO_MODE_DISABLED
#define DI8_ACTION INPUT_ACTION_NONE
#define DI8_FUNCTION INPUT_FUNCTION_NONE

// Hardware interlock input
#define DI9_MODE IO_MODE_DISABLED
#define DI9_ACTION INPUT_ACTION_NONE
#define DI9_FUNCTION INPUT_FUNCTION_NONE