diff --git a/include/sdcard.h b/include/sdcard.h index 1dfb5f2d..25fcf2c4 100644 --- a/include/sdcard.h +++ b/include/sdcard.h @@ -7,7 +7,7 @@ #if (HAS_SDCARD) #if HAS_SDCARD == 1 -#include +#include #elif HAS_SDCARD == 2 #include #else diff --git a/platformio_orig.ini b/platformio_orig.ini index 58491357..0fea3a83 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -16,10 +16,10 @@ ;halfile = ttgov1.h ;halfile = ttgov2.h ;halfile = ttgov21old.h -halfile = ttgov21new.h +;halfile = ttgov21new.h ;halfile = ttgofox.h ;halfile = ttgobeam.h -;halfile = ttgobeam10.h +halfile = ttgobeam10.h ;halfile = ttgotdisplay.h ;halfile = ttgotwristband.h ;halfile = fipy.h @@ -85,7 +85,6 @@ lib_deps_basic = makuna/RTC @ ^2.3.5 spacehuhn/SimpleButton lewisxhe/AXP202X_Library @ ^1.1.3 - geeksville/esp32-micro-sdcard @ ^0.1.1 256dpi/MQTT @ ^2.4.8 lib_deps_all = ${common.lib_deps_basic} diff --git a/src/sdcard.cpp b/src/sdcard.cpp index 59d194d6..72af507e 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -15,6 +15,10 @@ static void openFile(void); File fileSDCard; +#if HAS_SDCARD == 1 +SPIClass sd_spi; +#endif + bool sdcard_init(bool create) { // for usage of SD drivers on ESP32 platform see @@ -23,7 +27,10 @@ bool sdcard_init(bool create) { ESP_LOGI(TAG, "looking for SD-card..."); #if HAS_SDCARD == 1 // use SD SPI host driver - useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK); + digitalWrite(SDCARD_CS, HIGH); + sd_spi.begin(SDCARD_SCLK, SDCARD_MISO, SDCARD_MOSI, SDCARD_CS); + digitalWrite(SDCARD_CS, LOW); + useSDCard = SD.begin(SDCARD_CS, sd_spi); #elif HAS_SDCARD == 2 // use SD MMC host driver // enable internal pullups of sd-data lines gpio_set_pull_mode(gpio_num_t(SDCARD_DATA0), GPIO_PULLUP_ONLY);