Commit Graph

38 Commits

Author SHA1 Message Date
Markus Hitter d5eb8cd916 DDA: avoid looking up the movebuffer array.
As we have mb_tail_dda now, that's no longer necessary. Using
something like movebuffer[mb_tail] is more expensive than
dereferencing mb_tail_dda directly.

This is the first time we see a stepping performance improvement
since introducing mb_tail_dda. 13 clock cycles faster on the
slowest step, which is 9 cycles faster than before that
introduction.

Binary size also a nice 94 bytes down.

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  19270 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: 395 clock cycles.
  LED on time average: 249.051 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 23648.
  LED on time minimum: 237 clock cycles.
  LED on time maximum: 438 clock cycles.
  LED on time average: 272.216 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 237 clock cycles.
  LED on time maximum: 395 clock cycles.
  LED on time average: 262.572 clock cycles.
2016-12-06 15:33:26 +01:00
Markus Hitter fb49aef14d Make temperature waiting independent from the movement queue.
The plan is to remove this stuff from the movement queue.

We still accept additional G-code ... until a G0 or G1 appears.
This e.g. allows to do homing or read temperature reports while
waiting.

Keep messages exactly as they were before, perhaps some Host
applications try to parse this.

This needs 2 bytes RAM and 138 bytes binary size. Performance is
unchanged. Let's see how this compares to the size reduction when
we remove the temperature handling code from the movement queue.

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  19646 bytes      138%       64%       31%       16%
     Data:   2177 bytes      213%      107%       54%       27%
   EEPROM:     32 bytes        4%        2%        2%        1%

  short-moves.gcode statistics:
  LED on occurences: 888.
  LED on time minimum: 280 clock cycles.
  LED on time maximum: 458 clock cycles.
  LED on time average: 284.653 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 23648.
  LED on time minimum: 272 clock cycles.
  LED on time maximum: 501 clock cycles.
  LED on time average: 307.275 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 272 clock cycles.
  LED on time maximum: 458 clock cycles.
  LED on time average: 297.625 clock cycles.
2016-12-05 13:56:09 +01:00
Robert Konklewski 03c8d71a56 Temp: have residency updates on 1s clock.
Temperature residency time / temperature achieved check is in
the order of seconds, while updates for residency time were being
called every 10ms - unnecessarily often.
2016-06-23 22:32:51 +02:00
Robert Konklewski 8e977d50ce Temp: have heater update on 250ms intervals.
Thermal managers (PID, bang-bang, etc.) assume they're being
ticked on 250ms intervals. In reality, they were being updated on
each temperature reading, which was between 10ms and 250ms. This
caused thermal management to malfunction.

https://github.com/Traumflug/Teacup_Firmware/issues/211
2016-06-23 22:32:51 +02:00
Ruslan Popov 2c48b9b188 Formatting source code.
No functional change.
2016-05-30 16:13:11 +02:00
Markus Hitter a13312d9a9 Display: introduce display queue.
Now we shouldn't experience wait cycles in i2c_write() during
typical display writes any longer. It should also distribute CPU
load of display writes a lot better.

Previously writing a line of text to the display would take
almost as long as it took to actually send it to the display,
because the I2C queue could hold only one transmission, which
effectively meant only one character. This could hold the main
loop for several milliseconds.

Now we queue characters, send them one by one, and return to the
main loop in between.

This costs 160 bytes program memory. Only 18 bytes RAM, because
the I2C queue was reduced accordingly. Now:

  Program:  24456 bytes
     Data:   1543 bytes
   EEPROM:     32 bytes
2016-04-27 23:54:14 +02:00
Markus Hitter a47c4b40df Display: add a primitive status display.
This isn't pretty at all, but it shows the principle.
Unfortunately it also exploits a bug in the I2C sending mechanism,
I2C sending hangs a few seconds after reset.
2016-04-26 15:36:11 +02:00
Markus Hitter d7b59e2d33 ARM: implement heater-arm.c partially.
Currently at a fixed frequency of 1 kHz and with a fixed duty
cycle of 10%, but PWM does work.

As it turns out, PIO0_11 is not usable for PWM, because its timer
is already in use for the Step timer, and had to be disabled for
Gen7-ARM.

Test: define a heater in board.gen7-arm.h and a square signal
of 1 kHz with 10% duty cycle should appear on the heater pin.
2015-08-13 16:41:33 +02:00
Markus Hitter 8f24fbaad4 ARM: get temp.c in.
No code changes, but quite a few removals of __ARMEL_NOTYET__
guards. 20 such guards left.

Test: M105 should work and report plausible temperatures.

Current code size:

    SIZES          ARM...     lpc1114
    FLASH  :  9460 bytes          29%
    RAM    :  1258 bytes          31%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:37 +02:00
Markus Hitter c118d00383 ARM: get clock.c in.
No code changes neccessary.

This code in ifclock(clock_flag_1s) in clock.c should give a nice,
accurate clock:

    static uint8_t minutes = 0, seconds = 0;

    seconds++;
    if ( ! (seconds % 60)) {
      seconds = 0;
      minutes++;
    }
    sersendf_P(PSTR("%su:"), minutes);
    if (seconds < 10)
      serial_writechar('0');
    sersendf_P(PSTR("%su\n"), seconds);

Current sizes are:

    SIZES          ARM...     lpc1114
    FLASH  :  4440 bytes          14%
    RAM    :   200 bytes           5%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:36 +02:00
Markus Hitter 99fdb99203 clock.c: make stuff used only in clock.c static to this file.
Better encapsulation, no functional change, no binary size change.
2015-08-01 16:22:10 +02:00
Markus Hitter d29737699f temp.h: remove indirection temp_tick(). 2015-04-21 02:51:31 +02:00
Markus Hitter f26623d173 Move clock stuff from timer.c/.h to clock.c/.h.
I guess that's where it belongs.
2014-10-18 20:57:32 +02:00
Phil Hord d3f49b3e95 DDA: Convert TARGET axis vars to array.
In preparation for more efficient and scalable code using axis-loops
for common operations, add two new array-types for signed and unsigned
32-bit values per axis. Make the TARGET type use this array instead of
its current X, Y, Z, and E variables.

Traumflug notes:

- Did the usual conversion to spaces for changed lines.

- Added X = 0 to the enum. Just for peace of mind.

- Excellent patch!

Initially I wanted to make the new array an anonymous union with the
old variables to allow accessing values both ways. This way it would
have been possible to do the transition in smaller pieces. But as
the patch worked so flawlessly and binary size is precisely the
same, I abandoned this idea. Maybe it's a good idea in other areas.
2014-08-31 19:03:17 +02:00
Phil Hord 96495fb9bb simulator: Make time-scale=0 a cmdline option
Teach the simulator to run with no delays when time-scale=0.

Let the user specify the time-scale on the command line.
2013-12-06 19:24:58 +01:00
Markus Hitter 47a5252230 Apply ATOMIC macros in a number of other obvious places. 2013-07-21 23:27:33 +02:00
Markus Hitter f3e502c1ef Fix auto-idle.
Powering on even with a heater set to zero doesn't work, as
temperature driven heaters are set to zero all the time. So,
the PSU was running all the time.

The bug was introduced with 569e3d504aafd1ffc8b279b5d7092970cef72287
2013-01-03 15:35:06 +01:00
Markus Hitter 042d9ddfc2 Move temp_all_zero() to heaters_all_zero().
We need the power supply for the heaters, after all, not for
the temperature sensors. Some heaters (e.g. fans) don't even have
a temp sensor.
2013-01-03 15:34:47 +01:00
Markus Hitter 915dc4294d clock.c: silence a compiler warning. 2012-09-29 23:01:56 +02:00
Markus Hitter 8f94d4b421 clock.c: make clock_10ms() and clock_250ms() static.
These shouldn't be called by outside code, use clock() instead.
Surprisingly, this saves another 12 bytes binary size.
2012-09-29 23:00:39 +02: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 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 4087357a70 clock.c: better debug display of positions. 2012-05-11 13:50:53 +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
Michael Moon a68ae12679 add NO_AUTO_IDLE option to prevent powercuts after inactivity, add temp_all_zero so power isn't cut if heater remains off for a while but has a non-zero set temperature 2011-06-14 23:05:13 +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 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
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 03892894ed remove ACCELERATION_TEMPORAL, update current_position from main loop instead of step interrupt 2011-04-26 14:45:32 +10:00
Michael Moon e1ebf74ba0 more gen3 updates courtesy of sliptonic via IRC 2011-03-24 11:48:54 +11: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 db8902b265 add newline after queue when debugging position 2011-03-05 15:12:34 +11:00
Markus Amsler 52c2788997 intercom: updating the extruder in 250ms intervals should be fast enough. 2011-02-21 15:52:17 +11:00
Michael Moon 71eafbf96b keep power on when heaters are active
Reported-by: Jacky2K@forums.reprap.org
2011-02-09 08:16:15 +11:00
Michael Moon 096d7dfdf3 Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
Markus Hitter bdfc4c5507 clock.c: Add a comment about interrupt priorities. 2010-10-04 16:04:47 +02:00
Michael Moon e78381c56d Move configuration to config.h.dist 2010-09-27 09:20:07 +10:00
Michael Moon 595b66a341 setting up new branch 2 2010-08-10 14:26:24 +10:00