DDA, dda_start(): don't pass mb_tail_dda as parameter.
Instead, read the global variable directly.
The idea is that reading the global variable directly removes
the effort to build up a parameter stack, making things faster.
Actually, binary size increases by 4 bytes and the slowest step
takes 3 clock cycles longer. D'oh.
ATmega sizes '168 '328(P) '644(P) '1280
Program: 19274 bytes 135% 63% 31% 15%
Data: 2179 bytes 213% 107% 54% 27%
EEPROM: 32 bytes 4% 2% 2% 1%
short-moves.gcode statistics:
LED on occurences: 888.
LED on time minimum: 218 clock cycles.
LED on time maximum: 398 clock cycles.
LED on time average: 249.111 clock cycles.
smooth-curves.gcode statistics:
LED on occurences: 23648.
LED on time minimum: 237 clock cycles.
LED on time maximum: 441 clock cycles.
LED on time average: 272.222 clock cycles.
triangle-odd.gcode statistics:
LED on occurences: 1636.
LED on time minimum: 237 clock cycles.
LED on time maximum: 398 clock cycles.
LED on time average: 262.576 clock cycles.
This commit is contained in:
parent
d5eb8cd916
commit
480cc40618
5
dda.c
5
dda.c
|
|
@ -482,7 +482,6 @@ void dda_create(DDA *dda, const TARGET *target) {
|
|||
}
|
||||
|
||||
/*! Start a prepared DDA
|
||||
\param *dda pointer to entry in dda_queue to start
|
||||
|
||||
This function actually begins the move described by the passed DDA entry.
|
||||
|
||||
|
|
@ -492,8 +491,8 @@ void dda_create(DDA *dda, const TARGET *target) {
|
|||
|
||||
Called both inside and outside of interrupts.
|
||||
*/
|
||||
void dda_start(DDA *dda) {
|
||||
// called from interrupt context: keep it simple!
|
||||
void dda_start() {
|
||||
DDA *dda = mb_tail_dda;
|
||||
|
||||
if (DEBUG_DDA && (debug_flags & DEBUG_DDA))
|
||||
sersendf_P(PSTR("Start: X %lq Y %lq Z %lq F %lu\n"),
|
||||
|
|
|
|||
2
dda.h
2
dda.h
|
|
@ -187,7 +187,7 @@ void dda_new_startpoint(void);
|
|||
void dda_create(DDA *dda, const TARGET *target);
|
||||
|
||||
// start a created DDA (called from timer interrupt)
|
||||
void dda_start(DDA *dda);
|
||||
void dda_start(void);
|
||||
|
||||
// DDA takes one step (called from timer interrupt)
|
||||
void dda_step(DDA *dda);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void queue_step() {
|
|||
if (mb_tail != mb_head) {
|
||||
mb_tail = MB_NEXT(mb_tail);
|
||||
mb_tail_dda = &(movebuffer[mb_tail]);
|
||||
dda_start(mb_tail_dda);
|
||||
dda_start();
|
||||
}
|
||||
else {
|
||||
mb_tail_dda = NULL;
|
||||
|
|
@ -123,7 +123,7 @@ void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) {
|
|||
timer_reset();
|
||||
mb_tail = mb_head; // Valid ONLY if the queue was empty before!
|
||||
mb_tail_dda = new_movebuffer; // Dito!
|
||||
dda_start(mb_tail_dda);
|
||||
dda_start();
|
||||
// Compensate for the cli() in timer_set().
|
||||
sei();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue