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
f1c9d953
Commit
f1c9d953
authored
Feb 24, 2016
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update v4_2_6
parent
aa433876
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
36 deletions
+33
-36
planner.cpp
MK/module/motion/planner.cpp
+33
-36
No files found.
MK/module/motion/planner.cpp
View file @
f1c9d953
...
@@ -205,12 +205,11 @@ FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity
...
@@ -205,12 +205,11 @@ FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity
// "Junction jerk" in this context is the immediate change in speed at the junction of two blocks.
// "Junction jerk" in this context is the immediate change in speed at the junction of two blocks.
// This method will calculate the junction jerk as the euclidean distance between the nominal
// This method will calculate the junction jerk as the euclidean distance between the nominal
// velocities of the respective blocks.
// velocities of the respective blocks.
//inline float junction_jerk(block_t *before, block_t *after) {
//
inline float junction_jerk(block_t *before, block_t *after) {
// return sqrt(
// return sqrt(
// pow((before->speed_x-after->speed_x), 2)+pow((before->speed_y-after->speed_y), 2));
// pow((before->speed_x-after->speed_x), 2)+pow((before->speed_y-after->speed_y), 2));
//}
//}
// The kernel called by planner_recalculate() when scanning the plan from last to first entry.
// The kernel called by planner_recalculate() when scanning the plan from last to first entry.
void
planner_reverse_pass_kernel
(
block_t
*
previous
,
block_t
*
current
,
block_t
*
next
)
{
void
planner_reverse_pass_kernel
(
block_t
*
previous
,
block_t
*
current
,
block_t
*
next
)
{
if
(
!
current
)
return
;
if
(
!
current
)
return
;
...
@@ -359,7 +358,6 @@ void plan_init() {
...
@@ -359,7 +358,6 @@ void plan_init() {
previous_nominal_speed
=
0.0
;
previous_nominal_speed
=
0.0
;
}
}
#if ENABLED(AUTOTEMP)
#if ENABLED(AUTOTEMP)
void
getHighESpeed
()
{
void
getHighESpeed
()
{
static
float
oldt
=
0
;
static
float
oldt
=
0
;
...
@@ -479,7 +477,6 @@ void check_axes_activity() {
...
@@ -479,7 +477,6 @@ void check_axes_activity() {
#endif
#endif
}
}
float
junction_deviation
=
0.1
;
float
junction_deviation
=
0.1
;
// Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in
// Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
...
@@ -606,7 +603,7 @@ float junction_deviation = 0.1;
...
@@ -606,7 +603,7 @@ float junction_deviation = 0.1;
// For a mixing extruder, get steps for each
// For a mixing extruder, get steps for each
#if ENABLED(COLOR_MIXING_EXTRUDER)
#if ENABLED(COLOR_MIXING_EXTRUDER)
for
(
int8_t
i
=
0
;
i
<
DRIVER_EXTRUDERS
;
i
++
)
for
(
u
int8_t
i
=
0
;
i
<
DRIVER_EXTRUDERS
;
i
++
)
block
->
mix_steps
[
i
]
=
block
->
steps
[
E_AXIS
]
*
mixing_factor
[
i
];
block
->
mix_steps
[
i
]
=
block
->
steps
[
E_AXIS
]
*
mixing_factor
[
i
];
#endif
#endif
...
@@ -618,23 +615,23 @@ float junction_deviation = 0.1;
...
@@ -618,23 +615,23 @@ float junction_deviation = 0.1;
// Compute direction bits for this block
// Compute direction bits for this block
uint8_t
dirb
=
0
;
uint8_t
dirb
=
0
;
#if MECH(COREXY)
#if MECH(COREXY)
if
(
dx
<
0
)
dirb
|=
BIT
(
X_HEAD
);
// Save the real Extruder (head) direction in X Axis
if
(
dx
<
0
)
BITSET
(
dirb
,
X_HEAD
);
// Save the real Extruder (head) direction in X Axis
if
(
dy
<
0
)
dirb
|=
BIT
(
Y_HEAD
);
// ...and Y
if
(
dy
<
0
)
BITSET
(
dirb
,
Y_HEAD
);
// ...and Y
if
(
dz
<
0
)
dirb
|=
BIT
(
Z_AXIS
);
if
(
dz
<
0
)
BITSET
(
dirb
,
Z_AXIS
);
if
(
da
<
0
)
dirb
|=
BIT
(
A_AXIS
);
// Motor A direction
if
(
da
<
0
)
BITSET
(
dirb
,
A_AXIS
);
// Motor A direction
if
(
db
<
0
)
dirb
|=
BIT
(
B_AXIS
);
// Motor B direction
if
(
db
<
0
)
BITSET
(
dirb
,
B_AXIS
);
// Motor B direction
#elif MECH(COREXZ)
#elif MECH(COREXZ)
if
(
dx
<
0
)
dirb
|=
BIT
(
X_HEAD
);
// Save the real Extruder (head) direction in X Axis
if
(
dx
<
0
)
BITSET
(
dirb
,
X_HEAD
);
// Save the real Extruder (head) direction in X Axis
if
(
dy
<
0
)
dirb
|=
BIT
(
Y_AXIS
);
if
(
dy
<
0
)
BITSET
(
dirb
,
Y_AXIS
);
if
(
dz
<
0
)
dirb
|=
BIT
(
Z_HEAD
);
// ...and Z
if
(
dz
<
0
)
BITSET
(
dirb
,
Z_HEAD
);
// ...and Z
if
(
da
<
0
)
dirb
|=
BIT
(
A_AXIS
);
// Motor A direction
if
(
da
<
0
)
BITSET
(
dirb
,
A_AXIS
);
// Motor A direction
if
(
dc
<
0
)
dirb
|=
BIT
(
C_AXIS
);
// Motor B direction
if
(
dc
<
0
)
BITSET
(
dirb
,
C_AXIS
);
// Motor B direction
#else
#else
if
(
dx
<
0
)
dirb
|=
BIT
(
X_AXIS
);
if
(
dx
<
0
)
BITSET
(
dirb
,
X_AXIS
);
if
(
dy
<
0
)
dirb
|=
BIT
(
Y_AXIS
);
if
(
dy
<
0
)
BITSET
(
dirb
,
Y_AXIS
);
if
(
dz
<
0
)
dirb
|=
BIT
(
Z_AXIS
);
if
(
dz
<
0
)
BITSET
(
dirb
,
Z_AXIS
);
#endif
#endif
if
(
de
<
0
)
dirb
|=
BIT
(
E_AXIS
);
if
(
de
<
0
)
BITSET
(
dirb
,
E_AXIS
);
block
->
direction_bits
=
dirb
;
block
->
direction_bits
=
dirb
;
block
->
active_driver
=
driver
;
block
->
active_driver
=
driver
;
...
@@ -875,14 +872,14 @@ float junction_deviation = 0.1;
...
@@ -875,14 +872,14 @@ float junction_deviation = 0.1;
ys1
=
axis_segment_time
[
Y_AXIS
][
1
],
ys1
=
axis_segment_time
[
Y_AXIS
][
1
],
ys2
=
axis_segment_time
[
Y_AXIS
][
2
];
ys2
=
axis_segment_time
[
Y_AXIS
][
2
];
if
(
(
direction_change
&
BIT
(
X_AXIS
))
!=
0
)
{
if
(
TEST
(
direction_change
,
X_AXIS
)
)
{
xs2
=
axis_segment_time
[
X_AXIS
][
2
]
=
xs1
;
xs2
=
axis_segment_time
[
X_AXIS
][
2
]
=
xs1
;
xs1
=
axis_segment_time
[
X_AXIS
][
1
]
=
xs0
;
xs1
=
axis_segment_time
[
X_AXIS
][
1
]
=
xs0
;
xs0
=
0
;
xs0
=
0
;
}
}
xs0
=
axis_segment_time
[
X_AXIS
][
0
]
=
xs0
+
segment_time
;
xs0
=
axis_segment_time
[
X_AXIS
][
0
]
=
xs0
+
segment_time
;
if
(
(
direction_change
&
BIT
(
Y_AXIS
))
!=
0
)
{
if
(
TEST
(
direction_change
,
Y_AXIS
)
)
{
ys2
=
axis_segment_time
[
Y_AXIS
][
2
]
=
axis_segment_time
[
Y_AXIS
][
1
];
ys2
=
axis_segment_time
[
Y_AXIS
][
2
]
=
axis_segment_time
[
Y_AXIS
][
1
];
ys1
=
axis_segment_time
[
Y_AXIS
][
1
]
=
axis_segment_time
[
Y_AXIS
][
0
];
ys1
=
axis_segment_time
[
Y_AXIS
][
1
]
=
axis_segment_time
[
Y_AXIS
][
0
];
ys0
=
0
;
ys0
=
0
;
...
@@ -1058,7 +1055,7 @@ float junction_deviation = 0.1;
...
@@ -1058,7 +1055,7 @@ float junction_deviation = 0.1;
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
vector_3
plan_get_position
()
{
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
));
vector_3
position
=
vector_3
(
st_get_
axis_position_mm
(
X_AXIS
),
st_get_axis_position_mm
(
Y_AXIS
),
st_get_axis
_position_mm
(
Z_AXIS
));
//position.debug("in plan_get position");
//position.debug("in plan_get position");
//plan_bed_level_matrix.debug("in plan_get_position");
//plan_bed_level_matrix.debug("in plan_get_position");
...
@@ -1076,21 +1073,21 @@ float junction_deviation = 0.1;
...
@@ -1076,21 +1073,21 @@ float junction_deviation = 0.1;
#else
#else
void
plan_set_position
(
const
float
&
x
,
const
float
&
y
,
const
float
&
z
,
const
float
&
e
)
void
plan_set_position
(
const
float
&
x
,
const
float
&
y
,
const
float
&
z
,
const
float
&
e
)
#endif // AUTO_BED_LEVELING_FEATURE
#endif // AUTO_BED_LEVELING_FEATURE
{
{
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
apply_rotation_xyz
(
plan_bed_level_matrix
,
x
,
y
,
z
);
apply_rotation_xyz
(
plan_bed_level_matrix
,
x
,
y
,
z
);
#endif
#endif
long
nx
=
position
[
X_AXIS
]
=
lround
(
x
*
axis_steps_per_unit
[
X_AXIS
]),
long
nx
=
position
[
X_AXIS
]
=
lround
(
x
*
axis_steps_per_unit
[
X_AXIS
]),
ny
=
position
[
Y_AXIS
]
=
lround
(
y
*
axis_steps_per_unit
[
Y_AXIS
]),
ny
=
position
[
Y_AXIS
]
=
lround
(
y
*
axis_steps_per_unit
[
Y_AXIS
]),
nz
=
position
[
Z_AXIS
]
=
lround
(
z
*
axis_steps_per_unit
[
Z_AXIS
]),
nz
=
position
[
Z_AXIS
]
=
lround
(
z
*
axis_steps_per_unit
[
Z_AXIS
]),
ne
=
position
[
E_AXIS
]
=
lround
(
e
*
axis_steps_per_unit
[
E_AXIS
+
active_extruder
]);
ne
=
position
[
E_AXIS
]
=
lround
(
e
*
axis_steps_per_unit
[
E_AXIS
+
active_extruder
]);
last_extruder
=
active_extruder
;
last_extruder
=
active_extruder
;
st_set_position
(
nx
,
ny
,
nz
,
ne
);
st_set_position
(
nx
,
ny
,
nz
,
ne
);
previous_nominal_speed
=
0.0
;
// Resets planner junction speeds. Assumes start from rest.
previous_nominal_speed
=
0.0
;
// Resets planner junction speeds. Assumes start from rest.
for
(
in
t
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
previous_speed
[
i
]
=
0.0
;
for
(
uint8_
t
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
previous_speed
[
i
]
=
0.0
;
}
}
void
plan_set_e_position
(
const
float
&
e
)
{
void
plan_set_e_position
(
const
float
&
e
)
{
position
[
E_AXIS
]
=
lround
(
e
*
axis_steps_per_unit
[
E_AXIS
+
active_extruder
]);
position
[
E_AXIS
]
=
lround
(
e
*
axis_steps_per_unit
[
E_AXIS
+
active_extruder
]);
...
@@ -1100,6 +1097,6 @@ void plan_set_e_position(const float& e) {
...
@@ -1100,6 +1097,6 @@ void plan_set_e_position(const float& e) {
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void
reset_acceleration_rates
()
{
void
reset_acceleration_rates
()
{
for
(
in
t
i
=
0
;
i
<
3
+
EXTRUDERS
;
i
++
)
for
(
uint8_
t
i
=
0
;
i
<
3
+
EXTRUDERS
;
i
++
)
axis_steps_per_sqr_second
[
i
]
=
max_acceleration_units_per_sq_second
[
i
]
*
axis_steps_per_unit
[
i
];
axis_steps_per_sqr_second
[
i
]
=
max_acceleration_units_per_sq_second
[
i
]
*
axis_steps_per_unit
[
i
];
}
}
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