SD file updates
This commit is contained in:
parent
82fff87e16
commit
614a86a380
|
@ -26,11 +26,15 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#include "Sd2Card.h"
|
||||
|
||||
#include "../Marlin.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// send command and return error code. Return zero for OK
|
||||
uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) {
|
||||
|
|
|
@ -27,17 +27,18 @@
|
|||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#ifndef SD2CARD_H
|
||||
#define SD2CARD_H
|
||||
|
||||
#ifndef Sd2Card_h
|
||||
#define Sd2Card_h
|
||||
/**
|
||||
* \file
|
||||
* \brief Sd2Card class for V2 SD/SDHC cards
|
||||
*/
|
||||
#include "SdFatConfig.h"
|
||||
#include "SdInfo.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** init timeout ms */
|
||||
uint16_t const SD_INIT_TIMEOUT = 2000;
|
||||
|
@ -239,7 +240,5 @@ class Sd2Card {
|
|||
bool waitNotBusy(uint16_t timeoutMillis);
|
||||
bool writeData(uint8_t token, const uint8_t* src);
|
||||
};
|
||||
#endif // Sd2Card_h
|
||||
|
||||
|
||||
#endif
|
||||
#endif // SD2CARD_H
|
||||
|
|
|
@ -27,10 +27,14 @@
|
|||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
|
||||
#include "Marlin.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#include "SdBaseFile.h"
|
||||
|
||||
#include "../Marlin.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// pointer to cwd directory
|
||||
SdBaseFile* SdBaseFile::cwd_ = 0;
|
||||
|
@ -1822,5 +1826,4 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
|
|||
void (*SdBaseFile::oldDateTime_)(uint16_t &date, uint16_t &time) = 0; // NOLINT
|
||||
#endif // ALLOW_DEPRECATED_FUNCTIONS
|
||||
|
||||
|
||||
#endif
|
||||
#endif // SDSUPPORT
|
||||
|
|
|
@ -26,18 +26,19 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#ifndef SdBaseFile_h
|
||||
#define SdBaseFile_h
|
||||
#ifndef SDBASEFILE_H
|
||||
#define SDBASEFILE_H
|
||||
/**
|
||||
* \file
|
||||
* \brief SdBaseFile class
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
|
||||
#include "SdFatConfig.h"
|
||||
#include "SdVolume.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* \struct filepos_t
|
||||
|
@ -488,5 +489,4 @@ class SdBaseFile {
|
|||
#endif // ALLOW_DEPRECATED_FUNCTIONS
|
||||
};
|
||||
|
||||
#endif // SdBaseFile_h
|
||||
#endif
|
||||
#endif // SDBASEFILE_H
|
||||
|
|
|
@ -26,16 +26,14 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief configuration definitions
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#ifndef SDFATCONFIG_H
|
||||
#define SDFATCONFIG_H
|
||||
|
||||
#ifndef SdFatConfig_h
|
||||
#define SdFatConfig_h
|
||||
#include <stdint.h>
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* To use multiple SD cards set USE_MULTIPLE_CARDS nonzero.
|
||||
|
@ -128,7 +126,5 @@
|
|||
#define MAX_VFAT_ENTRIES (2)
|
||||
/** Total size of the buffer used to store the long filenames */
|
||||
#define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
|
||||
#endif // SdFatConfig_h
|
||||
|
||||
|
||||
#endif
|
||||
#endif // SDFATCONFIG_H
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#ifndef SdFatStructs_h
|
||||
#define SdFatStructs_h
|
||||
#ifndef SDFATSTRUCTS_H
|
||||
#define SDFATSTRUCTS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PACKED __attribute__((__packed__))
|
||||
/**
|
||||
|
@ -649,7 +649,5 @@ static inline uint8_t DIR_IS_SUBDIR(const dir_t* dir) {
|
|||
static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
|
||||
return (dir->attributes & DIR_ATT_VOLUME_ID) == 0;
|
||||
}
|
||||
#endif // SdFatStructs_h
|
||||
|
||||
|
||||
#endif
|
||||
#endif // SDFATSTRUCTS_H
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#include "SdFatUtil.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -88,4 +90,5 @@ void SdFatUtil::SerialPrint_P(PGM_P str) {
|
|||
void SdFatUtil::SerialPrintln_P(PGM_P str) {
|
||||
println_P(str);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
|
|
@ -26,11 +26,10 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#ifndef SdFatUtil_h
|
||||
#define SdFatUtil_h
|
||||
#ifndef SDFATUTIL_H
|
||||
#define SDFATUTIL_H
|
||||
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
|
@ -51,6 +50,4 @@ namespace SdFatUtil {
|
|||
|
||||
using namespace SdFatUtil; // NOLINT
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
#endif // SdFatUtil_h
|
||||
#endif // SDFATUTIL_H
|
||||
|
|
|
@ -26,10 +26,13 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#include "SdFile.h"
|
||||
|
||||
/** Create a file object and open it in the current working directory.
|
||||
*
|
||||
* \param[in] path A path with a valid 8.3 DOS name for a file to be opened.
|
||||
|
|
|
@ -26,18 +26,20 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief SdFile class
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#ifndef SDFILE_H
|
||||
#define SDFILE_H
|
||||
|
||||
#include "SdBaseFile.h"
|
||||
//todo: HAL: create wrapper for Print?
|
||||
//#include <Print.h>
|
||||
#ifndef SdFile_h
|
||||
#define SdFile_h
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* \class SdFile
|
||||
|
@ -58,7 +60,5 @@ class SdFile : public SdBaseFile/*, public Print*/ {
|
|||
void write_P(PGM_P str);
|
||||
void writeln_P(PGM_P str);
|
||||
};
|
||||
#endif // SdFile_h
|
||||
|
||||
|
||||
#endif
|
||||
#endif // SDFILE_H
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#ifndef SDINFO_H
|
||||
#define SDINFO_H
|
||||
|
||||
#ifndef SdInfo_h
|
||||
#define SdInfo_h
|
||||
#include <stdint.h>
|
||||
|
||||
// Based on the document:
|
||||
//
|
||||
// SD Specifications
|
||||
|
@ -284,6 +283,5 @@ union csd_t {
|
|||
csd1_t v1;
|
||||
csd2_t v2;
|
||||
};
|
||||
#endif // SdInfo_h
|
||||
|
||||
#endif
|
||||
#endif // SDINFO_H
|
||||
|
|
|
@ -26,10 +26,15 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#include "SdVolume.h"
|
||||
|
||||
#include "../Marlin.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#if !USE_MULTIPLE_CARDS
|
||||
// raw block cache
|
||||
|
@ -417,4 +422,5 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
|
|||
FAIL:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
|
|
@ -26,10 +26,9 @@
|
|||
*
|
||||
* This file is part of the Arduino Sd2Card Library
|
||||
*/
|
||||
#include "Marlin.h"
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#ifndef SdVolume_h
|
||||
#define SdVolume_h
|
||||
#ifndef SDVOLUME_H
|
||||
#define SDVOLUME_H
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief SdVolume class
|
||||
|
@ -38,6 +37,8 @@
|
|||
#include "Sd2Card.h"
|
||||
#include "SdFatStructs.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//==============================================================================
|
||||
// SdVolume class
|
||||
/**
|
||||
|
@ -223,5 +224,5 @@ class SdVolume {
|
|||
}
|
||||
#endif // ALLOW_DEPRECATED_FUNCTIONS
|
||||
};
|
||||
#endif // SdVolume
|
||||
#endif
|
||||
|
||||
#endif // SDVOLUME_H
|
||||
|
|
|
@ -20,17 +20,20 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include "cardreader.h"
|
||||
|
||||
#include "ultralcd.h"
|
||||
#include "stepper.h"
|
||||
#include "language.h"
|
||||
|
||||
#include "Marlin.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#include "cardreader.h"
|
||||
|
||||
#include "../Marlin.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../module/stepper.h"
|
||||
#include "../module/printcounter.h"
|
||||
#include "../core/language.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#define LONGEST_FILENAME (longFilename[0] ? longFilename : filename)
|
||||
|
||||
CardReader::CardReader() {
|
||||
|
@ -864,12 +867,15 @@ void CardReader::updir() {
|
|||
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
|
||||
#if (ENABLED(SDCARD_SORT_ALPHA) && SDSORT_USES_RAM && SDSORT_CACHE_NAMES)
|
||||
// if true - don't need to access the SD card for file names
|
||||
uint16_t CardReader::get_num_Files() {return nrFiles;}
|
||||
uint16_t CardReader::get_num_Files() {
|
||||
return
|
||||
#if ENABLED(SDCARD_SORT_ALPHA) && SDSORT_USES_RAM && SDSORT_CACHE_NAMES
|
||||
nrFiles // no need to access the SD card for filenames
|
||||
#else
|
||||
uint16_t CardReader::get_num_Files() {return getnrfilenames(); }
|
||||
getnrfilenames()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
void CardReader::printingHasFinished() {
|
||||
stepper.synchronize();
|
||||
|
|
|
@ -23,16 +23,11 @@
|
|||
#ifndef CARDREADER_H
|
||||
#define CARDREADER_H
|
||||
|
||||
#include "MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
||||
|
||||
#include "SdFile.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "enum.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
class CardReader {
|
||||
public:
|
||||
|
@ -166,27 +161,25 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
extern CardReader card;
|
||||
|
||||
#define IS_SD_PRINTING (card.sdprinting)
|
||||
#define IS_SD_FILE_OPEN (card.isFileOpen())
|
||||
|
||||
#if PIN_EXISTS(SD_DETECT)
|
||||
#if ENABLED(SD_DETECT_INVERTED)
|
||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) != 0)
|
||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == HIGH)
|
||||
#else
|
||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == 0)
|
||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW)
|
||||
#endif
|
||||
#else
|
||||
//No card detect line? Assume the card is inserted.
|
||||
#define IS_SD_INSERTED true
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#define IS_SD_PRINTING (card.sdprinting)
|
||||
#define IS_SD_FILE_OPEN (card.isFileOpen())
|
||||
#else
|
||||
|
||||
#define IS_SD_PRINTING (false)
|
||||
#define IS_SD_FILE_OPEN (false)
|
||||
#endif
|
||||
|
||||
#endif // SDSUPPORT
|
||||
extern CardReader card;
|
||||
|
||||
#endif // __CARDREADER_H
|
||||
#endif // CARDREADER_H
|
||||
|
|
Loading…
Reference in a new issue