Make CardReader class static (#12451)

* Make CardReader a static class
* Make CardReader flags into bitfields
This commit is contained in:
Scott Lahteine
2018-11-16 22:39:16 -06:00
committed by GitHub
parent 3e9ffaddb6
commit 66580f32c2
15 changed files with 281 additions and 190 deletions

View File

@@ -278,7 +278,7 @@ void process_lcd_p_command(const char* command) {
// There may be a difference in how V1 and V2 LCDs handle subdirectory
// prints. Investigate more. This matches the V1 motion controller actions
// but the V2 LCD switches to "print" mode on {SYS:DIR} response.
if (card.filenameIsDir) {
if (card.flag.filenameIsDir) {
card.chdir(card.filename);
write_to_lcd_P(PSTR("{SYS:DIR}"));
}
@@ -330,7 +330,7 @@ void process_lcd_s_command(const char* command) {
case 'L': {
#if ENABLED(SDSUPPORT)
if (!card.cardOK) card.initsd();
if (!card.flag.cardOK) card.initsd();
// A more efficient way to do this would be to
// implement a callback in the ls_SerialPrint code, but
@@ -342,7 +342,7 @@ void process_lcd_s_command(const char* command) {
uint16_t file_count = card.get_num_Files();
for (uint16_t i = 0; i < file_count; i++) {
card.getfilename(i);
sprintf_P(message_buffer, card.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename());
sprintf_P(message_buffer, card.flag.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename());
write_to_lcd(message_buffer);
}