Arduino Forum

Development => Suggestions for the Arduino Project => Topic started by: tim7 on Sep 05, 2011, 03:54 am

Title: SD library problem in IDE v1.0 beta-3
Post by: tim7 on Sep 05, 2011, 03:54 am
A little error seems to have cropped up in the latest beta IDE.  In any sketch which uses the SD library, I get the following message:

Quote
C:\Users\Tim\Documents\Arduino\ide\v10b3\libraries\SD\File.cpp: In member function 'virtual size_t File::write(const uint8_t*, size_t)':
C:\Users\Tim\Documents\Arduino\ide\v10b3\libraries\SD\File.cpp:77: error: 'class SdFile' has no member named 'writeError'


This happens even with the example sketches.  Everything is fine with v1.0 beta-2, yet as far as I can see the SD library hasn't changed.  Any ideas?
Title: Re: SD library problem in IDE v1.0 beta-3
Post by: SurferTim on Sep 05, 2011, 03:04 pm
I took a short look at the code. The declaration for writeError is in
/libraries/SD/utility/SDFat.h

If you want to check, look for this. Line 44 in v0022:
Quote
class SdFile : public Print {
public:
  /** Create an instance of SdFile. */
  SdFile(void) : type_(FAT_FILE_TYPE_CLOSED) {}
  /**
   * writeError is set to true if an error occurs during a write().
   * Set writeError to false before calling print() and/or write() and check
   * for true after calls to print() and/or write().
   */
  bool writeError;


You might want to look there and see if something has changed.
Title: Re: SD library problem in IDE v1.0 beta-3
Post by: fat16lib on Sep 05, 2011, 04:16 pm
David Mellis is aware of this.

You can comment out the following code at about line 77 of arduino-1.0-beta3/libraries/SD/File.cpp

Code: [Select]
/*
  if (_file->writeError()) {
    setWriteError();
    return 0;
  }
*/


The error handling was moved to the write call but his code was not removed.
Title: Re: SD library problem in IDE v1.0 beta-3
Post by: mellis on Sep 05, 2011, 04:43 pm
I think you just want to change writeError() to getWriteError(), not comment out the code. 
Title: Re: SD library problem in IDE v1.0 beta-3
Post by: tim7 on Sep 05, 2011, 07:23 pm
OK, glad to hear it's a known problem.  IDE 1.0 is a big improvement over v0022 and I've been using it as much as possible.  Looking forward to the next beta-version.
Title: Re: SD library problem in IDE v1.0 beta-3
Post by: fat16lib on Sep 05, 2011, 09:09 pm
Changing writeError() to getWriteError() or commenting out the block will give identical results.

The call to SdFat::write() above the block calls setWriteError() and returns zero.