Teacup_Firmware/attic/dda.c-attempts-to-use-sign-...

50 lines
1.9 KiB
Diff

From c8e28f3ff9b72eace20cce851d77a6de5e995c69 Mon Sep 17 00:00:00 2001
From: Markus Hitter <mah@jump-ing.de>
Date: Sun, 12 Oct 2014 23:17:48 +0200
Subject: [PATCH] dda.c: attempts to use sign of dda->delta_um[] to set
direction.
At that point we stored movement distance in steps signed in
dda->delta_um[] as well as unsigned in dda->delta[] plus its
sign in dda->{xyze}_direction. That's obvously redundant, so
the try was to get rid of the redundancy.
However, dda_start() is the most time critical part when using
look-ahead, so this attemt was dropped. Next attempt will be to
use dda->{xyze}_direction in dda_find_crossing_speed(), the only
usage of the dda->delta_um[].
---
dda.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dda.c b/dda.c
index 8d53256..195e472 100644
--- a/dda.c
+++ b/dda.c
@@ -468,7 +468,21 @@ void dda_start(DDA *dda) {
endstops_on();
// set direction outputs
- x_direction(dda->x_direction);
+ // This is the fastest one.
+ x_direction(dda->x_direction); // 20164 bytes
+ // Costs 14 additional CPU clock cycles.
+ //x_direction(dda->delta_um[X] < 0 ? 1 : 0); // 20184 bytes
+ // Costs 12 additional CPU clock cycles.
+ //x_direction(dda->delta_um[X] >> (sizeof(int32_t) * 8 - 1)); // 20178 bytes
+ // Costs 14 additional CPU clock cycles.
+ //x_direction(dda->delta_um[X] > 0); // 20184 bytes
+ // Costs 12 additional CPU clock cycles.
+ //x_direction(dda->delta_um[X] < 0); // 20178 bytes
+ // Costs 5 additional CPU clock cycles.
+ //x_direction( ! ((*((uint8_t *)(&dda->delta_um[X]) + 3)) & 0x80)); // 20172 bytes
+ // Check just the last byte, that's smaller and faster.
+ // Costs 6 additional CPU clock cycles.
+ //x_direction((*((uint8_t *)(&dda->delta_um[X]) + 3)) > 0); // 20172 bytes
y_direction(dda->y_direction);
z_direction(dda->z_direction);
e_direction(dda->e_direction);
--
2.1.0