Sprinter and Arduino 1.0

1,432 views
Skip to first unread message

sfisher10

unread,
Dec 14, 2011, 10:31:43 PM12/14/11
to MakerGear - Make Today, Change Tomorrow
In case anybody is interested, Sprinter will compile with Arduino 1.0
with the following changes:

Sd2Card.cpp

#include <WProgram.h> --> #include <Arduino.h>


SdFat.h

void write(uint8_t b); --> size_t write(uint8_t b);


SdFile.h

#include <WProgram.h> --> #include <Arduino.h>


void SdFile::write(uint8_t b) { --> size_t SdFile::write(uint8_t b)
{


Sprinter.h

#include <WProgram.h> --> #include <Arduino.h>


Also, the IDE will rename "Sprinter.pde" to "Sprinter.ino" as ".ino"
is the new default file extension.

Oasis Vali

unread,
Dec 23, 2011, 3:38:53 AM12/23/11
to MakerGear - Make Today, Change Tomorrow
Thanks! Havent tried it out yet, but I greatly prefer 1.0 so Im
praying this works :) Will let you know if it does

MC

unread,
Dec 26, 2011, 7:34:33 PM12/26/11
to MakerGear - Make Today, Change Tomorrow
Thanks for the info! Solved my issue.

sfisher10

unread,
Dec 28, 2011, 8:24:26 AM12/28/11
to MakerGear - Make Today, Change Tomorrow
When I added a SD card reader to my printer, I found that the Arduino
1.0 Print class implicitly promotes literal character and Uint8_t
parameters to integers. What this means is that a call to
Serial.print('g') for example, prints the decimal value "71" instead
of the letter 'g'.

To prevent the integer promotion, you can explicitly cast the
parameter as a char.

Another (sub-optimal) way is to change a literal character to a string
(change 'g' to "g"). Sprinter already does this in several places.



SdFatUtil.h

- for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.print(c);
+ for (uint8_t c; (c = pgm_read_byte(str)); str++)
Serial.print(char(c));



SdFile.cpp

- for (int8_t i = 0; i < indent; i++) Serial.print(' ');
+ for (int8_t i = 0; i < indent; i++) Serial.print(char(' '));

- Serial.print(' ');
+ Serial.print(char(' '));

- Serial.print(' ');
+ Serial.print(char(' '));

- Serial.print('.');
+ Serial.print(char('.'));

- Serial.print(dir.name[i]);
+ Serial.print(char(dir.name[i]));

- Serial.print('/');
+ Serial.print(char('/'));

- Serial.print(' ');
+ Serial.print(char(' '));

- Serial.print('-');
+ Serial.print(char('-'));

- Serial.print('-');
+ Serial.print(char('-'));

- Serial.print(':');
+ Serial.print(char(':'));

- Serial.print(':');
+ Serial.print(char(':'));
> > is the new default file extension.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
Message has been deleted
0 new messages