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
075af738
Commit
075af738
authored
Sep 08, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Same fix
parent
ae00f247
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
73 deletions
+69
-73
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+32
-32
conditionals.h
MarlinKimbra/conditionals.h
+2
-0
pins.h
MarlinKimbra/pins.h
+1
-2
planner.cpp
MarlinKimbra/planner.cpp
+30
-31
stepper.cpp
MarlinKimbra/stepper.cpp
+4
-8
No files found.
MarlinKimbra/Marlin_main.cpp
View file @
075af738
...
@@ -6786,29 +6786,29 @@ inline void gcode_T(uint8_t tmp_extruder) {
...
@@ -6786,29 +6786,29 @@ inline void gcode_T(uint8_t tmp_extruder) {
switch
(
target_extruder
)
switch
(
target_extruder
)
{
{
case
0
:
case
0
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
0
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
1
:
case
1
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
0
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
LOW
);
active_driver
=
1
;
active_driver
=
1
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e1
();
enable_e1
();
break
;
break
;
case
2
:
case
2
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
0
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e2
();
enable_e2
();
break
;
break
;
case
3
:
case
3
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
1
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
HIGH
);
active_driver
=
1
;
active_driver
=
1
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e3
();
enable_e3
();
...
@@ -6820,33 +6820,33 @@ inline void gcode_T(uint8_t tmp_extruder) {
...
@@ -6820,33 +6820,33 @@ inline void gcode_T(uint8_t tmp_extruder) {
switch
(
target_extruder
)
switch
(
target_extruder
)
{
{
case
0
:
case
0
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
1
:
case
1
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
2
:
case
2
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
3
:
case
3
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
HIGH
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
...
@@ -6858,22 +6858,22 @@ inline void gcode_T(uint8_t tmp_extruder) {
...
@@ -6858,22 +6858,22 @@ inline void gcode_T(uint8_t tmp_extruder) {
switch
(
target_extruder
)
switch
(
target_extruder
)
{
{
case
0
:
case
0
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
1
:
case
1
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
active_driver
=
1
;
active_driver
=
1
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e1
();
enable_e1
();
break
;
break
;
case
2
:
case
2
:
WRITE_RELE
(
E0E2_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
HIGH
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e
2
();
enable_e
0
();
break
;
break
;
}
}
#elif (EXTRUDERS == 3) && HAS(E0E1) && HAS(E0E2) && (DRIVER_EXTRUDERS == 1)
#elif (EXTRUDERS == 3) && HAS(E0E1) && HAS(E0E2) && (DRIVER_EXTRUDERS == 1)
...
@@ -6882,22 +6882,22 @@ inline void gcode_T(uint8_t tmp_extruder) {
...
@@ -6882,22 +6882,22 @@ inline void gcode_T(uint8_t tmp_extruder) {
switch
(
target_extruder
)
switch
(
target_extruder
)
{
{
case
0
:
case
0
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
1
:
case
1
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
2
:
case
2
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
HIGH
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
HIGH
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
...
@@ -6909,13 +6909,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
...
@@ -6909,13 +6909,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
switch
(
target_extruder
)
switch
(
target_extruder
)
{
{
case
0
:
case
0
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
0
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
LOW
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
break
;
break
;
case
1
:
case
1
:
WRITE_RELE
(
E0E1_CHOICE_PIN
,
1
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
HIGH
);
active_driver
=
0
;
active_driver
=
0
;
delay
(
500
);
// 500 microseconds delay for relay
delay
(
500
);
// 500 microseconds delay for relay
enable_e0
();
enable_e0
();
...
...
MarlinKimbra/conditionals.h
View file @
075af738
...
@@ -672,8 +672,10 @@
...
@@ -672,8 +672,10 @@
#if ENABLED(MKR4)
#if ENABLED(MKR4)
#if ENABLED(INVERTED_RELE_PINS)
#if ENABLED(INVERTED_RELE_PINS)
#define WRITE_RELE(pin, value) WRITE(pin, !value)
#define WRITE_RELE(pin, value) WRITE(pin, !value)
#define OUT_WRITE_RELE(pin, value) OUT_WRITE(pin, !value)
#else
#else
#define WRITE_RELE(pin, value) WRITE(pin, value)
#define WRITE_RELE(pin, value) WRITE(pin, value)
#define OUT_WRITE_RELE(pin, value) OUT_WRITE(pin, value)
#endif
#endif
#endif
#endif
...
...
MarlinKimbra/pins.h
View file @
075af738
...
@@ -1248,7 +1248,7 @@
...
@@ -1248,7 +1248,7 @@
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
#endif
#endif
#endif // RAMPS_13_
EE
B
#endif // RAMPS_13_
HH
B
/****************************************************************************************/
/****************************************************************************************/
...
@@ -2533,7 +2533,6 @@
...
@@ -2533,7 +2533,6 @@
#define Z_MIN_PIN 38 // PC6
#define Z_MIN_PIN 38 // PC6
#define Z_MAX_PIN 39 // PC7
#define Z_MAX_PIN 39 // PC7
#define Z_MS1_PIN 44 // PC19
#define Z_MS1_PIN 44 // PC19
#define Z_PROBE_PIN 39 // PC7
// E0 AXIS
// E0 AXIS
#define ORIG_E0_STEP_PIN 5 // PC25
#define ORIG_E0_STEP_PIN 5 // PC25
...
...
MarlinKimbra/planner.cpp
View file @
075af738
...
@@ -134,14 +134,14 @@ unsigned char g_uc_extruder_last_move[4] = {0,0,0,0};
...
@@ -134,14 +134,14 @@ unsigned char g_uc_extruder_last_move[4] = {0,0,0,0};
FORCE_INLINE
int8_t
next_block_index
(
int8_t
block_index
)
{
return
BLOCK_MOD
(
block_index
+
1
);
}
FORCE_INLINE
int8_t
next_block_index
(
int8_t
block_index
)
{
return
BLOCK_MOD
(
block_index
+
1
);
}
FORCE_INLINE
int8_t
prev_block_index
(
int8_t
block_index
)
{
return
BLOCK_MOD
(
block_index
-
1
);
}
FORCE_INLINE
int8_t
prev_block_index
(
int8_t
block_index
)
{
return
BLOCK_MOD
(
block_index
-
1
);
}
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
// given acceleration:
// given acceleration:
FORCE_INLINE
float
estimate_acceleration_distance
(
float
initial_rate
,
float
target_rate
,
float
acceleration
)
{
FORCE_INLINE
float
estimate_acceleration_distance
(
float
initial_rate
,
float
target_rate
,
float
acceleration
)
{
if
(
acceleration
==
0
)
return
0
;
// acceleration was 0, set acceleration distance to 0
if
(
acceleration
==
0
)
return
0
;
// acceleration was 0, set acceleration distance to 0
return
(
target_rate
*
target_rate
-
initial_rate
*
initial_rate
)
/
(
acceleration
*
2
);
return
(
target_rate
*
target_rate
-
initial_rate
*
initial_rate
)
/
(
acceleration
*
2
);
}
}
// This function gives you the point at which you must start braking (at the rate of -acceleration) if
// This function gives you the point at which you must start braking (at the rate of -acceleration) if
// you started at speed initial_rate and accelerated until this point and want to end at the final_rate after
// you started at speed initial_rate and accelerated until this point and want to end at the final_rate after
// a total travel of distance. This can be used to compute the intersection point between acceleration and
// a total travel of distance. This can be used to compute the intersection point between acceleration and
// deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
// deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
...
@@ -179,7 +179,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
...
@@ -179,7 +179,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
}
}
#if ENABLED(ADVANCE)
#if ENABLED(ADVANCE)
volatile
long
initial_advance
=
block
->
advance
*
entry_factor
*
entry_factor
;
volatile
long
initial_advance
=
block
->
advance
*
entry_factor
*
entry_factor
;
volatile
long
final_advance
=
block
->
advance
*
exit_factor
*
exit_factor
;
volatile
long
final_advance
=
block
->
advance
*
exit_factor
*
exit_factor
;
#endif // ADVANCE
#endif // ADVANCE
...
@@ -197,16 +197,16 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
...
@@ -197,16 +197,16 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
#endif
#endif
}
}
CRITICAL_SECTION_END
;
CRITICAL_SECTION_END
;
}
}
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
// acceleration within the allotted distance.
// acceleration within the allotted distance.
FORCE_INLINE
float
max_allowable_speed
(
float
acceleration
,
float
target_velocity
,
float
distance
)
{
FORCE_INLINE
float
max_allowable_speed
(
float
acceleration
,
float
target_velocity
,
float
distance
)
{
return
sqrt
(
target_velocity
*
target_velocity
-
2
*
acceleration
*
distance
);
return
sqrt
(
target_velocity
*
target_velocity
-
2
*
acceleration
*
distance
);
}
}
// "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(
...
@@ -229,7 +229,7 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n
...
@@ -229,7 +229,7 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n
if
(
!
current
->
nominal_length_flag
&&
current
->
max_entry_speed
>
next
->
entry_speed
)
{
if
(
!
current
->
nominal_length_flag
&&
current
->
max_entry_speed
>
next
->
entry_speed
)
{
current
->
entry_speed
=
min
(
current
->
max_entry_speed
,
current
->
entry_speed
=
min
(
current
->
max_entry_speed
,
max_allowable_speed
(
-
current
->
acceleration
,
next
->
entry_speed
,
current
->
millimeters
));
max_allowable_speed
(
-
current
->
acceleration
,
next
->
entry_speed
,
current
->
millimeters
));
}
}
else
{
else
{
current
->
entry_speed
=
current
->
max_entry_speed
;
current
->
entry_speed
=
current
->
max_entry_speed
;
}
}
...
@@ -239,16 +239,16 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n
...
@@ -239,16 +239,16 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n
}
// Skip last block. Already initialized and set for recalculation.
}
// Skip last block. Already initialized and set for recalculation.
}
}
// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This
// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This
// implements the reverse pass.
// implements the reverse pass.
void
planner_reverse_pass
()
{
void
planner_reverse_pass
()
{
uint8_t
block_index
=
block_buffer_head
;
uint8_t
block_index
=
block_buffer_head
;
//Make a local copy of block_buffer_tail, because the interrupt can alter it
//Make a local copy of block_buffer_tail, because the interrupt can alter it
CRITICAL_SECTION_START
;
CRITICAL_SECTION_START
;
unsigned
char
tail
=
block_buffer_tail
;
unsigned
char
tail
=
block_buffer_tail
;
CRITICAL_SECTION_END
CRITICAL_SECTION_END
if
(
BLOCK_MOD
(
block_buffer_head
-
tail
+
BLOCK_BUFFER_SIZE
)
>
3
)
{
// moves queued
if
(
BLOCK_MOD
(
block_buffer_head
-
tail
+
BLOCK_BUFFER_SIZE
)
>
3
)
{
// moves queued
block_index
=
BLOCK_MOD
(
block_buffer_head
-
3
);
block_index
=
BLOCK_MOD
(
block_buffer_head
-
3
);
block_t
*
block
[
3
]
=
{
NULL
,
NULL
,
NULL
};
block_t
*
block
[
3
]
=
{
NULL
,
NULL
,
NULL
};
...
@@ -300,8 +300,8 @@ void planner_forward_pass() {
...
@@ -300,8 +300,8 @@ void planner_forward_pass() {
planner_forward_pass_kernel
(
block
[
1
],
block
[
2
],
NULL
);
planner_forward_pass_kernel
(
block
[
1
],
block
[
2
],
NULL
);
}
}
// Recalculates the trapezoid speed profiles for all blocks in the plan according to the
// Recalculates the trapezoid speed profiles for all blocks in the plan according to the
// entry_factor for each junction. Must be called by planner_recalculate() after
// entry_factor for each junction. Must be called by planner_recalculate() after
// updating the blocks.
// updating the blocks.
void
planner_recalculate_trapezoids
()
{
void
planner_recalculate_trapezoids
()
{
int8_t
block_index
=
block_buffer_tail
;
int8_t
block_index
=
block_buffer_tail
;
...
@@ -332,22 +332,22 @@ void planner_recalculate_trapezoids() {
...
@@ -332,22 +332,22 @@ void planner_recalculate_trapezoids() {
// Recalculates the motion plan according to the following algorithm:
// Recalculates the motion plan according to the following algorithm:
//
//
// 1. Go over every block in reverse order and calculate a junction speed reduction (i.e. block_t.entry_factor)
// 1. Go over every block in reverse order and calculate a junction speed reduction (i.e. block_t.entry_factor)
// so that:
// so that:
// a. The junction jerk is within the set limit
// a. The junction jerk is within the set limit
// b. No speed reduction within one block requires faster deceleration than the one, true constant
// b. No speed reduction within one block requires faster deceleration than the one, true constant
// acceleration.
// acceleration.
// 2. Go over every block in chronological order and dial down junction speed reduction values if
// 2. Go over every block in chronological order and dial down junction speed reduction values if
// a. The speed increase within one block would require faster acceleration than the one, true
// a. The speed increase within one block would require faster acceleration than the one, true
// constant acceleration.
// constant acceleration.
//
//
// When these stages are complete all blocks have an entry_factor that will allow all speed changes to
// When these stages are complete all blocks have an entry_factor that will allow all speed changes to
// be performed using only the one, true constant acceleration, and where no junction jerk is jerkier than
// be performed using only the one, true constant acceleration, and where no junction jerk is jerkier than
// the set limit. Finally it will:
// the set limit. Finally it will:
//
//
// 3. Recalculate trapezoids for all blocks.
// 3. Recalculate trapezoids for all blocks.
void
planner_recalculate
()
{
void
planner_recalculate
()
{
planner_reverse_pass
();
planner_reverse_pass
();
planner_forward_pass
();
planner_forward_pass
();
planner_recalculate_trapezoids
();
planner_recalculate_trapezoids
();
...
@@ -356,7 +356,7 @@ void planner_recalculate() {
...
@@ -356,7 +356,7 @@ void planner_recalculate() {
void
plan_init
()
{
void
plan_init
()
{
block_buffer_head
=
block_buffer_tail
=
0
;
block_buffer_head
=
block_buffer_tail
=
0
;
memset
(
position
,
0
,
sizeof
(
position
));
// clear position
memset
(
position
,
0
,
sizeof
(
position
));
// clear position
for
(
int
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
previous_speed
[
i
]
=
0.0
;
for
(
int
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
previous_speed
[
i
]
=
0.0
;
previous_nominal_speed
=
0.0
;
previous_nominal_speed
=
0.0
;
}
}
...
@@ -480,7 +480,7 @@ void check_axes_activity() {
...
@@ -480,7 +480,7 @@ void check_axes_activity() {
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
// calculation the caller must also provide the physical length of the line in millimeters.
// calculation the caller must also provide the physical length of the line in millimeters.
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
...
@@ -492,7 +492,7 @@ float junction_deviation = 0.1;
...
@@ -492,7 +492,7 @@ float junction_deviation = 0.1;
// Calculate the buffer head after we push this byte
// Calculate the buffer head after we push this byte
int
next_buffer_head
=
next_block_index
(
block_buffer_head
);
int
next_buffer_head
=
next_block_index
(
block_buffer_head
);
// If the buffer is full: good! That means we are well ahead of the robot.
// If the buffer is full: good! That means we are well ahead of the robot.
// Rest here until there is room in the buffer.
// Rest here until there is room in the buffer.
while
(
block_buffer_tail
==
next_buffer_head
)
idle
();
while
(
block_buffer_tail
==
next_buffer_head
)
idle
();
...
@@ -743,13 +743,13 @@ float junction_deviation = 0.1;
...
@@ -743,13 +743,13 @@ float junction_deviation = 0.1;
NOLESS
(
feed_rate
,
mintravelfeedrate
);
NOLESS
(
feed_rate
,
mintravelfeedrate
);
/**
/**
* This part of the code calculates the total length of the movement.
* This part of the code calculates the total length of the movement.
* For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS.
* For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS.
* But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS
* But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS
* and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y.
* and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y.
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/
*/
#if MECH(COREXY)
#if MECH(COREXY)
float
delta_mm
[
6
];
float
delta_mm
[
6
];
delta_mm
[
X_HEAD
]
=
dx
/
axis_steps_per_unit
[
A_AXIS
];
delta_mm
[
X_HEAD
]
=
dx
/
axis_steps_per_unit
[
A_AXIS
];
...
@@ -786,7 +786,7 @@ float junction_deviation = 0.1;
...
@@ -786,7 +786,7 @@ float junction_deviation = 0.1;
#endif
#endif
);
);
}
}
float
inverse_millimeters
=
1.0
/
block
->
millimeters
;
// Inverse millimeters to remove multiple divides
float
inverse_millimeters
=
1.0
/
block
->
millimeters
;
// Inverse millimeters to remove multiple divides
// Calculate speed in mm/second for each axis. No divide by zero due to previous checks.
// Calculate speed in mm/second for each axis. No divide by zero due to previous checks.
float
inverse_second
=
feed_rate
*
inverse_millimeters
;
float
inverse_second
=
feed_rate
*
inverse_millimeters
;
...
@@ -854,13 +854,12 @@ float junction_deviation = 0.1;
...
@@ -854,13 +854,12 @@ float junction_deviation = 0.1;
// Max segement time in us.
// Max segement time in us.
#if ENABLED(XY_FREQUENCY_LIMIT)
#if ENABLED(XY_FREQUENCY_LIMIT)
#define MAX_FREQ_TIME (1000000.0 / XY_FREQUENCY_LIMIT)
// Check and limit the xy direction change frequency
// Check and limit the xy direction change frequency
unsigned
char
direction_change
=
block
->
direction_bits
^
old_direction_bits
;
unsigned
char
direction_change
=
block
->
direction_bits
^
old_direction_bits
;
old_direction_bits
=
block
->
direction_bits
;
old_direction_bits
=
block
->
direction_bits
;
segment_time
=
lround
((
float
)
segment_time
/
speed_factor
);
segment_time
=
lround
((
float
)
segment_time
/
speed_factor
);
long
xs0
=
axis_segment_time
[
X_AXIS
][
0
],
long
xs0
=
axis_segment_time
[
X_AXIS
][
0
],
xs1
=
axis_segment_time
[
X_AXIS
][
1
],
xs1
=
axis_segment_time
[
X_AXIS
][
1
],
xs2
=
axis_segment_time
[
X_AXIS
][
2
],
xs2
=
axis_segment_time
[
X_AXIS
][
2
],
...
@@ -891,7 +890,7 @@ float junction_deviation = 0.1;
...
@@ -891,7 +890,7 @@ float junction_deviation = 0.1;
}
}
#endif // XY_FREQUENCY_LIMIT
#endif // XY_FREQUENCY_LIMIT
// Correct the speed
// Correct the speed
if
(
speed_factor
<
1.0
)
{
if
(
speed_factor
<
1.0
)
{
for
(
unsigned
char
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
current_speed
[
i
]
*=
speed_factor
;
for
(
unsigned
char
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
current_speed
[
i
]
*=
speed_factor
;
block
->
nominal_speed
*=
speed_factor
;
block
->
nominal_speed
*=
speed_factor
;
...
@@ -920,7 +919,7 @@ float junction_deviation = 0.1;
...
@@ -920,7 +919,7 @@ float junction_deviation = 0.1;
if
((
float
)
acc_st
*
bsy
/
block
->
step_event_count
>
ysteps
)
acc_st
=
ysteps
;
if
((
float
)
acc_st
*
bsy
/
block
->
step_event_count
>
ysteps
)
acc_st
=
ysteps
;
if
((
float
)
acc_st
*
bsz
/
block
->
step_event_count
>
zsteps
)
acc_st
=
zsteps
;
if
((
float
)
acc_st
*
bsz
/
block
->
step_event_count
>
zsteps
)
acc_st
=
zsteps
;
if
((
float
)
acc_st
*
bse
/
block
->
step_event_count
>
esteps
)
acc_st
=
esteps
;
if
((
float
)
acc_st
*
bse
/
block
->
step_event_count
>
esteps
)
acc_st
=
esteps
;
block
->
acceleration_st
=
acc_st
;
block
->
acceleration_st
=
acc_st
;
block
->
acceleration
=
acc_st
/
steps_per_mm
;
block
->
acceleration
=
acc_st
/
steps_per_mm
;
...
@@ -973,7 +972,7 @@ float junction_deviation = 0.1;
...
@@ -973,7 +972,7 @@ float junction_deviation = 0.1;
// Start with a safe speed
// Start with a safe speed
float
vmax_junction
=
max_xy_jerk
/
2
;
float
vmax_junction
=
max_xy_jerk
/
2
;
float
vmax_junction_factor
=
1.0
;
float
vmax_junction_factor
=
1.0
;
float
mz2
=
max_z_jerk
/
2
,
me2
=
max_e_jerk
[
extruder
]
/
2
;
float
mz2
=
max_z_jerk
/
2
,
me2
=
max_e_jerk
[
extruder
]
/
2
;
float
csz
=
current_speed
[
Z_AXIS
],
cse
=
current_speed
[
E_AXIS
];
float
csz
=
current_speed
[
Z_AXIS
],
cse
=
current_speed
[
E_AXIS
];
if
(
fabs
(
csz
)
>
mz2
)
vmax_junction
=
min
(
vmax_junction
,
mz2
);
if
(
fabs
(
csz
)
>
mz2
)
vmax_junction
=
min
(
vmax_junction
,
mz2
);
...
...
MarlinKimbra/stepper.cpp
View file @
075af738
...
@@ -940,20 +940,16 @@ void st_init() {
...
@@ -940,20 +940,16 @@ void st_init() {
//Choice E0-E1 or E0-E2 or E1-E3 pin
//Choice E0-E1 or E0-E2 or E1-E3 pin
#if ENABLED(MKR4) && HAS(E0E1)
#if ENABLED(MKR4) && HAS(E0E1)
SET_OUTPUT
(
E0E1_CHOICE_PIN
);
OUT_WRITE_RELE
(
E0E1_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E1_CHOICE_PIN
,
0
);
#endif
#endif
#if ENABLED(MKR4) && HAS(E0E2)
#if ENABLED(MKR4) && HAS(E0E2)
SET_OUTPUT
(
E0E2_CHOICE_PIN
);
OUT_WRITE_RELE
(
E0E2_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E2_CHOICE_PIN
,
0
);
#endif
#endif
#if ENABLED(MKR4) && HAS(E0E3)
#if ENABLED(MKR4) && HAS(E0E3)
SET_OUTPUT
(
E0E3_CHOICE_PIN
);
OUT_WRITE_RELE
(
E0E3_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E0E3_CHOICE_PIN
,
0
);
#endif
#endif
#if ENABLED(MKR4) && HAS(E1E3)
#if ENABLED(MKR4) && HAS(E1E3)
SET_OUTPUT
(
E1E3_CHOICE_PIN
);
OUT_WRITE_RELE
(
E1E3_CHOICE_PIN
,
LOW
);
WRITE_RELE
(
E1E3_CHOICE_PIN
,
0
);
#endif
#endif
//endstops and pullups
//endstops and pullups
...
...
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