Commit Graph

1299 Commits

Author SHA1 Message Date
Markus Hitter 4fdb2dac9e Remove file fuses.h.
Contents apparently nowhere used. Also not updated for often used
MCUs like ATmega2560 or ATmega1284P, so it can't be that
important.
2015-07-27 16:41:48 +02:00
Markus Hitter 3d005c4d60 mendel.c: remove redundant #include. 2015-07-27 16:34:13 +02:00
Markus Hitter 7212f3a23f board.nanoheart-v1.0.h: add a lost comment line. 2015-07-25 11:57:36 +02:00
Markus Hitter f09be1acbe Add configuration board.cnc-shield-v3.h.
Contribution by user madmike8 in the RepRap forum:
http://forums.reprap.org/read.php?147,33082,537026#msg-537026
2015-07-25 11:51:29 +02:00
Markus Hitter b3ff59fca1 run-in-simulavr.sh: make it aware of USER_CONFIG.
Now one can build and run tests with a custom configuration.
2015-07-24 17:37:43 +02:00
Markus Hitter c6a1f99758 Makefile-common: add perf. measurement config to regressiontests. 2015-07-24 15:17:43 +02:00
Markus Hitter 1509e5b3c8 testcases/config.h.Profiling: remove #include "arduino.h".
Was forgotten when moving this include into config_wrapper.h. Now
this config can also be used with USER_CONFIG.
2015-07-24 15:13:49 +02:00
Phil Hord 573dbfe576 Simulator: record serial data as comments, not as G-code.
We cheated before and sent the serial data in the simulator into
the G-code reporter so it could be line-buffered and then recorded
as comments in the trace-log. But this confuses the simulator
console output and is harder to manage. Revert to sending serial-out
data directly to the comment engine.

Also be less chatty about startup when connecting to a UART.
2015-07-17 16:34:20 +02:00
Phil Hord 503d2c75a1 Fix typos: "whether" and whitespace. 2015-07-17 16:16:42 +02:00
Markus Hitter 72253ed932 Revert "simulator.h: provide a minimalistic SPI fake."
After a number of simulator enhancements, it's no longer
necessary to keep SPI support entirely away from it.
2015-07-17 16:11:44 +02:00
Markus Hitter 7e649c83dc SD card: remove sd_read_char() also from the simulator.
This is related to the commit
  "SD card: move parsing closer to the metal."
2015-07-17 16:06:19 +02:00
Phil Hord 8a11a76063 Simulator: fix switch handling error.
getopt_long() requires a null entry at the end of the longopts
array. It also reports an error already when some switch is
wrong, so just exit silently when we get an unexpected value.
2015-07-17 16:03:31 +02:00
Phil Hord ad2a76b2df Add simulator SD card (and SPI, PFF) support.
Add simulator for SD card driver, plus add stubs for SPI and PFF
primarily to prevent the on-device code from being picked up by
the makefiles for the simulator.
2015-07-17 16:02:59 +02:00
Markus Hitter cd1eb4e250 Configtool: move board/printer.metadata to configtool/ ...
and rename it to board/printer.generic.h.
2015-07-17 13:38:22 +02:00
Markus Hitter 6b5156d459 Configtool: take advantage of the now recognized values.
This is for now to restore disabled values as well, not only
active ones. More uses are thinkable.
2015-07-17 13:38:15 +02:00
Markus Hitter 3795c7a36f Configtool: don't ignore disabled values.
Previously, values of ignored keys simply got lost and were
replaced with the ones from from the metadata file. Now this
value is preserved and perhaps, some time in the future, we'll
use this bit of information to to provide the right value when
re-enabling it.
2015-07-17 13:38:09 +02:00
Markus Hitter 27cf051f03 Configtool: de-duplicate insertValues().
No change in behaviour intended.
2015-07-17 13:38:02 +02:00
Markus Hitter 88b813c4ba Configtool: don't pick up values which no longer exist.
Previously they were dropped only at save time, which is too late
for the GUI. This is mostly for robustness, the case where a
value was removed from config files, but not yet from the GUI.
2015-07-17 13:37:55 +02:00
Markus Hitter a07e5a7d1e Configtool: don't try to parse help text in the loaded file.
This shouldn't change functionality and is for more robustness.
2015-07-17 13:37:48 +02:00
Markus Hitter a48d9edf67 Configtool: let the parsing method decide about values.
Shouldn't cause functional change.

So far, values commented out are still ignored, which is why the
used regexp changed. This will hopefully change in the future,
so a configuration can remember disabled values, too.
2015-07-17 13:37:42 +02:00
Markus Hitter d9e4cd1086 Configtool: let the parsing method decide what a name is.
This is mostly for code robustness.
2015-07-17 13:37:34 +02:00
Markus Hitter e7395c8dd8 Configtool: there are no simple comments in printer.metadata.
Accordingly, don't try to parse them. If they ever appear, they
need handling.
2015-07-17 13:37:26 +02:00
Markus Hitter eeee384ed6 Configtool: let the parsing method decide what a candidate is.
This is mostly for code robustness.
2015-07-17 13:37:18 +02:00
Markus Hitter 7acbf30e22 Configtool: ignore value options in board.metadata.
This solves the problem of choice menus being populated with too
many entries. Before, such menus would pick up values from
board.metadata as well as from the actually loaded file.

File printer.metadata contains no options, so no adjustment
needed there.
2015-07-17 13:37:11 +02:00
Markus Hitter 25c502d68b Configtool: save target candidate pins, not the metadata ones.
Previously, all the cancicates were replaced with the ones from
board.metadata, messing things up. Appears to work fine now,
candidates are preserved.
2015-07-17 13:37:04 +02:00
Markus Hitter 6b866e8c85 Configtool: get values back into config/*.metadata.
This has to work, else we can't provide default values for new
items.

Now loading a RAMPS board and just saving it results in an
identical file. Very well. Not so for other boards, because
disabled values still get lost.
2015-07-17 13:36:56 +02:00
jbernardis fb922735fd Configtool: process a metadata file before reading header files.
This should allow for easier addition of defines as Teacup evolves.
2015-07-17 13:36:48 +02:00
Markus Hitter 277de42b00 G-code parser: move gcode_source stuff ...
... from gcode_process.c/.h to gcode_parse.c/.h.
2015-07-17 13:31:10 +02:00
Markus Hitter 017e17801c SD card: move parsing closer to the metal.
This means a custom function in pff_diskio.c, disk_parsep(),
which replaces disk_readp(). Now it no longer reads a whole
sector for every single byte, but only once per line of G-code.

Performance is now much better than with buffered reading, the
1 MB file with 16'468 lines of comments, 64 bytes per line,
read and parses now in just 46 seconds, which means 358 lines
or 22'795 bytes per second.

Unfortunately all the binary size loss is gone compared to the
previous version, we're 68 bytes bigger than before buffer-less
parsing. Reason is the new function disk_parsep() in
pff_diskio.h. RAM usage is still low.

               ATmega...     '168   '328(P)   '644(P)     '1280
   FLASH:   22276 bytes   155.39%    72.51%    35.09%    17.27%
     RAM:    1331 bytes   129.98%    64.99%    32.50%    16.25%
  EEPROM:      32 bytes     3.12%     1.56%     1.56%     0.78%
2015-07-17 13:31:03 +02:00
Markus Hitter 75df5e3a0a SD card: don't read into a buffer, parse directly instead.
Formerly we took efforts to read only small chunks into a
(small) buffer, just to read this buffer byte by byte yet
again for parsing. It's more efficient and requires less
code to parse the character at read time directly. This
way we can read in chunks of exactly one line, making the
buffer obsolete.

First step is to implement this in mendel.c and in sd.c/.h.
This gets rid of the buffer already.

Very inefficient in pff.c and pff_diskio.c so far, more
than 40 minutes / less than 500 bytes/s for reading this
1 MB comments file. Reason is, for every single byte a
whole sector is read. Nevertheless, this attempt appears
to be on the right track.

Binary is 156 bytes smaller, 16 bytes less RAM:
               ATmega...     '168   '328(P)   '644(P)     '1280
   FLASH:   22052 bytes   153.82%    71.78%    34.73%    17.09%
     RAM:    1331 bytes   129.98%    64.99%    32.50%    16.25%
  EEPROM:      32 bytes     3.12%     1.56%     1.56%     0.78%
2015-07-17 13:30:55 +02:00
Phil Hord 3520f54db7 Makefile-example: add shortcut targets.
Add shortcuts to Makefile-example for regressiontests and program
so it can more easily be used as-is.

Remove the comment suggesting to use Makefile-AVR directly instead
since it is no longer more convenient, at least for the original
reason.
2015-07-17 13:29:22 +02:00
Phil Hord a3e956e70b Regressiontests: give SIM a "standard" config.
We should not fail the regression test if the user's config is
missing or misconfigured.

Also turn on -Werror for simulator validation, too. This might be
a bit presumptuous since we are dependent on the user's installed
gcc instance; but we already depending on him to be able to build
the simulator at all, so this doesn't seem to be too much of a
stretch.
2015-07-17 13:27:25 +02:00
Markus Hitter 6c7133792e Configtool: be helpful when trying to overwrite protected files. 2015-07-14 17:00:46 +02:00
Markus Hitter a8ab755f31 simulator.h: provide a minimalistic SPI fake.
This mostly means: there is no SPI simulator, so don't build
support for it. This was found by running the new regression tests.
2015-07-13 14:02:39 +02:00
Markus Hitter c42ccfff38 mendel.c: when to include simulator.h matters.
This partially fixes building the simulator. It was found by
running the new regression tests.
2015-07-13 14:02:39 +02:00
Markus Hitter 5489ddccab heater.c: set up timer 2 only when present.
This was found by running the new regression tests. ...and seeing
that this is pretty old code, I wonder how Teacup could ever
compile for the Teensy2 guys.
2015-07-13 14:02:24 +02:00
Markus Hitter df451d72fd mendel.c: set SIMINFO serial port only when BAUD is available.
This was found by running the new regression tests.
2015-07-13 14:01:27 +02:00
Markus Hitter 1eb7e73273 Introduce regression tests.
For now this is just a number of different configurations and a
makefile target, "make regressiontests", to build with them.
Further tests, e.g. using SimulAVR or the hostside simulator
to check actual behaviour of the firmware are welcome.
2015-07-13 14:00:33 +02:00
Markus Hitter bf3dd74f54 Configtool: also try toolpaths in more recent OS Xs.
This should address one part of issue #165.
2015-07-13 10:59:01 +02:00
Markus Hitter a57ce1f046 Configtool: add nanoheart configuration to protected files list.
This was forgotten when adding this configuration.
2015-07-10 14:25:10 +02:00
Ruslan Popov aa401650a7 Configtool: add SD card select pin support.
For now on the general pinout page, may be moved to a separate tab
together with display stuff later. --Traumflug
2015-07-10 14:25:10 +02:00
Markus Hitter 53dfab3be3 G-code parser: check for end of line in the parser.
This raises abstraction and even makes the binary a bit smaller
(2 bytes without SD, 14 bytes with SD).

A G-code file with 16'384 lines of comments, 64 bytes per line
( = 1 MB file size), is read and parsed from SD card in 2:47
minutes, or at a speed of 5924 bytes/second.
2015-07-10 14:19:48 +02:00
Markus Hitter cb1b9b3feb SD card: measures sizes and additionally enable FAT32 support.
FAT12 was not choosen, because it's virtually no longer in use
(allows volume sizes up to 32 MB, only) and would increase
binary size by another 248 bytes.

Measured sizes are in a comment in pff_conf.h, where one can also
enable or disable support for these variants.
2015-07-07 19:07:37 +02:00
Markus Hitter 23be2d1449 SD card: finally(!) implement printing from SD card.
Turned out to be pretty easy with all the more complex bits
already in place.

Strategy is to always parse a full line from one of the sources.
Accordingly, simply sending a character on the serial line stops
reading from SD until the line coming in over serial is completed.
2015-07-07 19:07:35 +02:00
Markus Hitter c7b134bc65 SD card: change demo code for performance measurement.
As we're around here, lets see how fast this implementation is.
All measurements are raw reading performance, without actual
parsing of the G-code.

With SPI_2X disabled (see line 8 in spi.h), performance is
195 seconds per megabyte, equivalent to about 50'000 baud.

With SPI_2X enabled, performance is 159 seconds per megabyte,
or 60'000 baud.

Still, SPI_2X is left disabled to increase reliability. Reading
from SD is faster by design, because there is no checksumming and
also no waiting for the "ok" to be sent back. In case reading
G-code from SD ever becomes a bottleneck, there are even more
opportunities in addition to enabling SPI_2X, like making sdbuffer
bigger, like micro-optimizing spi_rw() and similar stuff.
2015-07-07 14:36:46 +02:00
Markus Hitter d3f548a895 SD card: actually read the characters from the file.
Next to the implementation of sd_read_byte() as well as M24 and
M25, yet another demo: read the file and write it to the serial
line, to show correctness of the implementation.
2015-07-07 14:36:44 +02:00
Markus Hitter 5a0f7a0e72 G-code parser: anything but a number ends a field.
This should make the parser a bit more robust and also saves
6 bytes binary size.
2015-07-05 23:32:48 +02:00
Markus Hitter c6916e2a5b G-code parser: an asterisk always ends all fields.
This solves lines like these, with previous answer:

  M23 bla*3
  ok E: Bad M-code 233
  M23 123*92
  ok E: Bad M-code 88

It should also solve lines with ;-comment _and_ a checksum.
2015-07-05 23:32:48 +02:00
Markus Hitter 49345782f6 G-code parser: make space a field delimiter.
This is neccessary to allow file names with leading digits. It's
still possible to send commands like M105 with spaces in between
("M1 05") and also to put space between character and number, like
"X 15.0".
2015-07-05 23:32:48 +02:00
Markus Hitter bf6fd141c0 G-code parser: add a number of test strings.
We're about to change substantial parts of the parser, so we need
to verify it doesn't become messed up.
2015-07-05 23:32:48 +02:00