Commit Graph

37 Commits

Author SHA1 Message Date
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 a2ce509bed Eliminate _delay(), delay() and _delay_us().
Doesn't change much, even the binary size stays the same. Much
cleaner code though, now we have only delay_us() and delay_ms().
2013-03-24 16:19:24 +01:00
Markus Hitter 2ebfd44530 Clean up some unused delay related stuff. 2013-03-24 16:19:21 +01:00
Markus Hitter d51ec02cdf dda_queue: optimize enqueue().
Suggestion by ItsDrone, see
http://forums.reprap.org/read.php?146,174364,174364#msg-174364
2013-02-05 14:10:27 +01:00
Markus Hitter ba05d6a0cd Give up on REPRAP_HOST_COMPATIBILITY.
Was never really accepted and these days, hosts usually adjust
to the firmware instead of the other way around.
2012-12-03 19:50:14 +01:00
Markus Hitter f06b013179 clock.c: introduce clock().
This simplifies calls to clock_10ms() a bit and saves 18 bytes
binary size.
2012-09-29 23:00:24 +02:00
Markus Hitter 9c489911b6 timer.c: get rid of explicitely disabling the step timer.
This is no longer neccessary, as the step timer is not designed to
fire always exactly once.

Saves 54 bytes binary size.
2011-11-21 09:54:41 +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 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 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
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
Bas Laarhoven 0dd3b7a892 Allow for queue sizes that are not a power of 2.
This prevents nasty surprises because this restriction is not mentioned in the configuration files. It also allows better tuning of performance against memory usage.

Traumflug: costs 18 bytes flash, so it's bearable.
2011-08-16 14:39:03 +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
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 8378aa04fc Address issues with interrupts and the shared variables used to
manage the movebuffer (mb_head, mb_tail, movebuffer).

The approach taken is to leave all of the variables non-volatile
and use memory barriers to control reads/writes. read/modify/write
operations that can be done outside of the interrupt context are
protected by disabling interrupts.

Also, manually cache the pointer to the movebuffer of interest
as the compiler does a poor job of reusing the pointer even in
places that it could.

There are still some groups of accesses to the movebuffer data that need
to be protected by disabling interrupts, but these are all related
to sending back debug data. The error will cause occassional mismatched
values to be sent back via the serial connection, but they do not
affect the actual operation of the code, so they will be addressed
in a separate checkin.

Conflicts:

	dda_queue.c
2011-05-15 09:56:33 +10:00
Jim McGee f22e691fee Convert the clock_flag variable into 3 separate varables.
This costs 2 bytes of ram, but saves 60 bytes of flash. Doing so
also eliminates the need to disable interrupts while clearing flags
in the ifclock macro.

Conflicts:

	clock.c
	timer.c
	timer.h
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 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
Michael Moon 16944d4394 try to deal with consecutive null moves 2011-03-05 15:55:55 +11:00
Michael Moon da9bfc9f6f print_queue no longer adds a newline 2011-02-20 11:37:12 +11:00
Michael Moon 096d7dfdf3 Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
Michael Moon 4b41a5eeab use avr-libc atomic stuff instead of manual SREG manipulation 2010-10-21 11:05:56 +11:00
Stephan Walter 3028b297f3 Add simulation code: use "make sim" 2010-10-21 11:05:55 +11:00
Michael Moon d0c3744f92 add flush queue for emergency stop 2010-10-20 17:54:13 +11:00
Michael Moon e3d0aa7b62 split delay functions into separate files 2010-10-11 10:12:35 +11:00
Markus Hitter f799228a8e Remove old XON/XOFF implementation, as it's redundant now. 2010-10-05 21:04:06 +02:00
Markus Hitter 5e1ce4ec96 Refined the check wether the timer interrupt is enabled,
as per triffid's request.
2010-10-05 13:20:28 +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 f56e121473 dda_queue.c: clean out an unused comment. 2010-10-04 16:04:49 +02:00
Markus Hitter 2fac65d172 dda_queue.c: restart XON/XOFF only if the queue is at least half drained. 2010-10-04 16:04:43 +02:00
Markus Hitter 90fca50535 dda_queue.c/.h: merge enqueue() and enqueue_temp_wait(). This
saves almost 200 bytes.
2010-09-30 21:55:39 +02:00
Michael Moon e78381c56d Move configuration to config.h.dist 2010-09-27 09:20:07 +10:00
Michael Moon e5d393a592 more code cleanup 2010-09-12 14:24:19 +10:00
Michael Moon 48cf0e05d7 some code cleanup, added M114, wrapped M25[0..5] in ifdef DEBUG wrapper 2010-09-12 12:54:58 +10:00
Markus Hitter 8b5e21be51 Make XON/XOFF flow control actually work. Still disabled by default. 2010-09-08 19:17:50 +02:00
Markus Hitter b2e1cfd8b5 Make XON/XOFF flow control compile. 2010-09-08 19:16:18 +02:00
Michael Moon 595b66a341 setting up new branch 2 2010-08-10 14:26:24 +10:00