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.
This commit is contained in:
parent
d3f548a895
commit
c7b134bc65
15
mendel.c
15
mendel.c
|
|
@ -279,18 +279,13 @@ int main (void)
|
|||
}
|
||||
|
||||
#ifdef SD
|
||||
#include "delay.h"
|
||||
|
||||
if (gcode_sources & GCODE_SOURCE_SD) {
|
||||
c = sd_read_char();
|
||||
/* Demo code here again, just write the character to the serial line,
|
||||
leading to the file written as-is to there. This may help
|
||||
demonstrating correctness of the implementation. */
|
||||
if (c != 0) {
|
||||
serial_writechar(c);
|
||||
delay_us(1000);
|
||||
}
|
||||
else {
|
||||
/* Demo code: just read all the bytes without doing anything with
|
||||
them to allow measuring how long it takes to read a file. Report
|
||||
over serial when the file is done. */
|
||||
if (c == 0) {
|
||||
serial_writestr_P(PSTR("\nSD file done.\n"));
|
||||
gcode_sources &= ! GCODE_SOURCE_SD;
|
||||
// There is no pf_close(), subsequent reads will stick at EOF
|
||||
// and return zeros.
|
||||
|
|
|
|||
Loading…
Reference in New Issue