From 46c4fbc943c79b790a5184d5fd6d616607ec599c Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Fri, 24 May 2019 16:45:36 +0900 Subject: [PATCH] Fixed to be compatibility with esp8266 earlier than 2.5.0 --- src/AutoConnectDefs.h | 12 ------------ src/AutoConnectUploadImpl.h | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/AutoConnectDefs.h b/src/AutoConnectDefs.h index c59993b..fb2d3eb 100644 --- a/src/AutoConnectDefs.h +++ b/src/AutoConnectDefs.h @@ -132,18 +132,6 @@ #define AUTOCONNECT_SSIDPAGEUNIT_LINES 5 #endif // !AUTOCONNECT_SSIDPAGEUNIT_LINES -// SD pin assignment for AutoConnectFile -#ifndef AUTOCONNECT_SD_CS -#if defined(ARDUINO_ARCH_ESP8266) -#ifndef SD_CHIP_SELECT_PIN -#define SD_CHIP_SELECT_PIN SS -#endif -#define AUTOCONNECT_SD_CS SD_CHIP_SELECT_PIN -#elif defined(ARDUINO_ARCH_ESP32) -#define AUTOCONNECT_SD_CS SS -#endif -#endif // !AUTOCONNECT_SD_CS - // SPI transfer speed for SD #ifndef AUTOCONNECT_SD_SPEED #define AUTOCONNECT_SD_SPEED 4000000 diff --git a/src/AutoConnectUploadImpl.h b/src/AutoConnectUploadImpl.h index bb5ff2d..d09b381 100644 --- a/src/AutoConnectUploadImpl.h +++ b/src/AutoConnectUploadImpl.h @@ -104,11 +104,23 @@ class AutoConnectUploadFS : public AutoConnectUploadHandler { }; // Fix to be compatibility with backward for ESP8266 core 2.5.1 or later +// SD pin assignment for AutoConnectFile +#ifndef AUTOCONNECT_SD_CS +#if defined(ARDUINO_ARCH_ESP8266) +#ifndef SD_CHIP_SELECT_PIN +#define SD_CHIP_SELECT_PIN SS +#endif +#define AUTOCONNECT_SD_CS SD_CHIP_SELECT_PIN +#elif defined(ARDUINO_ARCH_ESP32) +#define AUTOCONNECT_SD_CS SS +#endif +#endif // !AUTOCONNECT_SD_CS +// Derivation of SCK frequency and ensuring SD.begin compatibility #ifdef ARDUINO_ARCH_ESP8266 #if defined(SD_SCK_HZ) #define AC_SD_SPEED(s) SD_SCK_HZ(s) #else -#define AC_SD_SPPED(s) s +#define AC_SD_SPEED(s) s #endif #endif @@ -126,13 +138,13 @@ class AutoConnectUploadSD : public AutoConnectUploadHandler { uint8_t oflag = *mode == 'w' ? FILE_WRITE : FILE_READ; uint8_t sdType = _media->type(); switch (sdType) { - case sdfat::SD_CARD_TYPE_SD1: + case 1: // SD_CARD_TYPE_SD1 sdVerify = (const char*)"MMC"; break; - case sdfat::SD_CARD_TYPE_SD2: + case 2: // SD_CARD_TYPE_SD2 sdVerify = (const char*)"SDSC"; break; - case sdfat::SD_CARD_TYPE_SDHC: + case 3: // SD_CARD_TYPE_SDHC sdVerify = (const char*)"SDHC"; break; default: