From 89f78b0b80522fd63330d2cb31befa79c7a63576 Mon Sep 17 00:00:00 2001 From: Neil Darlow Date: Thu, 27 Mar 2014 17:02:17 +0000 Subject: [PATCH] Allow use of either SD Card slot when LCD Panel is configured. Preference is for Controller SD slot before LCD Panel slot when both are occupied. --- Marlin/cardreader.cpp | 12 ++++++++++-- Marlin/pins.h | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 5fb8dcc0f..036a34e5c 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -150,9 +150,17 @@ void CardReader::initsd() if(root.isOpen()) root.close(); #ifdef SDSLOW - if (!card.init(SPI_HALF_SPEED,SDSS)) + if (!card.init(SPI_HALF_SPEED,SDSS) + #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) + && !card.init(SPI_HALF_SPEED,LCD_SDSS) + #endif + ) #else - if (!card.init(SPI_FULL_SPEED,SDSS)) + if (!card.init(SPI_FULL_SPEED,SDSS) + #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) + && !card.init(SPI_FULL_SPEED,LCD_SDSS) + #endif + ) #endif { //if (!card.init(SPI_HALF_SPEED,SDSS)) diff --git a/Marlin/pins.h b/Marlin/pins.h index 9976d431d..d276621ed 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -614,14 +614,14 @@ #define BTN_EN1 47 //reverse if the encoder turns the wrong way. #define BTN_EN2 43 #define BTN_ENC 32 - #define SDSS 53 + #define LCD_SDSS 53 #define SDCARDDETECT -1 #define KILL_PIN 41 #elif defined(LCD_I2C_VIKI) #define BTN_EN1 22 //reverse if the encoder turns the wrong way. #define BTN_EN2 7 #define BTN_ENC -1 - #define SDSS 53 + #define LCD_SDSS 53 #define SDCARDDETECT 49 #else //arduino pin which triggers an piezzo beeper @@ -1123,7 +1123,7 @@ #ifdef LCD_I2C_PANELOLU2 #ifdef MELZI #define BTN_ENC 29 //the click switch - #define SDSS 30 //to use the SD card reader on the Panelolu2 rather than the melzi board + #define LCD_SDSS 30 //to use the SD card reader on the Panelolu2 rather than the melzi board #else #define BTN_ENC 30 //the click switch #endif