Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
04007834
Commit
04007834
authored
Dec 19, 2019
by
Scott Lahteine
Browse files
Options
Downloads
Patches
Plain Diff
Tweak G34, fix a declaration
parent
768a1d27
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Marlin/src/gcode/calibrate/G34_M422.cpp
+17
-14
17 additions, 14 deletions
Marlin/src/gcode/calibrate/G34_M422.cpp
with
17 additions
and
14 deletions
Marlin/src/gcode/calibrate/G34_M422.cpp
+
17
−
14
View file @
04007834
...
...
@@ -61,13 +61,16 @@ constexpr xy_pos_t sanity_arr_z_align[] = Z_STEPPER_ALIGN_XY;
);
#endif
static
xy_pos_t
z_auto_align_pos
[
Z_STEPPER_COUNT
]
=
Z_STEPPER_ALIGN_XY
;
//
// G34 / M422 shared data
//
static
xy_pos_t
z_stepper_align_pos
[]
=
Z_STEPPER_ALIGN_XY
;
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
static
xy_pos_t
z_stepper_pos
[]
=
Z_STEPPER_ALIGN_STEPPER_XY
;
static
xy_pos_t
z_stepper_
align_stepper_
pos
[]
=
Z_STEPPER_ALIGN_STEPPER_XY
;
#endif
#define G34_PROBE_COUNT COUNT(z_
auto
_align_pos)
#define G34_PROBE_COUNT COUNT(z_
stepper
_align_pos)
inline
void
set_all_z_lock
(
const
bool
lock
)
{
stepper
.
set_z_lock
(
lock
);
...
...
@@ -155,11 +158,11 @@ void GcodeSuite::G34() {
// iteration this will be re-calculated based on the actual bed position
float
z_probe
=
Z_BASIC_CLEARANCE
+
(
G34_MAX_GRADE
)
*
0.01f
*
(
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
SQRT
(
_MAX
(
HYPOT2
(
z_
auto
_align_pos
[
0
].
x
-
z_
auto
_align_pos
[
0
].
y
,
z_
auto
_align_pos
[
1
].
x
-
z_
auto
_align_pos
[
1
].
y
),
HYPOT2
(
z_
auto
_align_pos
[
1
].
x
-
z_
auto
_align_pos
[
1
].
y
,
z_
auto
_align_pos
[
2
].
x
-
z_
auto
_align_pos
[
2
].
y
),
HYPOT2
(
z_
auto
_align_pos
[
2
].
x
-
z_
auto
_align_pos
[
2
].
y
,
z_
auto
_align_pos
[
0
].
x
-
z_
auto
_align_pos
[
0
].
y
)))
SQRT
(
_MAX
(
HYPOT2
(
z_
stepper
_align_pos
[
0
].
x
-
z_
stepper
_align_pos
[
0
].
y
,
z_
stepper
_align_pos
[
1
].
x
-
z_
stepper
_align_pos
[
1
].
y
),
HYPOT2
(
z_
stepper
_align_pos
[
1
].
x
-
z_
stepper
_align_pos
[
1
].
y
,
z_
stepper
_align_pos
[
2
].
x
-
z_
stepper
_align_pos
[
2
].
y
),
HYPOT2
(
z_
stepper
_align_pos
[
2
].
x
-
z_
stepper
_align_pos
[
2
].
y
,
z_
stepper
_align_pos
[
0
].
x
-
z_
stepper
_align_pos
[
0
].
y
)))
#else
HYPOT
(
z_
auto
_align_pos
[
0
].
x
-
z_
auto
_align_pos
[
0
].
y
,
z_
auto
_align_pos
[
1
].
x
-
z_
auto
_align_pos
[
1
].
y
)
HYPOT
(
z_
stepper
_align_pos
[
0
].
x
-
z_
stepper
_align_pos
[
0
].
y
,
z_
stepper
_align_pos
[
1
].
x
-
z_
stepper
_align_pos
[
1
].
y
)
#endif
);
...
...
@@ -194,7 +197,7 @@ void GcodeSuite::G34() {
if
(
iteration
==
0
||
i
>
0
)
do_blocking_move_to_z
(
z_probe
);
// Probe a Z height for each stepper.
const
float
z_probed_height
=
probe_at_point
(
z_
auto
_align_pos
[
iprobe
],
raise_after
,
0
,
true
);
const
float
z_probed_height
=
probe_at_point
(
z_
stepper
_align_pos
[
iprobe
],
raise_after
,
0
,
true
);
if
(
isnan
(
z_probed_height
))
{
SERIAL_ECHOLNPGM
(
"Probing failed."
);
err_break
=
true
;
...
...
@@ -235,13 +238,13 @@ void GcodeSuite::G34() {
incremental_LSF_reset
(
&
lfd
);
for
(
uint8_t
i
=
0
;
i
<
G34_PROBE_COUNT
;
++
i
)
{
SERIAL_ECHOLNPAIR
(
"PROBEPT_"
,
int
(
i
+
1
),
": "
,
z_measured
[
i
]);
incremental_LSF
(
&
lfd
,
z_
auto
_align_pos
[
i
],
z_measured
[
i
]);
incremental_LSF
(
&
lfd
,
z_
stepper
_align_pos
[
i
],
z_measured
[
i
]);
}
finish_incremental_LSF
(
&
lfd
);
z_measured_min
=
100000.0f
;
for
(
uint8_t
i
=
0
;
i
<
Z_STEPPER_COUNT
;
++
i
)
{
z_measured
[
i
]
=
-
(
lfd
.
A
*
z_stepper_pos
[
i
].
x
+
lfd
.
B
*
z_stepper_pos
[
i
].
y
);
z_measured
[
i
]
=
-
(
lfd
.
A
*
z_stepper_
align_stepper_
pos
[
i
].
x
+
lfd
.
B
*
z_stepper_
align_stepper_
pos
[
i
].
y
);
z_measured_min
=
_MIN
(
z_measured_min
,
z_measured
[
i
]);
}
...
...
@@ -362,10 +365,10 @@ void GcodeSuite::G34() {
void
GcodeSuite
::
M422
()
{
if
(
!
parser
.
seen_any
())
{
for
(
uint8_t
i
=
0
;
i
<
G34_PROBE_COUNT
;
++
i
)
SERIAL_ECHOLNPAIR_P
(
PSTR
(
"M422 S"
),
i
+
1
,
SP_X_STR
,
z_
auto
_align_pos
[
i
].
x
,
SP_Y_STR
,
z_
auto
_align_pos
[
i
].
y
);
SERIAL_ECHOLNPAIR_P
(
PSTR
(
"M422 S"
),
i
+
1
,
SP_X_STR
,
z_
stepper
_align_pos
[
i
].
x
,
SP_Y_STR
,
z_
stepper
_align_pos
[
i
].
y
);
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
for
(
uint8_t
i
=
0
;
i
<
Z_STEPPER_COUNT
;
++
i
)
SERIAL_ECHOLNPAIR_P
(
PSTR
(
"M422 W"
),
i
+
1
,
SP_X_STR
,
z_stepper_pos
[
i
].
x
,
SP_Y_STR
,
z_stepper_pos
[
i
].
y
);
SERIAL_ECHOLNPAIR_P
(
PSTR
(
"M422 W"
),
i
+
1
,
SP_X_STR
,
z_stepper_
align_stepper_
pos
[
i
].
x
,
SP_Y_STR
,
z_stepper_
align_stepper_
pos
[
i
].
y
);
#endif
return
;
}
...
...
@@ -381,9 +384,9 @@ void GcodeSuite::M422() {
xy_pos_t
*
pos_dest
=
(
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
!
is_probe_point
?
z_stepper_pos
:
!
is_probe_point
?
z_stepper_
align_stepper_
pos
:
#endif
z_
auto
_align_pos
z_
stepper
_align_pos
);
if
(
!
is_probe_point
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment