Schreib SDFat.h und SDFat.cpp um !
Am einfachsten, indem du in deinem Sketch in dieser Reihenfolge
#define SDSERIALLOG Serial2 // Monitoring über "Serial-2"
#include <SdFat.h>
und dann in SdFat.h
Code:
#ifndef SDSERIALLOG
#define SDSERIALLOG Serial
#endif
definierst, und danach in SDFile.cpp (oder überall) Serial durch SDSERIALLOG ersetzt.
Hi michael_x,
jetzt muss ich noch mal darauf zurückkommen:
Ich hab die Routine nicht in SDFile.cpp, sondern in SdFat.cpp gefunden. Ich bräuchte jetzt aber noch mal Hilfe von einem Profi.
Definiert ist die Routine so:
/** List the directory contents of the volume working directory to stdOut.
* \param[in] flags The inclusive OR of
* LS_DATE - %Print file modification date
* LS_SIZE - %Print file size.
* LS_R - Recursive list of subdirectories.
*/
void SdFat::ls(uint8_t flags) {
vwd_.ls(stdOut_, flags);
}
und zu stdout finde ich am Anfang der SdFat-Library folgendes:
#if USE_SERIAL_FOR_STD_OUT || !defined(UDR0)
Print* SdFat::stdOut_ = &Serial;
#else // USE_SERIAL_FOR_STD_OUT
class DefaultSerial : public Print {
public:
size_t write(uint8_t b);
};
size_t DefaultSerial::write(uint8_t b) {
while (((1 << UDRIE0) & UCSR0B) || !(UCSR0A & (1 << UDRE0))) {}
UDR0 = b;
return 1;
}
//------------------------------------------------------------------------------
static DefaultSerial defaultStdOut;
Print* SdFat::stdOut_ = &defaultStdOut;
#endif // USE_SERIAL_FOR_STD_OUT
Kann ich da irgendwas übergeben um die Ausgabe auf Serial2 umzuleiten?
Gruß/hk007
Edit:
ZU USE_SERIAL_FOR_STD_OUT hab ich noch das define in SdFatConfig.h gefunden:
/**
* Set nonzero to use Serial (the HardwareSerial class) for error messages
* and output from print functions like ls().
*
* If USE_SERIAL_FOR_STD_OUT is zero, a small non-interrupt driven class
* is used to output messages to serial port zero. This allows an alternate
* Serial library like SerialPort to be used with SdFat.
*
* You can redirect stdOut with SdFat::setStdOut(Print* stream) and
* get the current stream with SdFat::stdOut().
*/
#define USE_SERIAL_FOR_STD_OUT 0