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
8f9f6e0d
Commit
8f9f6e0d
authored
9 years ago
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return to Delay for High Low Step
parent
ff4ec79f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
72 deletions
+47
-72
Configuration_adv.h
MarlinKimbra/Configuration_adv.h
+2
-2
stepper.cpp
MarlinKimbra/stepper.cpp
+45
-70
No files found.
MarlinKimbra/Configuration_adv.h
View file @
8f9f6e0d
...
...
@@ -235,8 +235,8 @@
// Default stepper release if idle. Set to 0 to deactivate.
#define DEFAULT_STEPPER_DEACTIVE_TIME 60
//
Uncomment it if you have High speed stepping
driver
#define ENABLE_HIGH_SPEED_STEPPING
//
Decomment it if you have low speed stepper
driver
//#define STEPPER_HIGH_LOW_DELAY 1u // Delay in microseconds
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
#define DEFAULT_MINTRAVELFEEDRATE 0.0
...
...
This diff is collapsed.
Click to expand it.
MarlinKimbra/stepper.cpp
View file @
8f9f6e0d
...
...
@@ -92,7 +92,6 @@ static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROB
#endif
static
bool
check_endstops
=
true
;
static
bool
stepper_start_x
,
stepper_start_y
,
stepper_start_z
,
stepper_start_e
=
false
;
volatile
long
count_position
[
NUM_AXIS
]
=
{
0
};
volatile
signed
char
count_direction
[
NUM_AXIS
]
=
{
1
,
1
,
1
,
1
};
...
...
@@ -317,27 +316,17 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
unsigned
short
timer
;
if
(
step_rate
>
MAX_STEP_FREQUENCY
)
step_rate
=
MAX_STEP_FREQUENCY
;
#ifdef ENABLE_HIGH_SPEED_STEPPING
if
(
step_rate
>
20000
)
{
// If steprate > 20kHz >> step 4 times
step_rate
=
(
step_rate
>>
2
)
&
0x3fff
;
step_loops
=
4
;
}
else
if
(
step_rate
>
10000
)
{
// If steprate > 10kHz >> step 2 times
step_rate
=
(
step_rate
>>
1
)
&
0x7fff
;
step_loops
=
2
;
}
else
{
step_loops
=
1
;
}
#else
if
(
step_rate
>
10000
)
{
// If steprate > 10kHz >> step 2 times
step_rate
=
(
step_rate
>>
1
)
&
0x7fff
;
step_loops
=
2
;
}
else
{
step_loops
=
1
;
}
#endif
if
(
step_rate
>
(
2
*
DOUBLE_STEP_FREQUENCY
))
{
// If steprate > 2*DOUBLE_STEP_FREQUENCY >> step 4 times
step_rate
=
(
step_rate
>>
2
)
&
0x3fff
;
step_loops
=
4
;
}
else
if
(
step_rate
>
DOUBLE_STEP_FREQUENCY
)
{
// If steprate > DOUBLE_STEP_FREQUENCY >> step 2 times
step_rate
=
(
step_rate
>>
1
)
&
0x7fff
;
step_loops
=
2
;
}
else
{
step_loops
=
1
;
}
if
(
step_rate
<
(
F_CPU
/
500000
))
step_rate
=
(
F_CPU
/
500000
);
step_rate
-=
(
F_CPU
/
500000
);
// Correct for minimal speed
...
...
@@ -457,18 +446,15 @@ FORCE_INLINE void trapezoid_generator_reset() {
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
#define STEP_START(axis, AXIS) \
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
stepper_start_## axis = true; \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; }
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
#define STEP_END(axis, AXIS) \
if (stepper_start_## axis) { \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
stepper_start_## axis = false; \
}
if (_COUNTER(axis) > 0) { \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
...
...
@@ -663,44 +649,41 @@ ISR(TIMER1_COMPA_vect) {
#endif
}
#ifdef ENABLE_HIGH_SPEED_STEPPING
// Take multiple steps per interrupt (For high speed moves)
for
(
int8_t
i
=
0
;
i
<
step_loops
;
i
++
)
{
#ifdef ADVANCE
counter_e
+=
current_block
->
steps
[
E_AXIS
];
if
(
counter_e
>
0
)
{
counter_e
-=
current_block
->
step_event_count
;
e_steps
[
current_block
->
active_driver
]
+=
TEST
(
out_bits
,
E_AXIS
)
?
-
1
:
1
;
}
#endif //ADVANCE
STEP_START
(
x
,
X
);
STEP_START
(
y
,
Y
);
STEP_START
(
z
,
Z
);
#ifndef ADVANCE
STEP_START
(
e
,
E
);
#endif
// Take multiple steps per interrupt (For high speed moves)
for
(
int8_t
i
=
0
;
i
<
step_loops
;
i
++
)
{
#ifndef AT90USB
MSerial
.
checkRx
();
// Check for serial chars.
#endif
STEP_END
(
x
,
X
);
STEP_END
(
y
,
Y
);
STEP_END
(
z
,
Z
);
#ifndef ADVANCE
STEP_END
(
e
,
E
);
#endif
#ifdef ADVANCE
counter_e
+=
current_block
->
steps
[
E_AXIS
];
if
(
counter_e
>
0
)
{
counter_e
-=
current_block
->
step_event_count
;
e_steps
[
current_block
->
active_driver
]
+=
TEST
(
out_bits
,
E_AXIS
)
?
-
1
:
1
;
}
#endif //ADVANCE
step_events_completed
++
;
if
(
step_events_completed
>=
current_block
->
step_event_count
)
break
;
}
#else
STEP_START
(
x
,
X
);
STEP_START
(
y
,
Y
);
STEP_START
(
z
,
Z
);
#ifndef ADVANCE
STEP_START
(
e
,
E
);
#endif
#ifdef STEPPER_HIGH_LOW_DELAY
delayMicroseconds
(
STEPPER_HIGH_LOW_DELAY
);
#endif
STEP_END
(
x
,
X
);
STEP_END
(
y
,
Y
);
STEP_END
(
z
,
Z
);
#ifndef ADVANCE
STEP_END
(
e
,
E
);
#endif
step_events_completed
++
;
#endif
if
(
step_events_completed
>=
current_block
->
step_event_count
)
break
;
}
// Calculate new timer value
unsigned
short
timer
;
...
...
@@ -763,21 +746,13 @@ ISR(TIMER1_COMPA_vect) {
// ensure we're running at the correct step rate, even if we just came off an acceleration
step_loops
=
step_loops_nominal
;
}
#ifndef ENABLE_HIGH_SPEED_STEPPING
STEP_END
(
x
,
X
);
STEP_END
(
y
,
Y
);
STEP_END
(
z
,
Z
);
#ifndef ADVANCE
STEP_END
(
e
,
E
);
#endif
#endif
// If current block is finished, reset pointer
if
(
step_events_completed
>=
current_block
->
step_event_count
)
{
current_block
=
NULL
;
plan_discard_current_block
();
}
}
// current_block != NULL
}
}
#ifdef ADVANCE
...
...
This diff is collapsed.
Click to expand it.
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