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

Add some configuration options to allow either the Analog reading of the FSR, or digital reading #7

Open
wants to merge 8 commits into
base: fsr
Choose a base branch
from
77 changes: 77 additions & 0 deletions Marlin/Calibration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* This file contains the important calibration settings for your Delta printer
* in one place.
*
* During calibration of your printer, each one of these will be customized
* to suit your printers geometry, and stepper motor setup.
*
* See the file Configuration.h for the meaning of each of these confituration
* options.
*
* NOTE: This file contains values that would suit a Kossel Mini. If you have
* a Kossel Air, or other printer, these will be quite different.
**/

#ifndef __CALIBRATION_H
#define __CALIBRATION_H

// This is a RAMPS board
#define MOTHERBOARD 33

// Define this to set a custom name for your generic Mendel,
#define STRING_CONFIG_H_AUTHOR "(tmolteno, Mini Kossel)" // Who made the changes.

//===========================================================================
//============================== Delta Settings =============================
//===========================================================================

// First thing to calibrate is the manual home position
// For delta: Distance between nozzle and print surface after homing.
#define MANUAL_Z_HOME_POS 200.1

// Center-to-center distance of the holes in the diagonal push rods.
#define DELTA_DIAGONAL_ROD 214.5 // mm

// Horizontal offset from middle of printer to smooth rod center.
#define DELTA_SMOOTH_ROD_OFFSET 139.0 // mm

// Horizontal offset of the universal joints on the end effector.
#define DELTA_EFFECTOR_OFFSET 20.0 // mm

// Horizontal offset of the universal joints on the carriages.
#define DELTA_CARRIAGE_OFFSET 12.0 // mm

// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).
#define DELTA_PRINTABLE_RADIUS 80.0


// Stepper Motor And Gear Calibration

#define XYZ_FULL_STEPS_PER_ROTATION 200
#define XYZ_MICROSTEPS 16
#define XYZ_BELT_PITCH 2 // millimeters
#define XYZ_PULLEY_TEETH 16

// After printing a test cube, insert a factor here that will scale your object to
// the correct dimensions
#define SCALING_FACTOR 0.97

// During extruder calibration, modify this value so that
// the extruder extrudes the correct length.
#define EXTRUDER_STEPS 450

#define DEFAULT_MAX_FEEDRATE {200, 200, 200, 200} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {4500,4500,4500,4500} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.

/* Reduce these for smoother printing */
#define DEFAULT_ACCELERATION 1500 // 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

// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XYJERK 2.0 // (mm/sec)
#define DEFAULT_ZJERK 2.0 // (mm/sec)
#define DEFAULT_EJERK 5.0 // (mm/sec)

// All remaining calibration options are in the file Configuration.h

#endif //____CALIBRATION_H
163 changes: 109 additions & 54 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// Advanced settings can be found in Configuration_adv.h
// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration

// Use a separate configuration file for your local calibration settings.
#include "Calibration.h"

//===========================================================================
//============================= DELTA Printer ===============================
//===========================================================================
Expand Down Expand Up @@ -94,34 +97,48 @@
// Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it.
// #define PS_DEFAULT_OFF

//===========================================================================
//============================== Delta Settings =============================
//===========================================================================
// Enable DELTA kinematics


#define DELTA

// Make delta curves from many straight lines (linear interpolation).
// This is a trade-off between visible corners (not enough segments)
// and processor overload (too many expensive sqrt calls).
#define DELTA_SEGMENTS_PER_SECOND 100
#ifndef __CALIBRATION_H
// Override your calibration settings in Calibration.h

//===========================================================================
//============================== Delta Settings =============================
//===========================================================================
// Enable DELTA kinematics

// The following values are for a Kossel Air. For sensible starting values
// for a Kossel Mini, see Calibration.h

// Center-to-center distance of the holes in the diagonal push rods.
#define DELTA_DIAGONAL_ROD 186.0 // mm

// Horizontal offset from middle of printer to smooth rod center.
#define DELTA_SMOOTH_ROD_OFFSET 128.0 // mm

// Horizontal offset of the universal joints on the end effector.
#define DELTA_EFFECTOR_OFFSET 19.9 // mm

// Center-to-center distance of the holes in the diagonal push rods.
#define DELTA_DIAGONAL_ROD 186.0 // mm
// Horizontal offset of the universal joints on the carriages.
#define DELTA_CARRIAGE_OFFSET 19.5 // mm

// Horizontal offset from middle of printer to smooth rod center.
#define DELTA_SMOOTH_ROD_OFFSET 128.0 // mm
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).
#define DELTA_PRINTABLE_RADIUS 75.0

// Horizontal offset of the universal joints on the end effector.
#define DELTA_EFFECTOR_OFFSET 19.9 // mm
#endif // __CALIBRATION_H

// Horizontal offset of the universal joints on the carriages.
#define DELTA_CARRIAGE_OFFSET 19.5 // mm
// Make delta curves from many straight lines (linear interpolation).
// This is a trade-off between visible corners (not enough segments)
// and processor overload (too many expensive sqrt calls).
#define DELTA_SEGMENTS_PER_SECOND 100

// Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)

// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).
#define DELTA_PRINTABLE_RADIUS 75.0
// Diagonal rod squared
#define DELTA_DIAGONAL_ROD_2 pow(DELTA_DIAGONAL_ROD,2)

// Effective X/Y positions of the three vertical towers.
#define SIN_60 0.8660254037844386
Expand All @@ -133,8 +150,6 @@
#define DELTA_TOWER3_X 0.0 // back middle tower
#define DELTA_TOWER3_Y DELTA_RADIUS

// Diagonal rod squared
#define DELTA_DIAGONAL_ROD_2 pow(DELTA_DIAGONAL_ROD,2)

//===========================================================================
//=============================Thermal Settings ============================
Expand Down Expand Up @@ -172,9 +187,9 @@
// 110 is Pt100 with 1k pullup (non standard)

#define TEMP_SENSOR_0 5
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 2
#define TEMP_SENSOR_1 1
#define TEMP_SENSOR_2 2
#define TEMP_SENSOR_BED 1

// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
//#define TEMP_SENSOR_1_AS_REDUNDANT
Expand Down Expand Up @@ -226,8 +241,8 @@

// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
// Ultimaker
#define DEFAULT_Kp 22.2
#define DEFAULT_Ki 1.08
#define DEFAULT_Kp 35.98
#define DEFAULT_Ki 3.12
#define DEFAULT_Kd 114

// MakerGear
Expand Down Expand Up @@ -426,7 +441,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// with accurate bed leveling, the bed is sampled in a ACCURATE_BED_LEVELING_POINTSxACCURATE_BED_LEVELING_POINTS grid and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#define ACCURATE_BED_LEVELING

#ifdef ACCURATE_BED_LEVELING
#define ACCURATE_BED_LEVELING_POINTS 9
#define ACCURATE_BED_LEVELING_GRID_X ((RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (ACCURATE_BED_LEVELING_POINTS - 1))
Expand All @@ -439,12 +454,38 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define NONLINEAR_BED_LEVELING
#endif

// Force Sensing Resistors under the print surface, wired to heated bed thermistor input.
// Force Sensing Resistors under the print surface, wired to either the Z_MIN input,
// or the TEMP_1_PIN analog input (used for bed temperature)
// Autolevel by measuring how much the hotend is pushing down, without separate Z probe.
#define FSR_BED_LEVELING

// Define this if you wish to use the bed temperature analog input to read the FSR
// This is called TEMP_1_PIN
#define FSR_BED_TEMPERATURE
#define FSR_TEMP_SENSOR_2
// Define FSR_Z_MIN to use the Z_MIN digital input as the bed sensor
// Check your readings using M119 before trying automatic leveling using Z_MIN
// you will also have to set the following above
// const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
//#define FSR_Z_MIN
#endif // ENABLE_AUTO_BED_LEVELING

// Do a sanity check to make sure that only one of FSR_Z_MIN or FSR_BED_TEMPERATURE are
// defined.
#ifdef FSR_Z_MIN
const bool Z_MIN_ENDSTOP_INVERTING = true;
#ifdef FSR_BED_TEMPERATURE
#error you can only define ONE of FSR_Z_MIN or FSR_BED_TEMPERATURE
#endif // FSR_BED_TEMPERATURE
#endif // FSR_Z_MIN

#ifdef FSR_TEMP_SENSOR_2
#ifndef TEMP_2_PIN
#warning You must define TEMP_2_PIN if FSR_TEMP_SENSOR_2 is defined
#define TEMP_2_PIN 15 //Analog numbering
#endif
#endif



// 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)
Expand All @@ -453,37 +494,49 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// 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 210 // For delta: Distance between nozzle and print surface after homing.

#ifndef MANUAL_Z_HOME_POS
#define MANUAL_Z_HOME_POS 210 // For delta: Distance between nozzle and print surface after homing.
#endif

//// MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0} // set the homing speeds (mm/min)

// default settings

#define XYZ_FULL_STEPS_PER_ROTATION 200
#define XYZ_MICROSTEPS 16
#define XYZ_BELT_PITCH 2
#define XYZ_PULLEY_TEETH 17
#define XYZ_STEPS (XYZ_FULL_STEPS_PER_ROTATION * XYZ_MICROSTEPS / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH))

#define DEFAULT_AXIS_STEPS_PER_UNIT {XYZ_STEPS, XYZ_STEPS, XYZ_STEPS, 100}
#define DEFAULT_MAX_FEEDRATE {200, 200, 200, 200} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {9000,9000,9000,9000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.

#define DEFAULT_ACCELERATION 3000 // 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 20.0 // (mm/sec)
#define DEFAULT_ZJERK 20.0 // (mm/sec)
#define DEFAULT_EJERK 20.0 // (mm/sec)
#ifndef __CALIBRATION_H
// Override these settings in Calibration.h

#define XYZ_FULL_STEPS_PER_ROTATION 200
#define XYZ_MICROSTEPS 16
#define XYZ_BELT_PITCH 2
#define XYZ_PULLEY_TEETH 16

#define SCALING_FACTOR 1.0 // Modify this in Calibration.h after you've printed a test cube

#define EXTRUDER_STEPS 100

#define DEFAULT_MAX_FEEDRATE {200, 200, 200, 200} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {9000,9000,9000,9000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.

#define DEFAULT_ACCELERATION 3000 // 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 20.0 // (mm/sec)
#define DEFAULT_ZJERK 20.0 // (mm/sec)
#define DEFAULT_EJERK 20.0 // (mm/sec)
#endif /* __CALIBRATION_H */

#define XYZ_STEPS (SCALING_FACTOR * XYZ_FULL_STEPS_PER_ROTATION * XYZ_MICROSTEPS / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH))
#define DEFAULT_AXIS_STEPS_PER_UNIT {XYZ_STEPS, XYZ_STEPS, XYZ_STEPS, EXTRUDER_STEPS}

//===========================================================================
//=============================Additional Features===========================
Expand Down Expand Up @@ -622,8 +675,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o

#endif

// Define your LCD version in Calibration.h

// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
#define LCD_I2C_VIKI
//#define LCD_I2C_VIKI
#ifdef LCD_I2C_VIKI
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
Expand Down
Loading