From 6002e10dd7420c8991719f9be493cad968e06329 Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Tue, 2 Feb 2010 23:51:08 +1100 Subject: [PATCH] time to save, acceleration seems to be temporarily broken, will have to debug later --- mendel/dda.c | 9 +++------ mendel/dda.h | 2 +- mendel/machine.h | 9 ++++----- mendel/mendel.c | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mendel/dda.c b/mendel/dda.c index 434b7e0..a52b331 100644 --- a/mendel/dda.c +++ b/mendel/dda.c @@ -321,21 +321,18 @@ void dda_start(DDA *dda) { */ uint8_t can_step(uint8_t min, uint8_t max, int32_t current, int32_t target, uint8_t dir) { - if (current == target) - return 0; - if (dir) { // forwards/positive if (max) return 0; - if (current > target) + if ((current - target) >= 0) return 0; } else { // backwards/negative if (min) return 0; - if (target > current) + if ((target - current) >= 0) return 0; } @@ -487,7 +484,7 @@ void dda_step(DDA *dda) { if (step_option & F_REAL_STEP) setTimer(dda->move_duration / current_position.F); - // if we could step, we're still running + // if we could do anything at all, we're still running dda->live = (step_option != 0)?1:0; // if ( // (current_position.X == dda->endpoint.X) && diff --git a/mendel/dda.h b/mendel/dda.h index b1124c6..fd4a705 100644 --- a/mendel/dda.h +++ b/mendel/dda.h @@ -10,7 +10,7 @@ typedef struct { int32_t X; int32_t Y; int32_t Z; - uint32_t E; + int32_t E; uint32_t F; } TARGET; diff --git a/mendel/machine.h b/mendel/machine.h index 2285f1e..8fe6202 100644 --- a/mendel/machine.h +++ b/mendel/machine.h @@ -16,8 +16,6 @@ #define Y_STEPS_PER_REV X_STEPS_PER_REV // we need more speed than precision on Z, turn off microstepping #define Z_STEPS_PER_REV 200.0 -// we need more torque and smoothness at very low speeds on E, maximum microstepping -#define E_STEPS_PER_REV 3200.0 #define X_COG_CIRCUMFERENCE (4.77 * 16.0) #define Y_COG_CIRCUMFERENCE X_COG_CIRCUMFERENCE @@ -26,7 +24,8 @@ // #define XY_COG_CIRCUMFERENCE (XY_COG_RADIUS * PI * 2) #define Z_GEAR_RATIO 1.0 -#define EXTRUDER_STEPS_PER_REV E_STEPS_PER_REV +// we need more torque and smoothness at very low speeds on E, maximum microstepping +#define E_STEPS_PER_REV 3200.0 #define EXTRUDER_SHAFT_RADIUS 5.0 #define EXTRUDER_INLET_DIAMETER 3.0 #define EXTRUDER_NOZZLE_DIAMETER 0.8 @@ -37,8 +36,8 @@ // http://blog.arcol.hu/?p=157 may help with this next one // I haven't tuned this at all- it's just a placeholder until I read the above carefully enough -// does this refer to filament or extrudate? extrudate depends on layer thickness.. hm -#define STEPS_PER_MM_E ((uint32_t) ((EXTRUDER_STEPS_PER_REV / (EXTRUDER_SHAFT_RADIUS * PI * EXTRUDER_INLET_DIAMETER / EXTRUDER_NOZZLE_DIAMETER)) + 0.5)) +// does this refer to filament or extrudate? extrudate depends on XY distance vs E distance.. hm lets go with filament +#define STEPS_PER_MM_E ((uint32_t) ((E_STEPS_PER_REV / (EXTRUDER_SHAFT_RADIUS * PI * EXTRUDER_INLET_DIAMETER)) + 0.5)) #define FEEDRATE_FAST_XY 6000 #define FEEDRATE_SLOW_XY 300 diff --git a/mendel/mendel.c b/mendel/mendel.c index 283c85d..eedbc61 100644 --- a/mendel/mendel.c +++ b/mendel/mendel.c @@ -135,7 +135,7 @@ int main (void) serial_writechar(','); serwrite_int32(current_position.Z); serial_writechar(','); - serwrite_uint32(current_position.E); + serwrite_int32(current_position.E); serial_writechar(','); serwrite_uint32(current_position.F); serial_writechar('\n'); @@ -148,7 +148,7 @@ int main (void) serial_writechar(','); serwrite_int32(movebuffer[mb_tail].endpoint.Z); serial_writechar(','); - serwrite_uint32(movebuffer[mb_tail].endpoint.E); + serwrite_int32(movebuffer[mb_tail].endpoint.E); serial_writechar(','); serwrite_uint32(movebuffer[mb_tail].endpoint.F); serial_writechar('\n');