mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 05:06:32 +00:00
fix spi init issues
This commit is contained in:
parent
154cb7efcf
commit
29df10d837
@ -100,6 +100,7 @@ void UfsInitOnce(void) {
|
|||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
ffsp = &LittleFS;
|
ffsp = &LittleFS;
|
||||||
if (!LittleFS.begin()) {
|
if (!LittleFS.begin()) {
|
||||||
|
ffsp = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
@ -137,13 +138,27 @@ void UfsInit(void) {
|
|||||||
|
|
||||||
#ifdef USE_SDCARD
|
#ifdef USE_SDCARD
|
||||||
void UfsCheckSDCardInit(void) {
|
void UfsCheckSDCardInit(void) {
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
|
if (PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_MISO)) {
|
||||||
|
#endif // ESP8266
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
if (TasmotaGlobal.spi_enabled) {
|
||||||
// if (1) {
|
#endif // ESP32
|
||||||
int8_t cs = SDCARD_CS_PIN;
|
int8_t cs = SDCARD_CS_PIN;
|
||||||
if (PinUsed(GPIO_SDCARD_CS)) {
|
if (PinUsed(GPIO_SDCARD_CS)) {
|
||||||
cs = Pin(GPIO_SDCARD_CS);
|
cs = Pin(GPIO_SDCARD_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EPS8266
|
||||||
|
SPI.begin();
|
||||||
|
#endif // EPS8266
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), -1);
|
||||||
|
#endif // ESP32
|
||||||
|
|
||||||
if (SD.begin(cs)) {
|
if (SD.begin(cs)) {
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
ufsp = &SDFS;
|
ufsp = &SDFS;
|
||||||
@ -154,7 +169,7 @@ void UfsCheckSDCardInit(void) {
|
|||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
ufs_type = UFS_TSDC;
|
ufs_type = UFS_TSDC;
|
||||||
dfsp = ufsp;
|
dfsp = ufsp;
|
||||||
ufs_dir = 1;
|
if (ffsp) {ufs_dir = 1;}
|
||||||
// make sd card the global filesystem
|
// make sd card the global filesystem
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
// on esp8266 sdcard info takes several seconds !!!, so we ommit it here
|
// on esp8266 sdcard info takes several seconds !!!, so we ommit it here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user