Commit Graph

41 Commits

Author SHA1 Message Date
Markus Hitter ec9e84a068 gcode_parse.c: assume G1 only for stuff which might actually move.
Previously, even comments were run through dda_create(), quite a waste
of time.
2013-12-06 19:24:58 +01:00
Phil Hord cfa4857550 simulator: cmdline switches for output options
Teach simulator several command line options to control console output
of info messages, gcode traces, data_recorder output, etc.

Also move gcode output to sim_gcode instead of sending directly to
datarecorder.
2013-12-06 19:24:58 +01:00
Phil Hord 2b8a5d3b5a simulator: record g-codes in datalog
Add comment stream to datalog output so we can store g-codes and
other events that occur during simulation.
2013-12-06 19:24:58 +01:00
Markus Hitter 63d3f012a8 gcode_parse.c: process incoming digits earlier.
Idea and patch from ItsDrone, see
http://forums.reprap.org/read.php?146,174364,174550#msg-174550

Thanks, ItsDrone.
2013-03-24 16:17:02 +01:00
Markus Hitter 931d81af58 gcode_parse.c: checksum the characters actually received.
Wow! It took something like two years to expose (and get
developer attention of) such a bug: the checksum was calculated
based on the uppercased characters parsed, not the ones actually
received over the line.
2012-08-16 23:43:21 +02:00
Markus Hitter 50adc11392 gcode_parse.c: drop an obsolete comment. 2012-05-11 13:51:06 +02:00
Markus Hitter 4c84b31536 gcode_parse.c, decfloat_to_int(): use a smaller variable.
This saves 78 bytes and likely some processing time.
2012-05-11 13:51:01 +02:00
Markus Hitter 5a9a134ae4 gcode_parse.c: review decfloat_to_int() yet again.
This time, raise range at the cost of some precision for the
newly explored areas.
2012-05-11 13:50:57 +02:00
Markus Hitter eaf6c453be Introduce gcode_init() and honor E_ABSOLUTE as the default. 2012-05-11 13:50:51 +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 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 34ab76fe6e gcode_parse.c: review decfloat_to_int() again.
Finally, significant simplifications worked out while
keeping micrometer accuracy for up to 4290 mm.
2012-05-11 13:50:26 +02: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
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
Ben Jackson f8d8b2a471 gcode_parse.c: Send newline as char rather than PSTR 2011-05-08 00:37:03 +10:00
Markus Hitter ee481864fa gcode_parse.c: get rid of the denominator variable in decfloat_to_int().
This allows for better optimisation and saves 100 bytes binary size
accordingly. For denominator = 1, the algorithm is also significantly
simpler.
2011-04-15 02:12:13 +02:00
Markus Hitter 6896aa5236 gcode_parse.c: join the upper and the lower formula in decfloat_to_int().
This also makes rounding more accurate with exponent > 0.
Saves another 40 bytes binary size.
2011-04-15 02:12:10 +02:00
Markus Hitter 8cf8a8a44a gcode_parse.c: get rid of rounding[].
This saves 8 bytes of flash and, more important, 16 bytes of RAM.
2011-04-15 02:12:07 +02:00
Markus Hitter f41dd9c098 gcode_parse.c: make all usages of decfloat_to_int()...
... to divide either by 1 or 1000. Accordingly, a flag
can be used instead of the actual value, shrinking code
size by 70 bytes.
2011-04-15 02:12:02 +02:00
Michael Moon ae33cb7fa2 start implementing absolute E support 2011-04-09 09:16:05 +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
Markus Hitter 03b52e0340 gcode_parse.c: don't double-initialize last_field or read_digit.
Saves 64 bytes binary size.
2011-03-06 23:30:15 +01:00
Michael Moon c177756913 don't mess up return data stream if numbers have too much precision 2011-03-05 15:54:36 +11:00
Markus Hitter 5c0dde4e14 Changed M110 to match the description in the RepRap Wiki. 2011-03-03 09:40:55 +01:00
Markus Hitter bdeb4827fc gcode_parse.c: replace some ints by uints to double the range.
This is without accuracy or other losses and should finally make
decfloat_to_int() free of variable overflow within the decribed
ranges. Surprisingly, this costs 14 bytes program size.
2011-02-27 11:51:19 +01:00
Markus Hitter f985de8a54 gcode_parse.c: make decfloat_to_int handle all uints.
This saves 10 bytes of binary size and possible headaches (negative factors).
2011-02-25 11:54:22 +01:00
Markus Hitter 758893c275 gcode_parse.c: ditch ASTERISK_IN_CHECKSUM_INCLUDED. 2011-02-25 11:49:51 +01:00
Markus Hitter 2c53dbe2a8 gcode_parse: limit decimal ranges by decfloat_to_int()'s demands.
Formerly, it was limited by variable bit ranges, which allowed
more than decfloat_to_int() can swallow.
2011-02-23 02:52:51 +01:00
Markus Hitter 0dc623d4eb gcode_parse.c: added comments, which show possible variable overflows.
Stay tuned, the fix is just around the corner.
2011-02-23 02:52:27 +01:00
Michael Moon 72adba5a58 apparently repg expects N preceding line numbers in resend requests 2011-02-19 13:09:21 +11:00
Michael Moon d06a365f54 G4 uses millisecond units now apparently, instead of seconds 2011-02-17 14:05:13 +11:00
Markus Amsler 3aa7fc83e4 M140: S value is a temperature 2011-02-15 13:21:45 +11:00
Michael Moon 79674da51b try to make E behave 2011-02-12 22:20:18 +11:00
Stephan Walter 4febbea2f8 fix decfloat_to_int, Less divisions in decfloat_to_int.
Signed-off-by: Michael Moon <triffid.hunter@gmail.com>
2011-01-11 19:20:17 +11:00
Michael Moon 1fa0036008 fix arithmetic error 2011-01-10 10:15:42 +11:00
Markus Hitter 719a9d32b5 gcode_parse.c: Limit the digits right of the decimal.
Previously, variables in decfloat_to_int() could overflow due to
excess precision, like Z2.0000000.
2011-01-08 12:15:13 +11:00
Michael Moon 56ce863024 fix typo 2011-01-07 23:13:00 +11:00
Michael Moon 096d7dfdf3 Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
Michael Moon 209dfe66bd prepare for protocol changes ie responses after ok instead of separate line 2010-10-21 21:44:28 +11:00
Michael Moon 56c355c5bd split gcode parse/process into separate files for readability 2010-10-20 17:51:49 +11:00