Commit Graph

213 Commits

Author SHA1 Message Date
Markus Hitter 95a44e8777 DDA: clear flags of a queue entry earlier.
Formerly, once a wait for temp was given, this flag would stick
forever on this queue entry.

Spotted by Zungmann, thanks a lot!

http://forums.reprap.org/read.php?147,33082,280439#msg-280439
2014-03-04 19:58:06 +01:00
Phil Hord c7150445af Zungmann's fixes to compile simulator on Mac OS X, part 2.
Here: .bss section syntax is different.
2014-03-04 19:57:48 +01:00
Markus Hitter 6fae5a8b7c DDA: make macro ACCELERATE_RAMP_LEN_SPM() a function.
This macro is pretty expensive (700 bytes, well, stuff is now
calculated at runtime), so there's no chance to use it in multiple
places and we likely also need this in dda_lookahead.c to achieve
full 4 axis compatibility there.
2014-03-04 19:56:01 +01:00
Markus Hitter 9739382da9 dda.c: remember steps per m of the fast axis for rampup calculation.
For now this is for the initial rampup calculation, only, notably
for moving the Z axis (which else gets far to few rampup steps on
a typical mendel-like printer).

The used macro was verified with this test code (in mendel.c):

[...]
int main (void) {
  init();

  uint32_t speed, spm;
  char string[128];
  for (spm = 2000; spm < 4099000; spm <<= 1) {
    for (speed = 11; speed < 65536; speed *= 8) {
      sersendf_P(PSTR("spm = %lu  speed %lu ==> macro %lu  "),
                 spm, speed, ACCELERATE_RAMP_LEN_SPM(speed, spm));
      delay_ms(10);
      sprintf(string, "double %f\n",
              (double)speed * (double)speed / ((double)7200000 * (double)ACCELERATION / (double)spm));
      serial_writestr((uint8_t *)string);
      delay_ms(10);
    }
  }
[...]

Note: to link the test code, this linker flag is required to add
      the full printf library (which does print doubles):

  LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm
2014-03-04 19:55:53 +01:00
Markus Hitter 3da2363ac5 DDA: remember the fast axis micrometers and save their reconstruction.
No surprise, this saves a whopping 600 bytes.
2014-03-04 19:55:45 +01:00
Roland Brochard 297aa28dfd Lookahead: refactored code to compute everything in dda steps. 2014-03-04 19:55:36 +01:00
Markus Hitter 20686eb52c dda.c: remove the hack for too high rampup steps for lookahead.
Keeping the hack causes the previous move to decelerate, which isn't
intended when movements are joined with lookahead.

Removing only the hack breaks endstop handling on those axes which
set a huuuge number of acceleration steps for the lack of a proper
calculation algorithm. We have this algorithm now, so we can stop
using this kludge.

Solves part 1 of issue #68.
2014-03-04 19:55:28 +01:00
Markus Hitter 2f1142d461 dda.c: base rampup_steps calculation on the fast axis, too. 2014-03-04 19:55:20 +01:00
Markus Hitter 41ca1b7570 dda.c: actually reduce endpoint.F for overly fast movement attempts.
This fix was long overdue and is now unavoidable, as the hack with
limiting maximum speed to c_min in dda_clock() conflicts with
lookahead.
2014-03-04 19:55:03 +01:00
Markus Hitter 46548dba47 DDA: make a huge comment compact and move it to where it belongs.
Also clarify the acceleration formula.
2014-03-04 19:54:53 +01:00
Markus Hitter 42ad12fba3 DDA: store distance of each movement.
This is required to calculate speeds of individual axes. So far only
in dda_find_crossing_speed(), but soon also in dda_join_moves().
2014-03-04 19:54:41 +01:00
Markus Hitter 1b5682c01a dda.c: describe all lookahead cases in a comment. 2014-03-04 19:54:34 +01:00
Markus Hitter d10c0f3041 dda.c: clear /all/ lookahead variables when starting.
Catched it! :-)

This was causing occasional step losses when a movement with
zero crossF followed a pair with high crossF.
2014-03-04 19:54:23 +01:00
Markus Hitter da5339d163 DDA: use the already calculated distance for crossing speed calculation. 2014-03-04 19:52:42 +01:00
Markus Hitter 3ac26f0cab DDA: move dda_find_crossing_speed() to dda.c.
This is a preparation towards going through the existing movement
queue backwards with dda_join_moves() to allow higher feedrates
for lots of short movements.
2014-03-04 19:52:29 +01:00
Markus Hitter 1eaf711923 dda.c: review debug messages a bit. 2013-12-06 19:24:58 +01:00
Markus Hitter c594af3e19 dda.c: don't set timer twice when going from one move to the next.
This is a bug which existed, well, basically forever. Nobody noticed
until precision timings could be recorded with SimulAVR.
2013-12-06 19:24:58 +01:00
Markus Hitter f37a65ca36 dda_queue.c: run every queued thing through dda_create().
This allows dda_create() to track things queued but not being a movement.
Important for lookahead.
2013-12-06 19:24:58 +01:00
Phil Hord ddd8988727 dda_create(): store prev_dda locally.
This obviously requires less place on the stack and accordingly a
few CPU cycles less, but more importantly, it lets decide
dda_start() whether a previous movement is to be taken into account
or not.

To make this decision more reliable, add a flag for movements done.
Else it could happen we'd try to join with a movement done long
before.
2013-12-06 19:24:58 +01:00
Phil Hord ab65ba6c95 Rename delta -> delta_um to avoid collision. 2013-12-06 19:24:58 +01:00
Phil Hord f7ba1e467b Force 32-bit math in abs()
In AVR the labs() function takes a 32-bit signed int parameter. On
the PC it's at least 64-bits and maybe more.  When we have a 32-bit
unsigned value we're taking the labs() of, coercing it to 32-bits
first turns our high-bit into a sign, but coercing it to 64-bits
does not.  This causes all our negative values to appear to be
really big positive ones.

Create a new function abs32() which always coerces its argument to
a int32_t first before return the abs value.  Use that function
whereved needed in dda.c.

This fixes a problem on the simulator which caused negative
direction movements to "never" end.
2013-12-06 19:24:58 +01:00
Markus Hitter fa1a7d4ef7 dda.c: deal with endstop hits while still accelerating.
Also, move_state.step_no must be read atomically.
2013-12-06 19:24:58 +01:00
Markus Hitter 5ee9a0bd3c dda.c: re-enable the hack with overly large rampup steps.
Until we have accurate rampup steps calculations, this hack is
neccessary for endstop searches.
2013-12-06 19:24:58 +01:00
Phil Hord 452e2e5cd9 Restore simulation build target.
This code was accidentally removed long ago in a botched merge. This
patch recovers it and makes it build again. I've done minimal testing
and some necessary cleanup. It compiles and runs, but it probably still
has a few dust bunnies here and there.

I added registers and pin definitions to simulator.h and
simulator/simulator.c which I needed to match my Gen7-based config.
Other configs or non-AVR ports will need to define more or different
registers. Some registers are 16-bits, some are 8-bit, and some are just
constant values (enums). A more clever solution would read in the
chip-specific header and produce saner definitions which covered all
GPIOs. But this commit just takes the quick and easy path to support my
own hardware.

Most of this code originated in these commits:

	commit cbf41dd4ad
	Author: Stephan Walter <stephan@walter.name>
	Date:   Mon Oct 18 20:28:08 2010 +0200

	    document simulation

	commit 3028b297f3
	Author: Stephan Walter <stephan@walter.name>
	Date:   Mon Oct 18 20:15:59 2010 +0200

	    Add simulation code: use "make sim"

Additional tweaks:

Revert va_args processing for AVR, but keep 'int' generalization
for simulation. gcc wasn't lying. The sim really aborts without this.

Remove delay(us) from simulator (obsolete).

Improve the README.sim to demonstrate working pronterface connection
to sim. Also fix the build instructions.

Appease all stock configs.

Stub out intercom and shush usb_serial when building simulator.

Pretend to be all chip-types for config appeasement.

Replace sim_timer with AVR-simulator timer:

The original sim_timer and sim_clock provided direct replacements
for timer/clock.c in the main code. But when the main code changed,
simcode did not. The main clock.c was dropped and merged into timer.c.
Also, the timer.c now has movement calculation code in it in some
cases (ACCELERATION_TEMPORAL) and it would be wrong to teach the
simulator to do the same thing. Instead, teach the simulator to
emulate the AVR Timer1 functionality, reacting to values written to
OCR1A and OCR1B timer comparison registers.

Whenever OCR1A/B are changed, the sim_setTimer function needs to be
called. It is called automatically after a timer event, so changes
within the timer ISRs do not need to bother with this.

A C++ class could make this requirement go away by noticing the
assignment. On the other hand, a chip-agnostic timer.c would help
make the main code more portable. The latter cleanup is probably
better for us in the long run.
2013-12-06 19:24:58 +01:00
Markus Hitter 2f81386a7a dda.c: simplify start conditions calculation. 2013-12-06 19:24:58 +01:00
Markus Hitter da77b678e3 look-ahead: take F_end into account on acceleration calculations. 2013-12-06 19:24:58 +01:00
Markus Hitter 83433cb071 look-ahead: take F_start into account on acceleration calculations. 2013-12-06 19:24:58 +01:00
Markus Hitter c1a6c244b3 dda.c: re-gain look-ahead compatibility.
We're here! Incredible high step rates as well as smooth
movements due to look-ahead.
2013-12-06 19:24:58 +01:00
Markus Hitter f0b9daeea0 dda.c/.h: move n and c back into the dda structure.
This is a preparation for starting a move from non-zero speeds,
which is needed for look-ahead. Keeping both variables in
move_state and doing the calculations in dda_start() is possible
in principle, but might not fit the tight time budget we have when
going from one movement to the next at high step rates.

To deal with this, we have to pre-calculate n and c, so we have
to move it back into the DDA structure. It was there a year ago
already, but moved into move_state to save RAM (move_state exists
only once, dda as often as there are movement queue entries).
2013-12-06 19:24:58 +01:00
Markus Hitter 4190d6ffb9 Fix endstop stop condition for clock-based acceleration.
This required a strategy change, since move_state.n is no longer
decreasing in steps of 1.
2013-12-06 19:24:58 +01:00
Markus Hitter 3988e47467 Implement Roland Brochards' new acceleration maths clock-based.
His implementation was done on every step and as it turns out,
the very same maths works just fine in the clock interrupt.
Reason for the clock interrupt is: it allows about 3 times
higher step rates.

This strategy is not only substantially faster, but also
a bit smaller.

One funny anecdote: the acceleration initialisation value, C0,
was taken from elsewhere in the code as-is. Still it had to be
adjusted by a factor of sqrt(2) to now(!) match the physics
formulas and to get ramps reasonably matching the prediction
(and my pocket calculator). Apparently the code before
accumulated enough rounding errors to compensate for the
wrong formula.
2013-12-06 19:24:58 +01:00
Phil Hord c695f1e4f7 Remove stale reference to endstops_stop
This was accidentally left out of the change at 13ec2d75.
2013-11-11 19:03:36 +01:00
Markus Hitter 5df8eeaacf dda.c: fix ACCELERATION_RAMPING #ifdefs. 2013-10-27 20:09:28 +01:00
Markus Hitter fe985a18d3 dda_lookahead.c: simplify bailout condition tests.
We have the nullmove flag already and the current move can't be
a nullmove, because in this case we wouldn't enter the function.
2013-10-27 20:01:51 +01:00
Markus Hitter 3343cfc753 dda.c: more notes on rampup_steps calculation. 2013-10-27 20:01:51 +01:00
Markus Hitter a97c65b940 dda.c: update last_dda also when idle. 2013-10-27 20:01:51 +01:00
Markus Hitter ccec75d9f8 dda.c: allow protected re-entry for time based stepper calculations.
This becomes more important when acceleration is calculated
there, too.
2013-10-27 20:01:51 +01:00
Markus Hitter 13ec2d7521 Move endstop handling into a time-based procedure.
Before, endstops were checked on every step, wasting precious time.
Checking them 500 times a second should be more than sufficient.

Additionally, an endstop stop now properly decelerates the movement.
This is one important step towards handling accidental endstop hits
gracefully, as it avoids step losses in such situations.
2013-10-27 20:01:10 +01:00
Markus Hitter 1aca61c277 Make lookahead basically working.
This means, modify existing code to let the lookahead algorithms
do their work. It also means to remove some unused code in
dda_lookahead.c and reordering some code to make it work with
LOOKAHEAD undefined.
2013-07-11 22:02:13 +02:00
Markus Hitter 5d6de1761b Enable internal pullups for endstops on demand, only.
The binary size impact is moderate, like 18 bytes plus
4 bytes per endstop defined.

The story is a follows:

The endstop logic can be used to use a touch probe with PCB
milling. Connect the (conductive) PCB surface to GND, the
spindle/mill bit to the signal line, turn the internal pullups
on and there you go.

However, doing so with pullups always enabled and while milling
under (conductive) water showed polished mill and drill bits to
become matte after a few hours of usage. Obviously, this small
0.5 mA current from the pullup resistors going through the
rotating mill bit is sufficient to get some spark erosion going.
That's bad, as spark erosion happening also means tools become
dull faster than neccessary.

With this patch, pullups are turned on while being used, only,
so this sparc erosion should go away.
2012-12-03 19:48:13 +01:00
Ben Gamari 677ebfcccd dda: Fix signed-ness mismatch in handling of dda->e_delta 2012-08-04 22:07:43 +02:00
Markus Hitter 674014cc70 dda.c: remove two, now obsolete warnings. 2012-08-04 22:07:34 +02:00
Markus Hitter 81f85b018d Move utility functions from dda.c to dda_math.c.
Simple cleanup, no functional change.
2012-08-04 22:07:24 +02:00
Markus Hitter 0068ed1e26 Use the new muldiv() to replace um_to_steps..().
This gets rid of overflows at micrometer to step conversion as
much as possible within 31 bits. It also opens the door to get
STEPS_PER_M configurable at runtime.

This also costs 290 bytes, unfortunately.
2012-08-04 22:01:16 +02:00
Markus Hitter 3d1ebf1186 Review power supply timeout.
- Move the variable from dda.c to pinio.c.

- Reset the timeout on each power on, to guarantee a minimum PSU on time.
2012-07-16 20:13:12 +02:00
Markus Hitter ac22a57329 dda.c: enable update_current_position() for the new E relative handling. 2012-05-11 13:50:49 +02:00
Markus Hitter 9dda3349be Revert the new relative handling for X, Y and Z.
These were commits 9dbfa7217e0de8b140846ab480d6b4a7fc9b6791 and
2b596cb05e621ed822071486f812eb334328267a.

There are several reasons why this new approach didn't work out well:

- The machine coordinate system is lost on relative movements.
  OK, we could keep tracking it, but this would mean even more
  code, so even more chances for bugs.

- With the lost coordinate system, no software endstops are possible.

- Neither of X, Y, Z will ever overflow.

- If a movement planner would appear one day, he'd have to handle
  relative movements as well. Even more code duplication.
2012-05-11 13:50:47 +02:00
Markus Hitter e5cc5ab066 dda.c: Fix a number of minor things, detected by Phord.
These were mistakes introduced with the last commit.
Thanks, Phord!
2012-05-11 13:50:35 +02:00
Markus Hitter 5f9ae5b087 Implement M82/M83 and handle relative movements entirely different.
Instead of converting them to absolute first, then back to
relative and having all the fuzz with working on the queue's
start vs. working at the queue's end, mark a movement as relative
and use this directly.
2012-05-11 13:50:33 +02:00
Markus Hitter 25b72b4ea3 dda.c: remove the hack to set a minimum delay.
This in no longer needed, as the timer handles very short delays
now properly.
2012-03-04 19:03:31 +01:00
Markus Hitter 07fcff1661 dda.c: initialize dda.c properly. 2012-03-04 19:03:20 +01:00
Markus Hitter 1996cb4167 dda.c: axis_to_step = ' ' is no longer needed.
The need for this was a result of failing code in timer.c, which
was fixed in recent commits.
2012-03-04 19:03:07 +01:00
Markus Hitter 962209dceb Teach ACCELERATION_TEMPORAL to respect maximum feedrates. 2012-03-04 19:02:57 +01:00
Markus Hitter e8db35ec76 dda.c: get rid of a unused variable warning. 2012-03-04 19:02:48 +01:00
Markus Hitter fd91ee7e8b dda.c: re-introduce ACCELERATION_TEMPORAL.
The implementation is slightly different this time, as it's not
using these famous bresenham algorithms. The intention is to
allow axis-independent movements, as it's required for
EMC-quality look-ahead.
2012-03-04 19:02:17 +01:00
Markus Hitter 53490bb318 Get rid of defered enabling of the step interrupt again.
This makes the code cleaner and the reduction of code
probably easily compensates for keeping global interrupts
enabled for a bit longer. Talked to macscifi about this.

Saves about 300 bytes of binary size.
2011-11-21 09:54:38 +01:00
Markus Hitter fcd11a6f24 dda.c: get rid of did_step.
We want to stop stepping as there are no steps left, not one step later.

Accordingly, we get rid of a small pause between two movements and
also have to decelerate one step earlier.
2011-11-21 09:54:35 +01:00
Markus Hitter 1ee4668e21 dda.c: also reset startpoint_steps.E on relative extruder movements.
Thanks to bgamari for identifying this bug.
2011-11-17 13:49:08 +01:00
Markus Hitter 64b1a23cd3 dda.c: fix a typo in update_current_position(). 2011-11-17 13:48:48 +01:00
Markus Hitter 4e5f51f01e Store distances in the TARGET strucure in micrometers for all axes.
This extends the previous commit from X to Y, Z and E.
2011-11-17 13:48:36 +01:00
Markus Hitter c96ea0c773 Store distances in the TARGET structure always in micrometers.
This is a intrusive patch and for now, it's done for the X axis only.
To make comparison with the former approach easier ...

The advantages of this change:

- Converting from mm to steps in gcode_parse.c and back in dda.c
  wastes cycles and accuracy.

- In dda.c, UM_PER_STEP simply goes away, so distance calculations
  work now with STEPS_PER_MM > 500 just fine. 1/16 microstepping
  on threaded rods (Z axis) becomes possible.

- Distance calculations (feedrate, acceleration, ...) become much
  simpler.

- A wide range of STEPS_PER_M can now be handled at reasonable
  (4 decimal digit) accuracy with a simple macro. Formerly,
  we were limited to 500 steps/mm, now we can do 4'096 steps/mm
  and could easily raise this another digit.

Disadvantages:

- STEPS_PER_MM is gone in config.h, using STEPS_PER_M is required,
  because the preprocessor refuses to compare numbers with decimal
  points in them.

- The DDA has to store the position in steps anyways to avoid
  rounding errors.
2011-11-17 13:48:26 +01:00
Markus Hitter 2f8a257a0d dda.c: make update_position() work with an empty queue. 2011-10-23 19:52:00 +02:00
Markus Hitter 7a458486ed dda.c: reset ramping after an endstop stop.
As the new homing code ramps up, but not down, we have to reset
move_state.c before starting the next move.
2011-10-23 19:51:55 +02:00
Markus Hitter 2f04a9e58c Update current_position only as needed.
This saves almost 200 bytes and 100 runs of
update_current_position() per second.
2011-10-23 19:51:54 +02:00
Markus Hitter df693c0113 config.h/dda.c: make endstop debouncing steps configurable. 2011-10-23 19:51:46 +02:00
Ben Gamari 45124316e3 Rework endstop homing.
The DDA is now used for motion control.

Note from Traumflug: thanks a lot for this excellent patch, Ben.
2011-10-23 19:51:40 +02:00
Markus Hitter b45969e57a Introduce stepper_enable() and stepper_disable().
This allows to heat up with disables steppers, even if all steppers
share a common enable pin.
2011-10-05 14:13:21 +02:00
Markus Hitter 47d8dedf24 dda.c: move dda->*_steps and dda->*_counter into move_state as well.
Now we're easily back into business with an 8-line buffer queue
on an '168.
2011-05-16 22:09:12 +02:00
Markus Hitter ed77abba31 Move dda->step_no into move_state as well. 2011-05-16 22:09:10 +02:00
Markus Hitter bebb619054 dda.c, RAMPING: 16 bits for move_state.n are sufficient. 2011-05-16 00:16:00 +02:00
Markus Hitter 826f534fff dda.c: remove a few obsolete comments. 2011-05-15 23:48:58 +02:00
Markus Hitter 2421b788b9 Move dda->c out of DDA into move_state as well.
This also required to get rid of the usage of this variable
when waiting for temperature in dda_queue.*. Hope I got this
later part right.
2011-05-15 20:34:38 +02:00
Markus Hitter 51be23177a dda: move dda->n out into a new state variable
This required to also introduce dda_init() and re-adjust the
number of accelerating steps a bit.

Goal of this is to make look-ahead possible by just reducing
the number of deceleration steps and acceleration steps of
the next move. dda->c and dda->n no longer go down to their
initial values, then.

Also, quite a number of variables in the dda struct are used only when
the dda is live, so there is no need to store that for each
movement of the queue.
2011-05-15 20:34:35 +02:00
Markus Hitter 2f7619ae26 ACCELERATION_RAMPING: remove the old ramping algorithm.
The new algorithm takes up 80 bytes more binary size
and 12 bytes more RAM, but offers opportunities to
compensate for that.
2011-05-15 13:10:40 +02:00
Markus Hitter 20093404e9 ACCELERATION_RAMPING: use the precalculated number of ramping steps.
This is an intermediate step where both, the old and the new
ramping calculation methods are used and compared. The commit
is done for the case the new method needs debugging in other setups.
2011-05-15 13:10:38 +02:00
Markus Hitter ec47633794 ACCELERATION_RAMPING: precalculate number of acceleration steps.
These numbers aren't used, yet, but they can be compared with the
numbers calculated by the traditional method.
2011-05-15 13:10:36 +02:00
Markus Hitter 26fb18d178 Define acceleration in mm/s^2 instead of some unspecified value.
This units thing nicely covers the fact we need the ACCELERATION
to precalculate ramping steps later.
2011-05-15 13:10:32 +02:00
Jim McGee 408718d2bb Limit effect on dda->c when computing reprap style acceleration.
This fix is really a hack to protect from overflow/underflows
in the acceleration code due to the limited precision of the
fixed point calculations. It does, however, protect the code
from accidently turning off the step timer or setting the
timer interval value outside of the range defined by the current
interval and the ultimate endpoint interval.

This is a cleanup replacement for the code posted on the reprap forum:
http://forums.reprap.org/read.php?147,33082,83467#msg-83467
2011-05-15 09:56:33 +10:00
Jim McGee 5dc0c80f0b Defer enabling of timer1_compa interrupt the end of the interrupt handler.
Specifically, disable interrupts just before returning and then enable
the timer interrupt if appropriate. This means that the timer interrupt
cannot actually fire until after the RETI, so the function cannot be
entered recursively.
2011-05-15 09:56:33 +10:00
Jim McGee 85a9f63dfb Pretest DEBUG_X constants for non-zero and && the test with all existing
& tests of the debug_flags. Currently the compiler is able to eliminate
the block and the & operation when the constant is zero, but since
the debug_flags variable is a volatile the compiler does not eliminate
the load of the variable. By pretesting and shortcutting the load is
eliminated. Saves a small number of bytes when the debug build is
disabled and costs nothing when it is enabled.
2011-05-15 09:56:33 +10:00
Jim McGee 1e198e16ea Fix handling of the steptimeout variable.
Steptimeout is used both inside and outside
of interrupts, and as such it needs special attention.
Specifically, the increment outside of the interrupt
context needs to occur when interrupts are disabled,
or a clear of the variable can be missed.

The variable was also made volatile. This is not strictly necessary
given the current code, but it is the more conservative approach
to dealing with the variable (and costs nothing in the current code).
2011-05-15 09:56:32 +10:00
Michael Moon 1b1aea7f41 try to prevent queue locking due to non-atomic accesses and interrupt mismanagement 2011-05-10 12:43:27 +10:00
Michael Moon 74e03b7df1 allow G92 to work again after 0389289 2011-04-26 18:19:00 +10:00
Michael Moon 03892894ed remove ACCELERATION_TEMPORAL, update current_position from main loop instead of step interrupt 2011-04-26 14:45:32 +10:00
Markus Amsler 4b7f8fba48 Fix absolute E positioning.
Now also works with M101/M103
2011-04-12 01:36:57 +02:00
Michael Moon 0dc7d77885 Massive Doxygen documentation addition
'make doc' then point your browser at doc/html/

Needs plenty of cleanup and polishing, but the main bulk is here

even documents your configuration! ;)
2011-03-22 01:34:36 +11:00
Markus Hitter 12516be978 dda.c: get rid of duplicate power_on() & friends. 2011-03-02 00:59:48 +01:00
Markus Amsler d85f821872 Disable z stepper after each move.
All z-axis I'm aware off hold their positions with powered down stepper.
2011-02-27 22:15:15 +01:00
Markus Amsler d2c0a84da7 Arduino ide doesn't like definitions in for loops. 2011-02-27 22:11:13 +01:00
Stephan Walter 8acb072e0b Actually set extruder enable pin if defined 2011-02-27 00:55:14 +11:00
Michael Moon 4aefda6f17 added integer square root algorithm for future use 2011-02-24 18:49:28 +11:00
John Gilmore fe034d5e35 graycode stepper operation, distilled to one line in dda.c
Which includes a seperate file (graycode.c) with the defines and additional variable declaration.
I went with the "graycode" spelling, as there's about ten times as many hits for that as for "greycode" on google. I've read that both spellings are acceptable, but whatever.

Signed-off-by: Michael Moon <triffid.hunter@gmail.com>
2011-02-06 16:42:08 +11:00
Michael Moon 096d7dfdf3 Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
Stephan Walter 3028b297f3 Add simulation code: use "make sim" 2010-10-21 11:05:55 +11:00
Michael Moon dd8a5cd377 UM_PER_STEP stayed floating a bit too long 2010-10-20 17:39:57 +11:00
Michael Moon 18565b776f attempt to fix precision underflow in UM_PER_STEP macros 2010-10-20 17:23:18 +11:00
Markus Hitter 468b212077 Move micrometer conversion from config.h(.dist) to
dda.c, where it's used.
2010-10-07 21:34:38 +02:00
Markus Hitter 4bddf3452f Move stepper macros from config.h(.dist) to dda.c, as they're not
meant to be configured by the user.
2010-10-07 21:34:29 +02:00
Markus Hitter 95939ecc22 Don't disable the stepper timer interrupt while stepping.
After lots of try and error the conclusion was, disabling this
interrupt makes the timer vulnerable to be messed up by
characters incoming over the serial line. So, now the
interrupt is enabled as a move starts and not disabled before
the move, and all subsequent moves are done.
2010-10-04 16:05:01 +02:00
Markus Hitter 94e0cce89b Don't set the timer on nullmoves, as dda->c isn't initialized, then. 2010-09-30 21:20:22 +02:00
Markus Hitter f6f2b7f44f Enhance ACCELERATION_RAMPING on short moves.
Problem was: For short moves, you have to ramp down before
reaching target speed. The point of return was set to half
of the number of total steps.

Now, what happens is there's an uneven number of steps? In
integer math, 3 / 2 = 1, so the move would ramp one step up,
one step down and ... well, one step even further down, resulting
in a really sloooow step. Slow, like a full second or so.

Adding one to the first half, the movement ramps two steps up,
one down and would do another step at minimum speed, if it wasn't
already at target position. This is about as accurate as we
can get it without introducing more code at interrupt time.
2010-09-25 18:11:45 +02:00
Markus Hitter 696baea16a Implement better machine speed limits checking. Do it for
each axis individually, as the combined speed of two or more
axes can be higher than the limit of a single one.

While this is tested to work well for all three acceleration
types, I'm not enthusiastic about the code, as it adds almost
500 bytes. Perhaps an efficient-coding-geek can help :-)
2010-09-24 16:08:11 +02:00
Michael Moon c1dbd869f5 minor fixes: comments, indenting, etc 2010-09-18 08:08:31 +10:00
Michael Moon 6ce5895819 Merge branch 'master' of github.com:triffid/FiveD_on_Arduino 2010-09-16 17:15:30 +10:00
Markus Hitter bd1e357c35 dda.c: remove ABSDELTA() and delta32() implementations as they're unused. 2010-09-14 19:45:23 +02:00
Michael Moon 004bc1b789 code cleaning
(cherry picked from commit c3333278beaca0d81023b7ee752530466b37f316)
2010-09-13 20:40:23 +10:00
Markus Hitter 2178ff4ac1 Implement acceleration ramping. Enjoy always smooth rides! 2010-09-10 02:09:04 +02:00
Markus Hitter 639f5237be Make acceleration, RepRap-style, disable-able. This is also
in preparation for introducing acceleration ramping.
2010-09-08 22:35:27 +02:00
Markus Hitter 548b79f3d6 dda.c: replaced can_step() with a more simple solution. This
saves a whopping 270 bytes in interrupt context.
2010-09-08 19:14:04 +02:00
Markus Hitter 0572687cb2 dda_create(): clear _all_ flags before proceeding. 2010-09-08 15:57:32 +02:00
Michael Moon 883c488107 fixed some mess from moving stuff around 2010-08-10 14:59:41 +10:00
Michael Moon 0b51c1d0ab Merge branch 'mendel-triffid'
Conflicts:
	dda.c
	gcode.c
	machine.h
	temp.c
2010-08-10 14:55:06 +10:00
Michael Moon 595b66a341 setting up new branch 2 2010-08-10 14:26:24 +10:00