Commit 05976ad2 authored by MagoKimbra's avatar MagoKimbra

Add printer CNC LASER

parent 7b686baf
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
//#define COREXY //#define COREXY
//#define DELTA //#define DELTA
//#define SCARA //#define SCARA
//#define CNCLASER
#if defined(CARTESIAN) #if defined(CARTESIAN)
#include "Configuration_Cartesian.h" #include "Configuration_Cartesian.h"
...@@ -57,6 +58,8 @@ ...@@ -57,6 +58,8 @@
#include "Configuration_Delta.h" #include "Configuration_Delta.h"
#elif defined(SCARA) #elif defined(SCARA)
#include "Configuration_Scara.h" #include "Configuration_Scara.h"
#elif defined(CNCLASER)
#include "Configuration_CNC_laser.h"
#endif #endif
/***********************************************************************/ /***********************************************************************/
...@@ -109,8 +112,6 @@ ...@@ -109,8 +112,6 @@
#define MOTHERBOARD 33 #define MOTHERBOARD 33
#endif #endif
// This defines the number of Driver extruders
#define DRIVER_EXTRUDERS 1
// This defines the number of extruder real or virtual // This defines the number of extruder real or virtual
#define EXTRUDERS 1 #define EXTRUDERS 1
...@@ -132,10 +133,13 @@ ...@@ -132,10 +133,13 @@
//#define MKR4 //#define MKR4
#ifdef MKR4 #ifdef MKR4
#define DELAY_R 500 // Delay for switch rele #define DELAY_R 500 // Delay for switch rele
#define DRIVER_EXTRUDERS 1 // This defines the number of Driver extruders
#endif // END MKR4 #endif // END MKR4
//********************************************************************** //**********************************************************************
#if !defined(MKR4)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruders
#endif
// Setting firmware for FILAMENT END SWITCH // Setting firmware for FILAMENT END SWITCH
// #define FILAMENT_END_SWITCH // #define FILAMENT_END_SWITCH
......
...@@ -44,6 +44,8 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) ...@@ -44,6 +44,8 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
#define EEPROM_VERSION "V12" #define EEPROM_VERSION "V12"
#elif defined(SCARA) #elif defined(SCARA)
#define EEPROM_VERSION "V13" #define EEPROM_VERSION "V13"
#elif defined(CNCLASER)
#define EEPROM_VERSION "V14"
#endif #endif
#ifdef EEPROM_SETTINGS #ifdef EEPROM_SETTINGS
......
// Define this to set a custom name for your generic Mendel,
#define CUSTOM_MENDEL_NAME "Prusa I3"
// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
// #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
//===========================================================================
//=============================Mechanical Settings===========================
//===========================================================================
// coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
#ifndef ENDSTOPPULLUPS
// fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
// #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX
// #define ENDSTOPPULLUP_ZMAX
// #define ENDSTOPPULLUP_XMIN
// #define ENDSTOPPULLUP_YMIN
// #define ENDSTOPPULLUP_ZMIN
#endif
#ifdef ENDSTOPPULLUPS
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#endif
// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define DISABLE_MAX_ENDSTOPS
//#define DISABLE_MIN_ENDSTOPS
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
#define X_ENABLE_ON 0
#define Y_ENABLE_ON 0
#define Z_ENABLE_ON 0
#define E_ENABLE_ON 0 // NOT USED
// Disables axis when it's not being used.
#define DISABLE_X false
#define DISABLE_Y false
#define DISABLE_Z false
#define DISABLE_E true // For all extruders
#define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled
#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_Y_DIR true // for Mendel set to true, for Orca set to false
#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_E0_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E1_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E2_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E3_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
// ENDSTOP SETTINGS:
// Sets direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1
#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below.
// Travel limits after homing
#define X_MAX_POS 200
#define X_MIN_POS 0
#define Y_MAX_POS 200
#define Y_MIN_POS 0
#define Z_MAX_POS 200
#define Z_MIN_POS 0
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
//============================= Bed Auto Leveling ===========================
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable (remove // at the start of the line)
#ifdef ENABLE_AUTO_BED_LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
// - "grid" mode
// Probe every point in a rectangular grid
// You must specify the rectangle, and the density of sample points
// This mode is preferred because there are more measurements.
// It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive
// - "3-point" mode
// Probe 3 arbitrary points on the bed (that aren't colinear)
// You must specify the X & Y coordinates of all 3 points
#define AUTO_BED_LEVELING_GRID
// with AUTO_BED_LEVELING_GRID, the bed is sampled in a
// AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
// and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#ifdef AUTO_BED_LEVELING_GRID
// set the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 185
#define BACK_PROBE_BED_POSITION 185
#define FRONT_PROBE_BED_POSITION 15
// set the number of grid points per dimension
// I wouldn't see a reason to go above 3 (=9 probing points on the bed)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to esimate the plane of the print bed
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 20
#define Z_PROBE_OFFSET_FROM_EXTRUDER -3.65
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define XY_TRAVEL_SPEED 10000 // X and Y axis travel speed between probes, in mm/min
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 4 //How much the extruder will be raised when traveling from between next probing points
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
//If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
//#define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers timeout, it will need X and Y homing again before Z homing
// - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
// - Block Z homing only when the probe is outside bed area.
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
#endif
#endif // ENABLE_AUTO_BED_LEVELING
// The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
// For deltabots this means top and center of the Cartesian print volume.
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
//// MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {100*60, 100*60, 4*60, 0} // set the homing speeds (mm/min)
// default settings
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,3200,1,1,1,1} // X, Y, Z, E0, E1, E2, E3 default steps per unit
#define DEFAULT_MAX_FEEDRATE {300,300,2,1,1,1,1} // X, Y, Z, E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {1,1,1,1} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {3000,3000,50,1} // X, Y, Z, E maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XYJERK 10.0 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (mm/sec)
#define DEFAULT_EJERK 5.0 // NOT USED
//===========================================================================
//=============================Additional Features===========================
//===========================================================================
// Custom M code points
#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#endif
/*********************************************************************\
* R/C SERVO support
* Sponsored by TrinityLabs, Reworked by codexmas
**********************************************************************/
// Number of servos
//
// If you select a configuration below, this will receive a default value and does not need to be set manually
// set it manually if you have more servos than extruders and wish to manually control some
// leaving it undefined or defining as 0 will disable the servo subsystem
// If unsure, leave commented / disabled
//
//#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command
// Servo Endstops
//
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
//
//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
...@@ -89,6 +89,8 @@ ...@@ -89,6 +89,8 @@
// M Codes // M Codes
// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) // M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
// M1 - Same as M0 // M1 - Same as M0
// M03 - Put S<value> in laser beam control
// M05 - Turn off laser beam
// M17 - Enable/Power all stepper motors // M17 - Enable/Power all stepper motors
// M18 - Disable all stepper motors; same as M84 // M18 - Disable all stepper motors; same as M84
// M20 - List SD card // M20 - List SD card
...@@ -209,10 +211,6 @@ CardReader card; ...@@ -209,10 +211,6 @@ CardReader card;
float homing_feedrate[] = HOMING_FEEDRATE; float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_known_position[3] = {false, false, false}; bool axis_known_position[3] = {false, false, false};
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA)
float zprobe_zoffset;
#endif
#ifdef DELTA #ifdef DELTA
float probing_feedrate = PROBING_FEEDRATE; float probing_feedrate = PROBING_FEEDRATE;
float default_z_probe_offset[] = Z_PROBE_OFFSET; float default_z_probe_offset[] = Z_PROBE_OFFSET;
...@@ -221,7 +219,9 @@ float z_probe_deploy_start_location[] = Z_PROBE_DEPLOY_START_LOCATION; ...@@ -221,7 +219,9 @@ float z_probe_deploy_start_location[] = Z_PROBE_DEPLOY_START_LOCATION;
float z_probe_deploy_end_location[] = Z_PROBE_DEPLOY_END_LOCATION; float z_probe_deploy_end_location[] = Z_PROBE_DEPLOY_END_LOCATION;
float z_probe_retract_start_location[] = Z_PROBE_RETRACT_START_LOCATION; float z_probe_retract_start_location[] = Z_PROBE_RETRACT_START_LOCATION;
float z_probe_retract_end_location[] = Z_PROBE_RETRACT_END_LOCATION; float z_probe_retract_end_location[] = Z_PROBE_RETRACT_END_LOCATION;
#endif // Delta #else // No Delta
float zprobe_zoffset;
#endif // No Delta
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply=100; //100->1 200->2 int feedmultiply=100; //100->1 200->2
...@@ -387,10 +387,6 @@ static float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0}; ...@@ -387,10 +387,6 @@ static float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
static float offset[3] = {0.0, 0.0, 0.0}; static float offset[3] = {0.0, 0.0, 0.0};
static bool home_all_axis = true; static bool home_all_axis = true;
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA)
static float feedrate = 1500.0, next_feedrate, saved_feedrate;
#endif
#ifdef DELTA #ifdef DELTA
const float SIN_60 = 0.8660254037844386; const float SIN_60 = 0.8660254037844386;
const float COS_60 = 0.5; const float COS_60 = 0.5;
...@@ -408,7 +404,9 @@ static float bed_level_x, bed_level_y, bed_level_z; ...@@ -408,7 +404,9 @@ static float bed_level_x, bed_level_y, bed_level_z;
static float bed_level_c = 20; //used for inital bed probe safe distance (to avoid crashing into bed) static float bed_level_c = 20; //used for inital bed probe safe distance (to avoid crashing into bed)
static float bed_level_ox, bed_level_oy, bed_level_oz; static float bed_level_ox, bed_level_oy, bed_level_oz;
static int loopcount; static int loopcount;
#endif // DELTA #else // No DELTA
static float feedrate = 1500.0, next_feedrate, saved_feedrate;
#endif // No DELTA
static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0; static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
static bool relative_mode = false; //Determines Absolute or Relative Coordinates static bool relative_mode = false; //Determines Absolute or Relative Coordinates
...@@ -661,6 +659,10 @@ void setup() ...@@ -661,6 +659,10 @@ void setup()
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
setup_photpin(); setup_photpin();
#endif #endif
#if defined(LASERBEAM_PIN) && LASERBEAM_PIN > -1
pinMode(LASERBEAM_PIN, OUTPUT);
digitalWrite(LASERBEAM_PIN, LOW); // turn it off
#endif
#if defined(NUM_SERVOS) #if defined(NUM_SERVOS)
servo_init(); servo_init();
#endif #endif
...@@ -938,7 +940,7 @@ static inline type array(int axis) \ ...@@ -938,7 +940,7 @@ static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); } { return pgm_read_any(&array##_P[axis]); }
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS);
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) || defined(CNCLASER)
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS); XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS);
XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS); XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS);
XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH); XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH);
...@@ -985,7 +987,7 @@ static float duplicate_extruder_temp_offset = 0; // used in mode 2 ...@@ -985,7 +987,7 @@ static float duplicate_extruder_temp_offset = 0; // used in mode 2
bool extruder_duplication_enabled = false; // used in mode 2 bool extruder_duplication_enabled = false; // used in mode 2
#endif //DUAL_X_CARRIAGE #endif //DUAL_X_CARRIAGE
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) || defined(CNCLASER)
static void axis_is_at_home(int axis) { static void axis_is_at_home(int axis) {
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
if (axis == X_AXIS) { if (axis == X_AXIS) {
...@@ -2947,6 +2949,20 @@ void process_commands() ...@@ -2947,6 +2949,20 @@ void process_commands()
} }
break; break;
#endif #endif
#ifdef CNCLASER
case 03: // M03 S - Setting laser beam
{
if(code_seen('S')) {
digitalWrite(LASERBEAM_PIN, code_value());
}
}
break;
case 05: // M05 - Setting laser beam off
digitalWrite(LASERBEAM_PIN, 0);
break;
#endif // CNCLASER
case 17: case 17:
LCD_MESSAGEPGM(MSG_NO_MOVE); LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_x(); enable_x();
......
...@@ -2920,6 +2920,10 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -2920,6 +2920,10 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#endif // END DELTA #endif // END DELTA
#endif // END NPR2 #endif // END NPR2
#ifdef CNCLASER
#define LASERBEAM_PIN 6
#endif
#ifdef FILAMENT_END_SWITCH #ifdef FILAMENT_END_SWITCH
#define PAUSE_PIN 5 #define PAUSE_PIN 5
#endif #endif
......
...@@ -73,6 +73,7 @@ I put in a single firmware all the firmware that I found online for the various ...@@ -73,6 +73,7 @@ I put in a single firmware all the firmware that I found online for the various
* \#define COREXY * \#define COREXY
* \#define DELTA * \#define DELTA
* \#define SCARA * \#define SCARA
* \#define CNCLASER
Different axis step per unit for all extruder Different axis step per unit for all extruder
----------------- -----------------
...@@ -131,6 +132,8 @@ Implemented G Codes: ...@@ -131,6 +132,8 @@ Implemented G Codes:
M Codes M Codes
* M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) * M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
* M1 - Same as M0 * M1 - Same as M0
* M03 - Put S<value> in laser beam control
* M05 - Turn off laser beam
* M17 - Enable/Power all stepper motors * M17 - Enable/Power all stepper motors
* M18 - Disable all stepper motors; same as M84 * M18 - Disable all stepper motors; same as M84
* M20 - List SD card * M20 - List SD card
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment