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
f58eb391
Commit
f58eb391
authored
Dec 9, 2017
by
Roxy-3D
Committed by
Scott Lahteine
Dec 9, 2017
Browse files
Options
Downloads
Patches
Plain Diff
[2.0.0] Better off mesh behavior for UBL (#8714)
* Better off mesh behaviour for UBL * Suggested ubl.h changes
parent
cffd052f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
+1
-1
1 addition, 1 deletion
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
Marlin/src/feature/bedlevel/ubl/ubl.h
+14
-24
14 additions, 24 deletions
Marlin/src/feature/bedlevel/ubl/ubl.h
with
15 additions
and
25 deletions
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
+
1
−
1
View file @
f58eb391
...
...
@@ -973,7 +973,7 @@
//========================= Unified Bed Leveling ============================
//===========================================================================
//
#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh
#define MESH_EDIT_GFX_OVERLAY
// Display a graphics overlay while editing the mesh
#define MESH_INSET 45 // Mesh inset margin on print area
#define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited.
...
...
...
...
This diff is collapsed.
Click to expand it.
Marlin/src/feature/bedlevel/ubl/ubl.h
+
14
−
24
View file @
f58eb391
...
...
@@ -200,10 +200,10 @@ class unified_bed_leveling {
* the case where the printer is making a vertical line that only crosses horizontal mesh lines.
*/
inline
static
float
z_correction_for_x_on_horizontal_mesh_line
(
const
float
&
rx0
,
const
int
x1_i
,
const
int
yi
)
{
if
(
!
WITHIN
(
x1_i
,
0
,
GRID_MAX_POINTS_X
-
2
)
||
!
WITHIN
(
yi
,
0
,
GRID_MAX_POINTS_Y
-
1
))
{
if
(
!
WITHIN
(
x1_i
,
0
,
GRID_MAX_POINTS_X
-
1
)
||
!
WITHIN
(
yi
,
0
,
GRID_MAX_POINTS_Y
-
1
))
{
#if ENABLED(DEBUG_LEVELING_FEATURE)
if
(
DEBUGGING
(
LEVELING
))
{
serialprintPGM
(
!
WITHIN
(
x1_i
,
0
,
GRID_MAX_POINTS_X
-
1
)
?
PSTR
(
"x1
l
_i"
)
:
PSTR
(
"yi"
)
);
serialprintPGM
(
!
WITHIN
(
x1_i
,
0
,
GRID_MAX_POINTS_X
-
1
)
?
PSTR
(
"x1_i"
)
:
PSTR
(
"yi"
)
);
SERIAL_ECHOPAIR
(
" out of bounds in z_correction_for_x_on_horizontal_mesh_line(rx0="
,
rx0
);
SERIAL_ECHOPAIR
(
",x1_i="
,
x1_i
);
SERIAL_ECHOPAIR
(
",yi="
,
yi
);
...
...
@@ -217,17 +217,19 @@ class unified_bed_leveling {
const
float
xratio
=
(
rx0
-
mesh_index_to_xpos
(
x1_i
))
*
(
1.0
/
(
MESH_X_DIST
)),
z1
=
z_values
[
x1_i
][
yi
];
return
z1
+
xratio
*
(
z_values
[
x1_i
+
1
][
yi
]
-
z1
);
return
z1
+
xratio
*
(
z_values
[
min
(
x1_i
,
GRID_MAX_POINTS_X
-
2
)
+
1
][
yi
]
-
z1
);
// Don't allow x1_i+1 to be past the end of the array
// If it is, it is clamped to the last element of the
// z_values[][] array and no correction is applied.
}
//
// See comments above for z_correction_for_x_on_horizontal_mesh_line
//
inline
static
float
z_correction_for_y_on_vertical_mesh_line
(
const
float
&
ry0
,
const
int
xi
,
const
int
y1_i
)
{
if
(
!
WITHIN
(
xi
,
0
,
GRID_MAX_POINTS_X
-
1
)
||
!
WITHIN
(
y1_i
,
0
,
GRID_MAX_POINTS_Y
-
2
))
{
if
(
!
WITHIN
(
xi
,
0
,
GRID_MAX_POINTS_X
-
1
)
||
!
WITHIN
(
y1_i
,
0
,
GRID_MAX_POINTS_Y
-
1
))
{
#if ENABLED(DEBUG_LEVELING_FEATURE)
if
(
DEBUGGING
(
LEVELING
))
{
serialprintPGM
(
!
WITHIN
(
xi
,
0
,
GRID_MAX_POINTS_X
-
1
)
?
PSTR
(
"xi"
)
:
PSTR
(
"y
l
_i"
)
);
serialprintPGM
(
!
WITHIN
(
xi
,
0
,
GRID_MAX_POINTS_X
-
1
)
?
PSTR
(
"xi"
)
:
PSTR
(
"y
1
_i"
)
);
SERIAL_ECHOPAIR
(
" out of bounds in z_correction_for_y_on_vertical_mesh_line(ry0="
,
ry0
);
SERIAL_ECHOPAIR
(
", xi="
,
xi
);
SERIAL_ECHOPAIR
(
", y1_i="
,
y1_i
);
...
...
@@ -241,7 +243,9 @@ class unified_bed_leveling {
const
float
yratio
=
(
ry0
-
mesh_index_to_ypos
(
y1_i
))
*
(
1.0
/
(
MESH_Y_DIST
)),
z1
=
z_values
[
xi
][
y1_i
];
return
z1
+
yratio
*
(
z_values
[
xi
][
y1_i
+
1
]
-
z1
);
return
z1
+
yratio
*
(
z_values
[
xi
][
min
(
y1_i
,
GRID_MAX_POINTS_Y
-
2
)
+
1
]
-
z1
);
// Don't allow y1_i+1 to be past the end of the array
// If it is, it is clamped to the last element of the
// z_values[][] array and no correction is applied.
}
/**
...
...
@@ -252,29 +256,15 @@ class unified_bed_leveling {
*/
static
float
get_z_correction
(
const
float
&
rx0
,
const
float
&
ry0
)
{
const
int8_t
cx
=
get_cell_index_x
(
rx0
),
cy
=
get_cell_index_y
(
ry0
);
if
(
!
WITHIN
(
cx
,
0
,
GRID_MAX_POINTS_X
-
2
)
||
!
WITHIN
(
cy
,
0
,
GRID_MAX_POINTS_Y
-
2
))
{
SERIAL_ECHOPAIR
(
"? in get_z_correction(rx0="
,
rx0
);
SERIAL_ECHOPAIR
(
", ry0="
,
ry0
);
SERIAL_CHAR
(
')'
);
SERIAL_EOL
();
#if ENABLED(ULTRA_LCD)
strcpy
(
lcd_status_message
,
"get_z_correction() indexes out of range."
);
lcd_quick_feedback
();
#endif
return
NAN
;
}
cy
=
get_cell_index_y
(
ry0
);
// return values are clamped
const
float
z1
=
calc_z0
(
rx0
,
mesh_index_to_xpos
(
cx
),
z_values
[
cx
][
cy
],
mesh_index_to_xpos
(
cx
+
1
),
z_values
[
cx
+
1
][
cy
]);
mesh_index_to_xpos
(
cx
+
1
),
z_values
[
min
(
cx
,
GRID_MAX_POINTS_X
-
2
)
+
1
][
cy
]);
const
float
z2
=
calc_z0
(
rx0
,
mesh_index_to_xpos
(
cx
),
z_values
[
cx
][
cy
+
1
],
mesh_index_to_xpos
(
cx
+
1
),
z_values
[
cx
+
1
][
cy
+
1
]);
mesh_index_to_xpos
(
cx
),
z_values
[
cx
][
min
(
cy
,
GRID_MAX_POINTS_Y
-
2
)
+
1
],
mesh_index_to_xpos
(
cx
+
1
),
z_values
[
min
(
cx
,
GRID_MAX_POINTS_X
-
2
)
+
1
][
min
(
cy
,
GRID_MAX_POINTS_Y
-
2
)
+
1
]);
float
z0
=
calc_z0
(
ry0
,
mesh_index_to_ypos
(
cy
),
z1
,
...
...
...
...
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