@ -37,6 +37,9 @@
# if ENABLED(SDSUPPORT)
# if ENABLED(SDSUPPORT)
# include "../../sd/cardreader.h"
# include "../../sd/cardreader.h"
# include "../../feature/emergency_parser.h"
# include "../../feature/emergency_parser.h"
# define IFSD(A,B) (A)
# else
# define IFSD(A,B) (B)
# endif
# endif
# if ENABLED(PRINTCOUNTER)
# if ENABLED(PRINTCOUNTER)
@ -352,11 +355,7 @@ namespace UI {
# endif
# endif
uint8_t getProgress_percent ( ) {
uint8_t getProgress_percent ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( card . percentDone ( ) , 0 ) ;
return card . percentDone ( ) ;
# else
return 0 ;
# endif
}
}
uint32_t getProgress_seconds_elapsed ( ) {
uint32_t getProgress_seconds_elapsed ( ) {
@ -415,35 +414,23 @@ namespace UI {
}
}
void printFile ( const char * filename ) {
void printFile ( const char * filename ) {
# if ENABLED(SDSUPPORT)
IFSD ( card . openAndPrintFile ( filename ) , NOOP ) ;
card . openAndPrintFile ( filename ) ;
}
# endif
bool isPrintingFromMediaPaused ( ) {
return IFSD ( isPrintingFromMedia ( ) & & ! card . sdprinting , false ) ;
}
}
bool isPrintingFromMedia ( ) {
bool isPrintingFromMedia ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( card . cardOK & & card . isFileOpen ( ) , false ) ;
return card . cardOK & & card . isFileOpen ( ) & & card . sdprinting ;
# else
return false ;
# endif
}
}
bool isPrinting ( ) {
bool isPrinting ( ) {
return ( planner . movesplanned ( ) | | IS_SD_PRINTING ( ) | |
return ( planner . movesplanned ( ) | | IS_SD_PRINTING ( ) | | isPrintingFromMedia ( ) ) ;
# if ENABLED(SDSUPPORT)
( card . cardOK & & card . isFileOpen ( ) )
# else
false
# endif
) ;
}
}
bool isMediaInserted ( ) {
bool isMediaInserted ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( IS_SD_INSERTED ( ) & & card . cardOK , false ) ;
return IS_SD_INSERTED ( ) & & card . cardOK ;
# else
return false ;
# endif
}
}
void pausePrint ( ) {
void pausePrint ( ) {
@ -504,42 +491,23 @@ namespace UI {
}
}
const char * FileList : : filename ( ) {
const char * FileList : : filename ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( card . longFilename & & card . longFilename [ 0 ] ) ? card . longFilename : card . filename , " " ) ;
return ( card . longFilename & & card . longFilename [ 0 ] ) ? card . longFilename : card . filename ;
# else
return " " ;
# endif
}
}
const char * FileList : : shortFilename ( ) {
const char * FileList : : shortFilename ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( card . filename , " " ) ;
return card . filename ;
# else
return " " ;
# endif
}
}
const char * FileList : : longFilename ( ) {
const char * FileList : : longFilename ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( card . longFilename , " " ) ;
return card . longFilename ;
# else
return " " ;
# endif
}
}
bool FileList : : isDir ( ) {
bool FileList : : isDir ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( card . filenameIsDir , false ) ;
return card . filenameIsDir ;
# else
return false ;
# endif
}
}
uint16_t FileList : : count ( ) {
uint16_t FileList : : count ( ) {
# if ENABLED(SDSUPPORT)
return IFSD ( ( num_files = ( num_files = = 0xFFFF ? card . get_num_Files ( ) : num_files ) ) , 0 ) ;
if ( num_files = = 0xFFFF ) num_files = card . get_num_Files ( ) ;
return num_files ;
# endif
}
}
bool FileList : : isAtRootDir ( ) {
bool FileList : : isAtRootDir ( ) {