Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
77c86772
Commit
77c86772
authored
Dec 21, 2014
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Change AUTO_BED_LEVELING with AUTO_BED_COMPENSATION"
This reverts commit
920a6718
.
parent
1ab27c1a
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
155 additions
and
167 deletions
+155
-167
ConfigurationStore.cpp
MarlinKimbra/ConfigurationStore.cpp
+6
-6
Configuration_Cartesian.h
MarlinKimbra/Configuration_Cartesian.h
+11
-11
Configuration_Corexy.h
MarlinKimbra/Configuration_Corexy.h
+11
-11
Configuration_Scara.h
MarlinKimbra/Configuration_Scara.h
+36
-48
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+54
-54
Servo.cpp
MarlinKimbra/Servo.cpp
+1
-1
Servo.h
MarlinKimbra/Servo.h
+1
-1
planner.cpp
MarlinKimbra/planner.cpp
+15
-15
planner.h
MarlinKimbra/planner.h
+9
-9
qr_solve.cpp
MarlinKimbra/qr_solve.cpp
+1
-1
qr_solve.h
MarlinKimbra/qr_solve.h
+1
-1
stepper.cpp
MarlinKimbra/stepper.cpp
+2
-2
stepper.h
MarlinKimbra/stepper.h
+2
-2
ultralcd.cpp
MarlinKimbra/ultralcd.cpp
+1
-1
vector_3.cpp
MarlinKimbra/vector_3.cpp
+2
-2
vector_3.h
MarlinKimbra/vector_3.h
+2
-2
No files found.
MarlinKimbra/ConfigurationStore.cpp
View file @
77c86772
...
...
@@ -74,7 +74,7 @@ void Config_StoreSettings()
EEPROM_WRITE_VAR
(
i
,
tower_adj
);
EEPROM_WRITE_VAR
(
i
,
z_probe_offset
);
#endif
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
EEPROM_WRITE_VAR
(
i
,
zprobe_zoffset
);
#endif
#ifndef ULTIPANEL
...
...
@@ -239,11 +239,11 @@ void Config_PrintSettings()
*/
#endif // DELTA
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
"Z Probe offset (mm):"
,
zprobe_zoffset
);
SERIAL_ECHOLN
(
""
);
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#ifdef PIDTEMP
SERIAL_ECHO_START
;
...
...
@@ -297,7 +297,7 @@ void Config_RetrieveSettings()
// Update delta constants for updated delta_radius & tower_adj values
set_delta_constants
();
#endif
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
EEPROM_READ_VAR
(
i
,
zprobe_zoffset
);
#endif
#ifndef ULTIPANEL
...
...
@@ -357,7 +357,7 @@ void Config_ResetDefault()
float
tmp6
[]
=
DEFAULT_Ki
;
float
tmp7
[]
=
DEFAULT_Kd
;
for
(
short
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
for
(
short
i
=
0
;
i
<
7
;
i
++
)
{
axis_steps_per_unit
[
i
]
=
tmp1
[
i
];
max_feedrate
[
i
]
=
tmp2
[
i
];
...
...
@@ -404,7 +404,7 @@ void Config_ResetDefault()
gumPreheatHPBTemp
=
GUM_PREHEAT_HPB_TEMP
;
gumPreheatFanSpeed
=
GUM_PREHEAT_FAN_SPEED
;
#endif
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
zprobe_zoffset
=
-
Z_PROBE_OFFSET_FROM_EXTRUDER
;
#endif
#ifdef DOGLCD
...
...
MarlinKimbra/Configuration_Cartesian.h
View file @
77c86772
...
...
@@ -89,9 +89,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
//============================= Bed
Auto Compensation
===========================
//============================= Bed
Leveling
===========================
//#define ENABLE_AUTO_BED_
COMPENSATION
// Delete the comment to enable
//#define ENABLE_AUTO_BED_
LEVELING
// Delete the comment to enable
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
// set the rectangle in which to probe in manual or automatic
...
...
@@ -102,7 +102,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
...
...
@@ -116,17 +116,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
// 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_
COMPENSATION
_GRID
// with AUTO_BED_
COMPENSATION
_GRID, the bed is sampled in a
// AUTO_BED_
COMPENSATION_GRID_POINTSxAUTO_BED_COMPENSATION
_GRID_POINTS grid
#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_
COMPENSATION
_GRID
#ifdef AUTO_BED_
LEVELING
_GRID
// 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_
COMPENSATION
_GRID_POINTS 2
#define AUTO_BED_
LEVELING
_GRID_POINTS 2
#else // not AUTO_BED_
COMPENSATION
_GRID
#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
...
...
@@ -137,7 +137,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_
COMPENSATION
_GRID
#endif // AUTO_BED_
LEVELING
_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
...
...
@@ -178,7 +178,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#endif
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
// The position of the homing switches
...
...
MarlinKimbra/Configuration_Corexy.h
View file @
77c86772
...
...
@@ -94,9 +94,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
//============================= Bed
Auto Compensation
===========================
//============================= Bed
Leveling
===========================
//#define ENABLE_AUTO_BED_
COMPENSATION
// Delete the comment to enable
//#define ENABLE_AUTO_BED_
LEVELING
// Delete the comment to enable
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
// set the rectangle in which to probe in manual or automatic
...
...
@@ -107,7 +107,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
...
...
@@ -121,17 +121,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
// 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_
COMPENSATION
_GRID
// with AUTO_BED_
COMPENSATION
_GRID, the bed is sampled in a
// AUTO_BED_
COMPENSATION_GRID_POINTSxAUTO_BED_COMPENSATION
_GRID_POINTS grid
#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_
COMPENSATION
_GRID
#ifdef AUTO_BED_
LEVELING
_GRID
// 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_
COMPENSATION
_GRID_POINTS 2
#define AUTO_BED_
LEVELING
_GRID_POINTS 2
#else // not AUTO_BED_
COMPENSATION
_GRID
#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
...
...
@@ -142,7 +142,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_
COMPENSATION
_GRID
#endif // AUTO_BED_
LEVELING
_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
...
...
@@ -183,7 +183,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#endif
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
// The position of the homing switches
...
...
MarlinKimbra/Configuration_Scara.h
View file @
77c86772
...
...
@@ -54,20 +54,23 @@
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#define ENDSTOPPULLUP_EMIN
#endif
// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
const
bool
X_MIN_ENDSTOP_INVERTING
=
true
;
// set to true to invert the logic of the endstop.
const
bool
Y_MIN_ENDSTOP_INVERTING
=
true
;
// set to true to invert the logic of the endstop.
const
bool
Z_MIN_ENDSTOP_INVERTING
=
true
;
// set to true to invert the logic of the endstop.
const
bool
E_MIN_ENDSTOP_INVERTING
=
false
;
// set to true to invert the logic of the endstop.
const
bool
X_MAX_ENDSTOP_INVERTING
=
true
;
// set to true to invert the logic of the endstop.
const
bool
Y_MAX_ENDSTOP_INVERTING
=
true
;
// set to true to invert the logic of the endstop.
const
bool
Z_MAX_ENDSTOP_INVERTING
=
true
;
// set to true to invert the logic of the endstop.
//#define DISABLE_MAX_ENDSTOPS
//#define DISABLE_MIN_ENDSTOPS
// Disable max endstops for compatibility with endstop checking routine
#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
#define DISABLE_MAX_ENDSTOPS
#endif
// 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
...
...
@@ -79,7 +82,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define DISABLE_Y false
#define DISABLE_Z false
#define DISABLE_E false // For all extruders
#define DISABLE_INACTIVE_EXTRUDER
fals
e //disable only inactive extruders and keep active extruder enabled
#define DISABLE_INACTIVE_EXTRUDER
tru
e //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 false // for Mendel set to true, for Orca set to false
...
...
@@ -89,11 +92,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define INVERT_E2_DIR false // 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
// Sets direction of endstop
s when homing; 1=MAX, -1=MIN
#define X_HOME_DIR 1
#define Y_HOME_DIR 1
#define Z_HOME_DIR -1
#define E_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.
...
...
@@ -105,27 +107,15 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define Y_MIN_POS 0
#define Z_MAX_POS 225
#define Z_MIN_POS MANUAL_Z_HOME_POS
#define E_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)
//============================= Bed Auto Compensation ===========================
//#define ENABLE_AUTO_BED_COMPENSATION // Delete the comment to enable
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
// set the rectangle in which to probe in manual or automatic
#define LEFT_PROBE_BED_POSITION 20
#define RIGHT_PROBE_BED_POSITION 180
#define BACK_PROBE_BED_POSITION 180
#define FRONT_PROBE_BED_POSITION 20
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
...
...
@@ -139,17 +129,25 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// 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_
COMPENSATION
_GRID
// with AUTO_BED_
COMPENSATION
_GRID, the bed is sampled in a
// AUTO_BED_
COMPENSATION_GRID_POINTSxAUTO_BED_COMPENSATION
_GRID_POINTS grid
#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_COMPENSATION_GRID
#ifdef AUTO_BED_LEVELING_GRID
// set the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 170
#define BACK_PROBE_BED_POSITION 180
#define FRONT_PROBE_BED_POSITION 20
// 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_COMPENSATION_GRID_POINTS 2
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_
COMPENSATION
_GRID
#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
...
...
@@ -160,7 +158,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_
COMPENSATION
_GRID
#endif // AUTO_BED_
LEVELING
_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
...
...
@@ -171,6 +169,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
//#define Z_RAISE_BEFORE_HOMING 4 // (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 8000 // X and Y axis travel speed between probes, in mm/min
#define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points
...
...
@@ -185,12 +185,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
//If you have enabled the Bed Auto Compensation 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.
//
#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
...
...
@@ -199,7 +199,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#endif
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
// The position of the homing switches
...
...
@@ -238,15 +238,3 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define DEFAULT_XYJERK 5 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (mm/sec)
#define DEFAULT_EJERK 3 // (mm/sec)
//===========================================================================
//=============================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
MarlinKimbra/Marlin_main.cpp
View file @
77c86772
...
...
@@ -29,12 +29,12 @@
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
#include "vector_3.h"
#ifdef AUTO_BED_
COMPENSATION
_GRID
#ifdef AUTO_BED_
LEVELING
_GRID
#include "qr_solve.h"
#endif
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#include "ultralcd.h"
#include "planner.h"
...
...
@@ -617,7 +617,7 @@ void servo_init()
}
#endif // SERVO_ENDSTOPS
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay
(
PROBE_SERVO_DEACTIVATION_DELAY
);
servos
[
servo_endstops
[
Z_AXIS
]].
detach
();
#endif
...
...
@@ -1072,16 +1072,16 @@ static void axis_is_at_home(int axis) {
#endif // SCARA
}
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef AUTO_BED_
COMPENSATION
_GRID
#ifdef ENABLE_AUTO_BED_
LEVELING
#ifdef AUTO_BED_
LEVELING
_GRID
static
void
set_bed_level_equation_lsq
(
double
*
plane_equation_coefficients
)
{
vector_3
planeNormal
=
vector_3
(
-
plane_equation_coefficients
[
0
],
-
plane_equation_coefficients
[
1
],
1
);
planeNormal
.
debug
(
"planeNormal"
);
plan_bed_
compensation
_matrix
=
matrix_3x3
::
create_look_at
(
planeNormal
);
plan_bed_
level
_matrix
=
matrix_3x3
::
create_look_at
(
planeNormal
);
//bedLevel.debug("bedLevel");
//plan_bed_
compensation
_matrix.debug("bed level before");
//plan_bed_
level
_matrix.debug("bed level before");
//vector_3 uncorrected_position = plan_get_position_mm();
//uncorrected_position.debug("position before");
...
...
@@ -1097,12 +1097,12 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
plan_set_position
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
]);
}
#else // not AUTO_BED_
COMPENSATION
_GRID
#else // not AUTO_BED_
LEVELING
_GRID
static
void
set_bed_level_equation_3pts
(
float
z_at_pt_1
,
float
z_at_pt_2
,
float
z_at_pt_3
)
{
plan_bed_
compensation
_matrix
.
set_to_identity
();
plan_bed_
level
_matrix
.
set_to_identity
();
vector_3
pt1
=
vector_3
(
ABL_PROBE_PT_1_X
,
ABL_PROBE_PT_1_Y
,
z_at_pt_1
);
vector_3
pt2
=
vector_3
(
ABL_PROBE_PT_2_X
,
ABL_PROBE_PT_2_Y
,
z_at_pt_2
);
...
...
@@ -1113,7 +1113,7 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
vector_3
planeNormal
=
vector_3
::
cross
(
from_2_to_1
,
from_2_to_3
).
get_normal
();
planeNormal
=
vector_3
(
planeNormal
.
x
,
planeNormal
.
y
,
abs
(
planeNormal
.
z
));
plan_bed_
compensation
_matrix
=
matrix_3x3
::
create_look_at
(
planeNormal
);
plan_bed_
level
_matrix
=
matrix_3x3
::
create_look_at
(
planeNormal
);
vector_3
corrected_position
=
plan_get_position
();
current_position
[
X_AXIS
]
=
corrected_position
.
x
;
...
...
@@ -1127,10 +1127,10 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
}
#endif // AUTO_BED_
COMPENSATION
_GRID
#endif // AUTO_BED_
LEVELING
_GRID
static
void
run_z_probe
()
{
plan_bed_
compensation
_matrix
.
set_to_identity
();
plan_bed_
level
_matrix
.
set_to_identity
();
feedrate
=
homing_feedrate
[
Z_AXIS
];
// move down until you find the bed
...
...
@@ -1205,11 +1205,11 @@ static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#if defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0)
if
(
servo_endstops
[
Z_AXIS
]
>
-
1
)
{
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos
[
servo_endstops
[
Z_AXIS
]].
attach
(
0
);
#endif
servos
[
servo_endstops
[
Z_AXIS
]].
write
(
servo_endstop_angles
[
Z_AXIS
*
2
]);
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay
(
PROBE_SERVO_DEACTIVATION_DELAY
);
servos
[
servo_endstops
[
Z_AXIS
]].
detach
();
#endif
...
...
@@ -1221,11 +1221,11 @@ static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#if defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0)
if
(
servo_endstops
[
Z_AXIS
]
>
-
1
)
{
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos
[
servo_endstops
[
Z_AXIS
]].
attach
(
0
);
#endif
servos
[
servo_endstops
[
Z_AXIS
]].
write
(
servo_endstop_angles
[
Z_AXIS
*
2
+
1
]);
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay
(
PROBE_SERVO_DEACTIVATION_DELAY
);
servos
[
servo_endstops
[
Z_AXIS
]].
detach
();
#endif
...
...
@@ -1259,7 +1259,7 @@ static float probe_pt(float x, float y, float z_before) {
return
measured_z
;
}
#endif // #ifdef ENABLE_AUTO_BED_
COMPENSATION
#endif // #ifdef ENABLE_AUTO_BED_
LEVELING
static
void
homeaxis
(
int
axis
)
{
#define HOMEAXIS_DO(LETTER) \
...
...
@@ -1282,7 +1282,7 @@ static void homeaxis(int axis) {
#ifndef Z_PROBE_SLED
// Engage Servo endstop if enabled
#if defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0)
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if
(
axis
==
Z_AXIS
)
{
engage_z_probe
();
}
...
...
@@ -1320,7 +1320,7 @@ static void homeaxis(int axis) {
servos
[
servo_endstops
[
axis
]].
write
(
servo_endstop_angles
[
axis
*
2
+
1
]);
}
#endif
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#ifndef Z_PROBE_SLED
if
(
axis
==
Z_AXIS
)
retract_z_probe
();
#endif
...
...
@@ -1881,7 +1881,7 @@ void process_commands()
{
unsigned
long
codenum
;
//throw away variable
char
*
starpos
=
NULL
;
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
float
x_tmp
,
y_tmp
,
z_tmp
,
real_z
;
#endif
if
(
code_seen
(
'G'
))
{
...
...
@@ -1957,9 +1957,9 @@ void process_commands()
#endif //FWRETRACT
case
28
:
//G28 Home all Axis one at a time
#ifdef ENABLE_AUTO_BED_
COMPENSATION
plan_bed_
compensation_matrix
.
set_to_identity
();
//Reset the plane ("erase" all compensation
data)
#endif //ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
plan_bed_
level_matrix
.
set_to_identity
();
//Reset the plane ("erase" all leveling
data)
#endif //ENABLE_AUTO_BED_
LEVELING
saved_feedrate
=
feedrate
;
saved_feedmultiply
=
feedmultiply
;
...
...
@@ -2238,7 +2238,7 @@ void process_commands()
}
}
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
if
((
home_all_axis
)
||
(
code_seen
(
axis_codes
[
Z_AXIS
])))
{
current_position
[
Z_AXIS
]
+=
zprobe_zoffset
;
//Add Z_Probe offset (the distance is negative)
}
...
...
@@ -2262,11 +2262,11 @@ void process_commands()
endstops_hit_on_purpose
();
break
;
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
case
29
:
// G29 Detailed Z-Probe, probes the bed at 3 or more points.
{
#if Z_MIN_PIN == -1
#error "You must have a Z_MIN endstop in order to enable Auto Bed
Compensation
feature!!! Z_MIN_PIN must point to a valid hardware pin."
#error "You must have a Z_MIN endstop in order to enable Auto Bed
Leveling
feature!!! Z_MIN_PIN must point to a valid hardware pin."
#endif
// Prevent user from running a G29 without first homing in X and Y
...
...
@@ -2285,7 +2285,7 @@ void process_commands()
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
//vector_3 corrected_position = plan_get_position_mm();
//corrected_position.debug("position before G29");
plan_bed_
compensation
_matrix
.
set_to_identity
();
plan_bed_
level
_matrix
.
set_to_identity
();
vector_3
uncorrected_position
=
plan_get_position
();
//uncorrected_position.debug("position durring G29");
current_position
[
X_AXIS
]
=
uncorrected_position
.
x
;
...
...
@@ -2295,12 +2295,12 @@ void process_commands()
setup_for_endstop_move
();
feedrate
=
homing_feedrate
[
Z_AXIS
];
#ifdef AUTO_BED_
COMPENSATION
_GRID
#ifdef AUTO_BED_
LEVELING
_GRID
int
r_probe_bed_position
=
RIGHT_PROBE_BED_POSITION
;
int
l_probe_bed_position
=
LEFT_PROBE_BED_POSITION
;
int
f_probe_bed_position
=
FRONT_PROBE_BED_POSITION
;
int
b_probe_bed_position
=
BACK_PROBE_BED_POSITION
;
int
a_bed_
compensation_points
=
AUTO_BED_COMPENSATION
_GRID_POINTS
;
int
a_bed_
leveling_points
=
AUTO_BED_LEVELING
_GRID_POINTS
;
if
(
code_seen
(
'R'
))
{
...
...
@@ -2324,7 +2324,7 @@ void process_commands()
if
(
code_seen
(
'A'
))
{
a_bed_
compensation
_points
=
code_value
();
a_bed_
leveling
_points
=
code_value
();
}
if
((
f_probe_bed_position
==
b_probe_bed_position
)
||
(
r_probe_bed_position
==
l_probe_bed_position
))
...
...
@@ -2337,8 +2337,8 @@ void process_commands()
// probe at the points of a lattice grid
int
xGridSpacing
=
(
r_probe_bed_position
-
l_probe_bed_position
)
/
(
a_bed_
compensation
_points
-
1
);
int
yGridSpacing
=
(
b_probe_bed_position
-
f_probe_bed_position
)
/
(
a_bed_
compensation
_points
-
1
);
int
xGridSpacing
=
(
r_probe_bed_position
-
l_probe_bed_position
)
/
(
a_bed_
leveling
_points
-
1
);
int
yGridSpacing
=
(
b_probe_bed_position
-
f_probe_bed_position
)
/
(
a_bed_
leveling
_points
-
1
);
// solve the plane equation ax + by + d = z
// A is the matrix with rows [x y 1] for all the probed points
...
...
@@ -2347,9 +2347,9 @@ void process_commands()
// so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
// "A" matrix of the linear system of equations
double
eqnAMatrix
[
a_bed_
compensation_points
*
a_bed_compensation
_points
*
3
];
double
eqnAMatrix
[
a_bed_
leveling_points
*
a_bed_leveling
_points
*
3
];
// "B" vector of Z points
double
eqnBVector
[
a_bed_
compensation_points
*
a_bed_compensation
_points
];
double
eqnBVector
[
a_bed_
leveling_points
*
a_bed_leveling
_points
];
int
probePointCounter
=
0
;
bool
zig
=
true
;
...
...
@@ -2372,7 +2372,7 @@ void process_commands()
zig
=
true
;
}
for
(
int
xCount
=
0
;
xCount
<
a_bed_
compensation
_points
;
xCount
++
)
for
(
int
xCount
=
0
;
xCount
<
a_bed_
leveling
_points
;
xCount
++
)
{
float
z_before
;
if
(
probePointCounter
==
0
)
...
...
@@ -2390,9 +2390,9 @@ void process_commands()
eqnBVector
[
probePointCounter
]
=
measured_z
;
eqnAMatrix
[
probePointCounter
+
0
*
a_bed_
compensation_points
*
a_bed_compensation
_points
]
=
xProbe
;
eqnAMatrix
[
probePointCounter
+
1
*
a_bed_
compensation_points
*
a_bed_compensation
_points
]
=
yProbe
;
eqnAMatrix
[
probePointCounter
+
2
*
a_bed_
compensation_points
*
a_bed_compensation
_points
]
=
1
;
eqnAMatrix
[
probePointCounter
+
0
*
a_bed_
leveling_points
*
a_bed_leveling
_points
]
=
xProbe
;
eqnAMatrix
[
probePointCounter
+
1
*
a_bed_
leveling_points
*
a_bed_leveling
_points
]
=
yProbe
;
eqnAMatrix
[
probePointCounter
+
2
*
a_bed_
leveling_points
*
a_bed_leveling
_points
]
=
1
;
probePointCounter
++
;
xProbe
+=
xInc
;
}
...
...
@@ -2400,7 +2400,7 @@ void process_commands()
clean_up_after_endstop_move
();
// solve lsq problem
double
*
plane_equation_coefficients
=
qr_solve
(
a_bed_
compensation_points
*
a_bed_compensation
_points
,
3
,
eqnAMatrix
,
eqnBVector
);
double
*
plane_equation_coefficients
=
qr_solve
(
a_bed_
leveling_points
*
a_bed_leveling
_points
,
3
,
eqnAMatrix
,
eqnBVector
);
SERIAL_PROTOCOLPGM
(
"Eqn coefficients: a: "
);
SERIAL_PROTOCOL
(
plane_equation_coefficients
[
0
]);
...
...
@@ -2414,7 +2414,7 @@ void process_commands()
free
(
plane_equation_coefficients
);
#else // AUTO_BED_
COMPENSATION
_GRID not defined
#else // AUTO_BED_
LEVELING
_GRID not defined
// Probe at 3 arbitrary points
// probe 1
...
...
@@ -2430,7 +2430,7 @@ void process_commands()
set_bed_level_equation_3pts
(
z_at_pt_1
,
z_at_pt_2
,
z_at_pt_3
);
#endif // AUTO_BED_
COMPENSATION
_GRID
#endif // AUTO_BED_
LEVELING
_GRID
st_synchronize
();
// The following code correct the Z height difference from z-probe position and hotend tip position.
...
...
@@ -2441,7 +2441,7 @@ void process_commands()
y_tmp
=
current_position
[
Y_AXIS
]
+
Y_PROBE_OFFSET_FROM_EXTRUDER
;
z_tmp
=
current_position
[
Z_AXIS
];
apply_rotation_xyz
(
plan_bed_
compensation
_matrix
,
x_tmp
,
y_tmp
,
z_tmp
);
//Apply the correction sending the probe offset
apply_rotation_xyz
(
plan_bed_
level
_matrix
,
x_tmp
,
y_tmp
,
z_tmp
);
//Apply the correction sending the probe offset
current_position
[
Z_AXIS
]
=
z_tmp
-
real_z
+
current_position
[
Z_AXIS
];
//The difference is added to current position and sent to planner.
plan_set_position
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
]);
#ifdef Z_PROBE_SLED
...
...
@@ -2483,7 +2483,7 @@ void process_commands()
dock_sled
(
false
);
break
;
#endif // Z_PROBE_SLED
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#ifdef DELTA
case
29
:
// G29 Calibrate print surface with automatic Z probe.
...
...
@@ -3271,7 +3271,7 @@ void process_commands()
}
break
;
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
#ifdef Z_PROBE_REPEATABILITY_TEST
case
49
:
// M49 Z-Probe repeatability
{
...
...
@@ -3347,7 +3347,7 @@ void process_commands()
//
st_synchronize
();
plan_bed_
compensation
_matrix
.
set_to_identity
();
plan_bed_
level
_matrix
.
set_to_identity
();
plan_buffer_line
(
X_current
,
Y_current
,
Z_start_location
,
ext_position
,
homing_feedrate
[
Z_AXIS
]
/
60
,
...
...
@@ -3525,7 +3525,7 @@ Sigma_Exit:
break
;
}
#endif // Z_PROBE_REPEATABILITY_TEST
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
case
104
:
// M104
if
(
setTargetedHotend
(
104
))
break
;
...
...
@@ -4088,7 +4088,7 @@ Sigma_Exit:
#endif
break
;
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
case
666
:
// M666 Set Z probe offset
if
(
code_seen
(
'P'
))
{
zprobe_zoffset
=
code_value
();
...
...
@@ -4098,7 +4098,7 @@ Sigma_Exit:
SERIAL_ECHOLN
(
""
);
}
break
;
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#ifdef DELTA
case
666
:
// M666 set delta endstop and geometry adjustment
...
...
@@ -4393,11 +4393,11 @@ Sigma_Exit:
if
(
code_seen
(
'S'
))
{
servo_position
=
code_value
();
if
((
servo_index
>=
0
)
&&
(
servo_index
<
NUM_SERVOS
))
{
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos
[
servo_index
].
attach
(
0
);
#endif
servos
[
servo_index
].
write
(
servo_position
);
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay
(
PROBE_SERVO_DEACTIVATION_DELAY
);
servos
[
servo_index
].
detach
();
#endif
...
...
@@ -4671,7 +4671,7 @@ Sigma_Exit:
}
break
;
#if defined(ENABLE_AUTO_BED_
COMPENSATION
) && defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0) && not defined(Z_PROBE_SLED)
#if defined(ENABLE_AUTO_BED_
LEVELING
) && defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0) && not defined(Z_PROBE_SLED)
case
401
:
{
engage_z_probe
();
// Engage Z Servo endstop if available
...
...
@@ -4682,7 +4682,7 @@ Sigma_Exit:
retract_z_probe
();
// Retract Z Servo endstop if enabled
}
break
;
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#ifdef FILAMENT_SENSOR
case
404
:
//M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
...
...
MarlinKimbra/Servo.cpp
View file @
77c86772
...
...
@@ -262,7 +262,7 @@ uint8_t Servo::attach(int pin)
uint8_t
Servo
::
attach
(
int
pin
,
int
min
,
int
max
)
{
if
(
this
->
servoIndex
<
MAX_SERVOS
)
{
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if
(
pin
>
0
)
this
->
pin
=
pin
;
else
pin
=
this
->
pin
;
#endif
pinMode
(
pin
,
OUTPUT
)
;
// set servo pin to output
...
...
MarlinKimbra/Servo.h
View file @
77c86772
...
...
@@ -123,7 +123,7 @@ public:
int
read
();
// returns current pulse width as an angle between 0 and 180 degrees
int
readMicroseconds
();
// returns current pulse width in microseconds for this servo (was read_us() in first release)
bool
attached
();
// return true if this servo is attached, otherwise false
#if defined (ENABLE_AUTO_BED_
COMPENSATION
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_
LEVELING
) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
int
pin
;
// store the hardware pin of the servo
#endif
private
:
...
...
MarlinKimbra/planner.cpp
View file @
77c86772
...
...
@@ -76,14 +76,14 @@ float max_e_jerk;
float
mintravelfeedrate
;
unsigned
long
axis_steps_per_sqr_second
[
NUM_AXIS
];
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
// this holds the required transform to compensate for bed level
matrix_3x3
plan_bed_
compensation
_matrix
=
{
matrix_3x3
plan_bed_
level
_matrix
=
{
1.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
1.0
,
};
#endif // #ifdef ENABLE_AUTO_BED_
COMPENSATION
#endif // #ifdef ENABLE_AUTO_BED_
LEVELING
// The current position of the tool in absolute steps
long
position
[
4
];
//rescaled from extern when axis_steps_per_unit are changed by gcode
...
...
@@ -543,11 +543,11 @@ float junction_deviation = 0.1;
// Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// calculation the caller must also provide the physical length of the line in millimeters.
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
void
plan_buffer_line
(
float
x
,
float
y
,
float
z
,
const
float
&
e
,
float
feed_rate
,
const
uint8_t
&
extruder
,
const
uint8_t
&
driver
)
#else
void
plan_buffer_line
(
const
float
&
x
,
const
float
&
y
,
const
float
&
z
,
const
float
&
e
,
float
feed_rate
,
const
uint8_t
&
extruder
,
const
uint8_t
&
driver
)
#endif //ENABLE_AUTO_BED_
COMPENSATION
#endif //ENABLE_AUTO_BED_
LEVELING
{
// Calculate the buffer head after we push this byte
int
next_buffer_head
=
next_block_index
(
block_buffer_head
);
...
...
@@ -561,9 +561,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
lcd_update
();
}
#ifdef ENABLE_AUTO_BED_
COMPENSATION
apply_rotation_xyz
(
plan_bed_
compensation
_matrix
,
x
,
y
,
z
);
#endif // ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
apply_rotation_xyz
(
plan_bed_
level
_matrix
,
x
,
y
,
z
);
#endif // ENABLE_AUTO_BED_
LEVELING
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
...
...
@@ -1082,29 +1082,29 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
st_wake_up
();
}
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
vector_3
plan_get_position
()
{
vector_3
position
=
vector_3
(
st_get_position_mm
(
X_AXIS
),
st_get_position_mm
(
Y_AXIS
),
st_get_position_mm
(
Z_AXIS
));
//position.debug("in plan_get position");
//plan_bed_
compensation
_matrix.debug("in plan_get bed_level");
matrix_3x3
inverse
=
matrix_3x3
::
transpose
(
plan_bed_
compensation
_matrix
);
//plan_bed_
level
_matrix.debug("in plan_get bed_level");
matrix_3x3
inverse
=
matrix_3x3
::
transpose
(
plan_bed_
level
_matrix
);
//inverse.debug("in plan_get inverse");
position
.
apply_rotation
(
inverse
);
//position.debug("after rotation");
return
position
;
}
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
void
plan_set_position
(
float
x
,
float
y
,
float
z
,
const
float
&
e
)
{
apply_rotation_xyz
(
plan_bed_
compensation
_matrix
,
x
,
y
,
z
);
apply_rotation_xyz
(
plan_bed_
level
_matrix
,
x
,
y
,
z
);
#else
void
plan_set_position
(
const
float
&
x
,
const
float
&
y
,
const
float
&
z
,
const
float
&
e
)
{
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
position
[
X_AXIS
]
=
lround
(
x
*
axis_steps_per_unit
[
X_AXIS
]);
position
[
Y_AXIS
]
=
lround
(
y
*
axis_steps_per_unit
[
Y_AXIS
]);
...
...
MarlinKimbra/planner.h
View file @
77c86772
...
...
@@ -26,9 +26,9 @@
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
#include "vector_3.h"
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active.
...
...
@@ -75,10 +75,10 @@ typedef struct {
}
block_t
;
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
// this holds the required transform to compensate for bed level
extern
matrix_3x3
plan_bed_
compensation
_matrix
;
#endif // #ifdef ENABLE_AUTO_BED_
COMPENSATION
extern
matrix_3x3
plan_bed_
level
_matrix
;
#endif // #ifdef ENABLE_AUTO_BED_
LEVELING
// Initialize the motion plan subsystem
void
plan_init
();
...
...
@@ -86,21 +86,21 @@ void plan_init();
// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in
// millimaters. Feed rate specifies the speed of the motion.
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
void
plan_buffer_line
(
float
x
,
float
y
,
float
z
,
const
float
&
e
,
float
feed_rate
,
const
uint8_t
&
extruder
,
const
uint8_t
&
driver
);
// Get the position applying the bed level matrix if enabled
vector_3
plan_get_position
();
#else
void
plan_buffer_line
(
const
float
&
x
,
const
float
&
y
,
const
float
&
z
,
const
float
&
e
,
float
feed_rate
,
const
uint8_t
&
extruder
,
const
uint8_t
&
driver
);
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
// Set position. Used for G92 instructions.
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
void
plan_set_position
(
float
x
,
float
y
,
float
z
,
const
float
&
e
);
#else
void
plan_set_position
(
const
float
&
x
,
const
float
&
y
,
const
float
&
z
,
const
float
&
e
);
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
void
plan_set_e_position
(
const
float
&
e
);
...
...
MarlinKimbra/qr_solve.cpp
View file @
77c86772
#include "qr_solve.h"
#ifdef AUTO_BED_
COMPENSATION
_GRID
#ifdef AUTO_BED_
LEVELING
_GRID
#include <stdlib.h>
#include <math.h>
...
...
MarlinKimbra/qr_solve.h
View file @
77c86772
#include "Configuration.h"
#ifdef AUTO_BED_
COMPENSATION
_GRID
#ifdef AUTO_BED_
LEVELING
_GRID
void
daxpy
(
int
n
,
double
da
,
double
dx
[],
int
incx
,
double
dy
[],
int
incy
);
double
ddot
(
int
n
,
double
dx
[],
int
incx
,
double
dy
[],
int
incy
);
...
...
MarlinKimbra/stepper.cpp
View file @
77c86772
...
...
@@ -1180,13 +1180,13 @@ long st_get_position(uint8_t axis)
return
count_pos
;
}
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
float
st_get_position_mm
(
uint8_t
axis
)
{
float
steper_position_in_steps
=
st_get_position
(
axis
);
return
steper_position_in_steps
/
axis_steps_per_unit
[
axis
];
}
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
void
finishAndDisableSteppers
()
{
...
...
MarlinKimbra/stepper.h
View file @
77c86772
...
...
@@ -65,10 +65,10 @@ void st_set_e_position(const long &e);
// Get current position in steps
long
st_get_position
(
uint8_t
axis
);
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
// Get current position in mm
float
st_get_position_mm
(
uint8_t
axis
);
#endif //ENABLE_AUTO_BED_
COMPENSATION
#endif //ENABLE_AUTO_BED_
LEVELING
// The stepper subsystem goes to sleep when it runs out of things to execute. Call this
// to notify the subsystem that it is time to go to work.
...
...
MarlinKimbra/ultralcd.cpp
View file @
77c86772
...
...
@@ -1107,7 +1107,7 @@ static void lcd_control_motion_menu()
{
START_MENU
();
MENU_ITEM
(
back
,
MSG_CONTROL
,
lcd_control_menu
);
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
MENU_ITEM_EDIT
(
float32
,
MSG_ZPROBE_ZOFFSET
,
&
zprobe_zoffset
,
0.5
,
50
);
#endif
MENU_ITEM_EDIT
(
float5
,
MSG_ACC
,
&
acceleration
,
500
,
99000
);
...
...
MarlinKimbra/vector_3.cpp
View file @
77c86772
...
...
@@ -19,7 +19,7 @@
#include <math.h>
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
#include "vector_3.h"
vector_3
::
vector_3
()
:
x
(
0
),
y
(
0
),
z
(
0
)
{
}
...
...
@@ -163,5 +163,5 @@ void matrix_3x3::debug(char* title)
}
}
#endif // #ifdef ENABLE_AUTO_BED_
COMPENSATION
#endif // #ifdef ENABLE_AUTO_BED_
LEVELING
MarlinKimbra/vector_3.h
View file @
77c86772
...
...
@@ -19,7 +19,7 @@
#ifndef VECTOR_3_H
#define VECTOR_3_H
#ifdef ENABLE_AUTO_BED_
COMPENSATION
#ifdef ENABLE_AUTO_BED_
LEVELING
class
matrix_3x3
;
struct
vector_3
...
...
@@ -57,6 +57,6 @@ struct matrix_3x3
void
apply_rotation_xyz
(
matrix_3x3
rotationMatrix
,
float
&
x
,
float
&
y
,
float
&
z
);
#endif // ENABLE_AUTO_BED_
COMPENSATION
#endif // ENABLE_AUTO_BED_
LEVELING
#endif // VECTOR_3_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment