Commit Graph

1156 Commits

Author SHA1 Message Date
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
Michael Moon 983bcfdd46 SD card: initial shoehorning of SD code, part 2.
Part 2 is to implement M23: select file. That's more than just a
few lines, as we also have to teach the gcode-parser to collect
strings.

For now the file is simply tested for successful opening, no
actual printing, yet.

About build size: during development there was another
implementation, which didn't abstract SD card functions into
sd.c/.h, but put them into gcode_process.c directly. At the
feature completeness of this commit, the other implementation
used 70 bytes flash less, but also 23 bytes more RAM. So I decided
for the more abstracted/encapsulated version. --Traumflug

Also, this adds 14 bytes binary size even without SD card support.
A lot more #ifdefs around each use of next_target.read_string
would remove this, but after all we do care a bit about
readability of the source code, so let's sacrify these 14 bytes
to it. --Traumflug
2015-07-05 23:32:48 +02:00
Michael Moon 8f2e1e59ac SD card: initial shoehorning of SD code, part 1.
Part 1 is, implement

 - M20: List SD card.
 - M21: Initialize SD card (has to be done before listing).
 - M22: Release SD card.

Do all this in one chunk, splitting this up wouldn't allow to test
the result.
2015-07-05 23:32:48 +02:00
Markus Hitter 03e720d2ac pff.c/.h: add pf_unmount().
It's not mandatory to unmount cards, just make sure subsequent
card operations fail.
2015-07-05 23:32:48 +02:00
Markus Hitter bf1fa5f269 SD card: add a note about a possible performance optimisation. 2015-07-05 23:32:48 +02:00
Markus Hitter 30ce8eb1b4 SD card: remove the demonstration code.
We're about to do some real stuff ...
2015-07-05 23:32:48 +02:00
Markus Hitter 7762408d5c SD card, pff.c: silence a warning.
Let the preprocessor decide wether this piece of code is compiled
at all. Previous behaviour was to compile it unconditionally and
rely on the optimizer to remove it after that. Trusting the
optimizer is fine, but only if the code is warning-free in all cases.
2015-07-05 23:32:48 +02:00
Markus Hitter 9de0c65460 SD card: add the layer between hardware and Petit FatFs.
This is all the commands to read from and write to SPI,
initializing the card, read in blocks and so on. This should
make Petit FatFs actually usable.

So far read-only and no M-codes to let end users play with
this stuff.

The demonstration code was changed to list the SD card's
top level directory over and over again.
2015-07-05 23:32:48 +02:00
Markus Hitter fe9ef63225 SD card: store sample code for the hardware layer.
Fetched from http://elm-chan.org/fsw/ff/00index_p.html.

There is also sample code for the bigger brother, FatFs, here:
http://elm-chan.org/fsw/ff/00index_e.html. These FatFs examples
are bigger (600 lines of code vs. 260 lines), but are also
for a lot more platforms available.
2015-07-05 23:32:48 +02:00
Markus Hitter 0a013d6e5e SD card: wrap Petit FatFs code in #ifdef SD.
No need to compile this when not needed and also make sure it's
nowhere used with SD card support disabled.
2015-07-05 23:32:48 +02:00
Markus Hitter 846d575aee SD card: add Petit FatFs to Teacup Firmware.
Some modifications to avoid file name conflicts with other parts and
make it compile. As the glue code to the hardware (spi.c/.h) is
still missing, there are a few warnings, of course.

Changes to this library are tracked in pff.c.
2015-07-05 23:32:48 +02:00
Markus Hitter a9aa690cb3 SD card: store Petit FatFs original sources.
Fetched from http://elm-chan.org/fsw/ff/00index_p.html, version R0.03.

Storing original code separately shall ease diff'ing them when a
new release comes out.
2015-07-05 23:32:48 +02:00
Markus Hitter 63c4dbaea9 mendel.c: do module enabling differently.
Same result, but 8 bytes less binary size. With SD card disabled,
binary size is now the same as before getting SPI running.
2015-07-05 23:32:48 +02:00
Markus Hitter 1fb3ece31e SD card: establish spi.c/.h and sd.c/.h and get SPI running.
For now this is just a nice demonstration on how to send bytes
over SPI. Add SD_CARD_SELECT_PIN to your configuration board
file manually to see data signals on MOSI dancing on the scope.

The TODO's about SS in arduino*.h were wrong, SS does have a
chip-specific special meaning (used in SPI multi-master or SPI
slave mode). Still, a #define MAX6675_SELECT_PIN is missing.

Squashed in this commit from the SPI development topic branch to
get this first step working:

Author: jbernardis <jeff.bernardis@gmail.com>
2015-02-04 22:35:07
mendel.c: disable SPI in power management only when not needed.

If we want to talk to a SD card connected to SPI, we need SPI
powered, of course.

From Traumflug: nice catch, Jeff!
2015-07-05 23:32:46 +02:00
Markus Hitter b4145e683a Configtool: work around a URL-open bug on some Linuxes.
Not exactly ideal, but the best I could find so far.

This is work related to issue #159.
2015-07-01 16:42:38 +02:00
Markus Hitter 80626eb528 Configtool: Add "Report problem" function.
The idea is to open the user's email client automatically, so
(s)he has not much more to do than to write a sentence about what
went wrong. As easy as possible!

This is work related to issue #159.
2015-07-01 16:42:36 +02:00
Ruslan Popov a13e00893d Add support for the NanoHeart board.
See http://blog.securelayer.ru/doku.php/reprap/electronics/nanoheart
2015-07-01 11:39:36 +02:00
Markus Hitter 113b23ca2c Configtool: add "About Teacup" function.
It's a nice thank you and listing of the top 10 contributors.

This is work related to issue #159.
2015-06-10 13:56:39 +02:00
Markus Hitter 652b129b20 Configtool: add help menu.
This is "Help", "Report problem" and "About Teacup". Functionality
behind the latter two forthcoming.

This is work related to issue #159.
2015-06-10 13:56:39 +02:00
Markus Hitter 03b68e2738 SD card: remove sd.c
This file was never in use and actually didn't even compile.
It didn't disturb so far because its whole content was wrapped
in #if 0. Recently it was fixed to at least compile, but code
quality was found to be poor enough to justify looking for
something written more carefully, which was found in FatFs
sample code.
2015-06-10 13:56:39 +02:00
Markus Hitter 9ea3941ffe gcode_process.c: be more explicit about X_MIN,... type.
Big surprise, this makes the binary a whopping 286 bytes smaller
with software endstops enabled. Looking at the produced assembly,
the former code caused gcc to do the float -> integer conversion
at runtime, using a __floatsisf(). Now the X_MIN, X_MAX... values
are compiled in as integers directly.

This is work related to issue #157.
2015-06-10 13:56:39 +02:00
Markus Hitter fa19a5ceb8 Add source file for the Teacup logo. 2015-06-10 13:56:13 +02:00
Markus Hitter 3b02ba5376 gcode_process.c: refine description for G28. 2015-06-06 20:09:19 +02:00
Markus Hitter c4582e605a Refine help text for soft axis limits. 2015-06-06 20:09:06 +02:00
Markus Hitter 6f7a4122a0 Configtool: allow travel limits to be floats.
This is work related to issue #157.
2015-06-06 20:08:54 +02:00
Markus Hitter 75d110cb53 build.py: align sizes report.
No functional change.
2015-06-06 12:06:41 +02:00
Markus Hitter 0cab7ec540 Configtool: improve search for avrdude.conf.
Should now also work for Arduino 1.5.x and up.

This is work related to issue #158.
2015-06-06 12:06:41 +02:00
Markus Hitter f9d0a1bf35 Configtool: work around a ld.exe problem.
See committed comment for details.

This is related to issue #158.
2015-06-06 12:06:40 +02:00
Markus Hitter b74b066db5 Configtool: allow all Windows versions, not just "win32".
This is work related to issue #158.
2015-06-06 12:06:04 +02:00
Markus Hitter 8b63505d53 Configtool: find executables on Windows.
Probably no surprise for users of this platform, executables have
a .exe suffix :-)

This partially solves issue #158.
2015-06-06 12:05:13 +02:00
Markus Hitter 389dfdd3a1 Configtool: wait before erroring out.
When double-clicking configtool.py, these error messages are
never visible, because the window running the command closes
immediately. Give 10 seconds for reading.

This is related to issue #158.
2015-06-06 12:05:02 +02:00
Yiannis Mandravellos fb249214f0 dda.c: fix overflow for large steps/meter values.
The trick is to use doubles earlier. As these calculations are
optimised out anyways, binary size and performance is kept.

Verified to have an identical outcome on a few common steps/mm and
acceleration cases.
2015-06-06 12:04:52 +02:00
David Forrest 6820e2cc0a gcode_parse.c: fix E debugging message.
This should complete issue #87.
2015-06-06 12:04:36 +02:00
Markus Hitter 3023c74178 Move branch eeconfig to the attic.
This branch gained no attendance for years. With the advent of
Configtool it becomes even more unlikely this ever becomes part
of the standard distribution. See also attic/eeconfig/README.
2015-06-06 12:04:10 +02:00
Markus Hitter eb122a96a5 Configtool: refine settings tooltips.
Most importantly, Arduino IDE tools can be used on any operating
system.
2015-05-31 21:50:08 +02:00
jbernardis 40c23e7970 Configtool: restore alignment of thermistor values in board file.
This should solve issue #154.
2015-05-31 12:53:57 +02:00
jbernardis 972e0cbb3d addsensordlg.py: fix a typo.
When choosing an SH preset, preset value 6 was assigned to both
parameter 6 and parameter 7.

This was mentioned in issue #155.
2015-05-31 11:44:53 +02:00
jbernardis 4597fd0c51 Configtool: reset/restore thermistor presets.
The sensor dialog now checks present values against the list of
presets. This means, if a preset is used and then modified, the
preset choice jumps to <none>. It also means presets are recognized
when modifying a temperature sensor.

This should solve issue #155.
2015-05-31 11:39:12 +02:00
Markus Hitter dbf43c8e78 Configtool: provide only free heater pins on heater creation. 2015-05-31 11:27:15 +02:00
Markus Hitter b813df95ff Configtool: add heater modify button.
Also turn PWM by default on.
2015-05-31 11:27:15 +02:00
Markus Hitter 0f5990b2eb Configtool: don't color heater/sensor list items.
Validation is no longer required, as we now validate in the
creation dialog already. And coloring one item in a two-item list
almost looks like this item were highlighted.
2015-05-31 11:27:12 +02:00
Markus Hitter b3bc26c6f4 Configtool: adjust background color of controls, too.
That is, buttons and choices. Coices apparently don't work. Tried
a bit on the table heaters of the sensor and heater lists, but
found nothing which would result in an effect. This control is
not exactly well documented.
2015-05-30 21:21:00 +02:00
Markus Hitter 9976640d92 Configtool: color background matching the background picture.
Actual color is easily changeable in Decoration, as this is a
Singleton.
2015-05-30 19:20:38 +02:00
Markus Hitter 95d7f0fa1e Configtool: resize the window properly.
This means, including the background panel and background picture.
2015-05-30 18:41:02 +02:00