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
03bb009c
Commit
03bb009c
authored
Feb 15, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update marlin_main.cpp
parent
4c0bb63b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
26 deletions
+27
-26
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+26
-25
pins.h
MarlinKimbra/pins.h
+1
-1
No files found.
MarlinKimbra/Marlin_main.cpp
View file @
03bb009c
...
@@ -2339,6 +2339,7 @@ inline void gcode_G28() {
...
@@ -2339,6 +2339,7 @@ inline void gcode_G28() {
#ifdef ENABLE_AUTO_BED_LEVELING
#ifdef ENABLE_AUTO_BED_LEVELING
// G29: Detailed Z-Probe, probes the bed at 3 or more points.
// G29: Detailed Z-Probe, probes the bed at 3 or more points.
// Will fail if the printer has not been homed with G28.
// Will fail if the printer has not been homed with G28.
// Override probing area by providing [F]ront [B]ack [L]eft [R]ight Grid[P]oints values
inline
void
gcode_G29
()
{
inline
void
gcode_G29
()
{
float
x_tmp
,
y_tmp
,
z_tmp
,
real_z
;
float
x_tmp
,
y_tmp
,
z_tmp
,
real_z
;
...
@@ -2370,27 +2371,27 @@ inline void gcode_G28() {
...
@@ -2370,27 +2371,27 @@ inline void gcode_G28() {
feedrate
=
homing_feedrate
[
Z_AXIS
];
feedrate
=
homing_feedrate
[
Z_AXIS
];
#ifdef AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
int
r_probe_bed_position
=
RIGHT_PROBE_BED_POSITION
;
int
r
ight
_probe_bed_position
=
RIGHT_PROBE_BED_POSITION
;
int
l_probe_bed_position
=
LEFT_PROBE_BED_POSITION
;
int
l
eft
_probe_bed_position
=
LEFT_PROBE_BED_POSITION
;
int
f_probe_bed_position
=
FRONT_PROBE_BED_POSITION
;
int
f
ront
_probe_bed_position
=
FRONT_PROBE_BED_POSITION
;
int
b_probe_bed_position
=
BACK_PROBE_BED_POSITION
;
int
b
ack
_probe_bed_position
=
BACK_PROBE_BED_POSITION
;
int
a_bed_leveling_points
=
AUTO_BED_LEVELING_GRID_POINTS
;
int
a
uto
_bed_leveling_points
=
AUTO_BED_LEVELING_GRID_POINTS
;
if
(
code_seen
(
'R'
))
r_probe_bed_position
=
code_value
();
if
(
code_seen
(
'R'
))
r
ight
_probe_bed_position
=
code_value
();
if
(
code_seen
(
'L'
))
l_probe_bed_position
=
code_value
();
if
(
code_seen
(
'L'
))
l
eft
_probe_bed_position
=
code_value
();
if
(
code_seen
(
'F'
))
f_probe_bed_position
=
code_value
();
if
(
code_seen
(
'F'
))
f
ront
_probe_bed_position
=
code_value
();
if
(
code_seen
(
'B'
))
b_probe_bed_position
=
code_value
();
if
(
code_seen
(
'B'
))
b
ack
_probe_bed_position
=
code_value
();
if
(
code_seen
(
'A'
))
a_bed_leveling_points
=
code_value
();
if
(
code_seen
(
'A'
))
a
uto
_bed_leveling_points
=
code_value
();
if
((
f
_probe_bed_position
==
b_probe_bed_position
)
||
(
r_probe_bed_position
==
l
_probe_bed_position
))
{
if
((
f
ront_probe_bed_position
==
back_probe_bed_position
)
||
(
right_probe_bed_position
==
left
_probe_bed_position
))
{
SERIAL_ERROR_START
;
SERIAL_ERROR_START
;
SERIAL_ERRORLNPGM
(
MSG_EMPTY_PLANE
);
SERIAL_ERRORLNPGM
(
MSG_EMPTY_PLANE
);
return
;
return
;
}
}
// probe at the points of a lattice grid
// probe at the points of a lattice grid
int
xGridSpacing
=
(
r
_probe_bed_position
-
l_probe_bed_position
)
/
(
a
_bed_leveling_points
-
1
);
int
xGridSpacing
=
(
r
ight_probe_bed_position
-
left_probe_bed_position
)
/
(
auto
_bed_leveling_points
-
1
);
int
yGridSpacing
=
(
b
_probe_bed_position
-
f_probe_bed_position
)
/
(
a
_bed_leveling_points
-
1
);
int
yGridSpacing
=
(
b
ack_probe_bed_position
-
front_probe_bed_position
)
/
(
auto
_bed_leveling_points
-
1
);
// solve the plane equation ax + by + d = z
// solve the plane equation ax + by + d = z
// A is the matrix with rows [x y 1] for all the probed points
// A is the matrix with rows [x y 1] for all the probed points
...
@@ -2399,29 +2400,29 @@ inline void gcode_G28() {
...
@@ -2399,29 +2400,29 @@ inline void gcode_G28() {
// so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
// so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
// "A" matrix of the linear system of equations
// "A" matrix of the linear system of equations
double
eqnAMatrix
[
a
_bed_leveling_points
*
a
_bed_leveling_points
*
3
];
double
eqnAMatrix
[
a
uto_bed_leveling_points
*
auto
_bed_leveling_points
*
3
];
// "B" vector of Z points
// "B" vector of Z points
double
eqnBVector
[
a
_bed_leveling_points
*
a
_bed_leveling_points
];
double
eqnBVector
[
a
uto_bed_leveling_points
*
auto
_bed_leveling_points
];
int
probePointCounter
=
0
;
int
probePointCounter
=
0
;
bool
zig
=
true
;
bool
zig
=
true
;
for
(
int
yProbe
=
f
_probe_bed_position
;
yProbe
<=
b
_probe_bed_position
;
yProbe
+=
yGridSpacing
)
{
for
(
int
yProbe
=
f
ront_probe_bed_position
;
yProbe
<=
back
_probe_bed_position
;
yProbe
+=
yGridSpacing
)
{
int
xProbe
,
xInc
;
int
xProbe
,
xInc
;
if
(
zig
)
{
//zig
if
(
zig
)
{
//zig
xProbe
=
l_probe_bed_position
;
xProbe
=
l
eft
_probe_bed_position
;
//xEnd = RIGHT_PROBE_BED_POSITION;
//xEnd = RIGHT_PROBE_BED_POSITION;
xInc
=
xGridSpacing
;
xInc
=
xGridSpacing
;
zig
=
false
;
zig
=
false
;
}
}
else
{
//zag
else
{
//zag
xProbe
=
r_probe_bed_position
;
xProbe
=
r
ight
_probe_bed_position
;
//xEnd = LEFT_PROBE_BED_POSITION;
//xEnd = LEFT_PROBE_BED_POSITION;
xInc
=
-
xGridSpacing
;
xInc
=
-
xGridSpacing
;
zig
=
true
;
zig
=
true
;
}
}
for
(
int
xCount
=
0
;
xCount
<
a_bed_leveling_points
;
xCount
++
)
{
for
(
int
xCount
=
0
;
xCount
<
a
uto
_bed_leveling_points
;
xCount
++
)
{
float
z_before
;
float
z_before
;
if
(
probePointCounter
==
0
)
{
if
(
probePointCounter
==
0
)
{
// raise before probing
// raise before probing
...
@@ -2434,9 +2435,9 @@ inline void gcode_G28() {
...
@@ -2434,9 +2435,9 @@ inline void gcode_G28() {
float
measured_z
=
probe_pt
(
xProbe
,
yProbe
,
z_before
);
float
measured_z
=
probe_pt
(
xProbe
,
yProbe
,
z_before
);
eqnBVector
[
probePointCounter
]
=
measured_z
;
eqnBVector
[
probePointCounter
]
=
measured_z
;
eqnAMatrix
[
probePointCounter
+
0
*
a
_bed_leveling_points
*
a
_bed_leveling_points
]
=
xProbe
;
eqnAMatrix
[
probePointCounter
+
0
*
a
uto_bed_leveling_points
*
auto
_bed_leveling_points
]
=
xProbe
;
eqnAMatrix
[
probePointCounter
+
1
*
a
_bed_leveling_points
*
a
_bed_leveling_points
]
=
yProbe
;
eqnAMatrix
[
probePointCounter
+
1
*
a
uto_bed_leveling_points
*
auto
_bed_leveling_points
]
=
yProbe
;
eqnAMatrix
[
probePointCounter
+
2
*
a
_bed_leveling_points
*
a
_bed_leveling_points
]
=
1
;
eqnAMatrix
[
probePointCounter
+
2
*
a
uto_bed_leveling_points
*
auto
_bed_leveling_points
]
=
1
;
probePointCounter
++
;
probePointCounter
++
;
xProbe
+=
xInc
;
xProbe
+=
xInc
;
}
}
...
@@ -2444,7 +2445,7 @@ inline void gcode_G28() {
...
@@ -2444,7 +2445,7 @@ inline void gcode_G28() {
clean_up_after_endstop_move
();
clean_up_after_endstop_move
();
// solve lsq problem
// solve lsq problem
double
*
plane_equation_coefficients
=
qr_solve
(
a
_bed_leveling_points
*
a
_bed_leveling_points
,
3
,
eqnAMatrix
,
eqnBVector
);
double
*
plane_equation_coefficients
=
qr_solve
(
a
uto_bed_leveling_points
*
auto
_bed_leveling_points
,
3
,
eqnAMatrix
,
eqnBVector
);
SERIAL_PROTOCOLPGM
(
"Eqn coefficients: a: "
);
SERIAL_PROTOCOLPGM
(
"Eqn coefficients: a: "
);
SERIAL_PROTOCOL
(
plane_equation_coefficients
[
0
]);
SERIAL_PROTOCOL
(
plane_equation_coefficients
[
0
]);
...
...
MarlinKimbra/pins.h
View file @
03bb009c
...
@@ -3221,7 +3221,7 @@
...
@@ -3221,7 +3221,7 @@
#define Z_STEP_PIN 46
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 6
2
#define Z_ENABLE_PIN 6
3
#define Z_MIN_PIN 18
#define Z_MIN_PIN 18
#define Z_MAX_PIN -1
#define Z_MAX_PIN -1
...
...
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