From 07d88be281ea06e5af953a9f3705aa6b61334bc6 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 9 Jan 2021 08:50:29 +0100 Subject: [PATCH 1/4] fix sspi log --- tasmota/support_tasmota.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 060f71eb4..08205d23d 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -1609,7 +1609,7 @@ void GpioInit(void) uint32_t sspi_mosi = (PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MOSI)) ? SPI_MOSI : SPI_NONE; uint32_t sspi_miso = (PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MISO)) ? SPI_MISO : SPI_NONE; TasmotaGlobal.soft_spi_enabled = sspi_mosi + sspi_miso; - AddLogSpi(0, Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSPI_MOSI), PinUsed(GPIO_SSPI_MISO)); + AddLogSpi(0, Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_MISO)); #ifdef USE_SPI #ifdef ESP8266 From 154cb7efcf2b55ff72317f84c03925bcf0644a31 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 9 Jan 2021 08:50:56 +0100 Subject: [PATCH 2/4] add sdcard pin def to core2 --- tasmota/tasmota_template.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 512a22fec..f2dbae6c4 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -2512,7 +2512,7 @@ const mytmplt kModules[] PROGMEM = AGPIO(GPIO_USER), // 1 IO TXD0 GPIO1, U0TXD AGPIO(GPIO_USER), // 2 IO GPIO2, SPKR_DATA AGPIO(GPIO_USER), // 3 IO RXD0 GPIO3, U0RXD - 0, // 4 IO GPIO4, SPI_CS_CARD + AGPIO(GPIO_SDCARD_CS), // 4 IO GPIO4, SPI_CS_CARD 0, // 5 IO GPIO5, SPI_CS_LCD // 6 IO GPIO6, Flash CLK // 7 IO GPIO7, Flash D0 From 29df10d8377e9b50fd03c015ab9e354c7c0c560e Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 9 Jan 2021 08:51:27 +0100 Subject: [PATCH 3/4] fix spi init issues --- tasmota/xdrv_50_filesystem.ino | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_50_filesystem.ino b/tasmota/xdrv_50_filesystem.ino index 527b43dd6..fe35234df 100644 --- a/tasmota/xdrv_50_filesystem.ino +++ b/tasmota/xdrv_50_filesystem.ino @@ -100,6 +100,7 @@ void UfsInitOnce(void) { #ifdef ESP8266 ffsp = &LittleFS; if (!LittleFS.begin()) { + ffsp = 0; return; } #endif // ESP8266 @@ -137,13 +138,27 @@ void UfsInit(void) { #ifdef USE_SDCARD 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 (1) { +#endif // ESP32 int8_t cs = SDCARD_CS_PIN; if (PinUsed(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)) { #ifdef ESP8266 ufsp = &SDFS; @@ -154,7 +169,7 @@ void UfsCheckSDCardInit(void) { #endif // ESP32 ufs_type = UFS_TSDC; dfsp = ufsp; - ufs_dir = 1; + if (ffsp) {ufs_dir = 1;} // make sd card the global filesystem #ifdef ESP8266 // on esp8266 sdcard info takes several seconds !!!, so we ommit it here From 3b31f22383c33c5d8b91ddb81f38827d00d5579a Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 9 Jan 2021 08:52:10 +0100 Subject: [PATCH 4/4] fix mp3 error behaviour --- tasmota/xdrv_42_i2s_audio.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_42_i2s_audio.ino b/tasmota/xdrv_42_i2s_audio.ino index 576ba2380..0567e3591 100644 --- a/tasmota/xdrv_42_i2s_audio.ino +++ b/tasmota/xdrv_42_i2s_audio.ino @@ -568,7 +568,8 @@ void Play_mp3(const char *path) { I2S_Task = false; } - file = new AudioFileSourceFS(*ufsp,path); + file = new AudioFileSourceFS(*ufsp, path); + id3 = new AudioFileSourceID3(file); if (mp3ram) { @@ -584,11 +585,11 @@ void Play_mp3(const char *path) { while (mp3->isRunning()) { if (!mp3->loop()) { mp3->stop(); - mp3_delete(); break; } OsWatchLoop(); } + mp3_delete(); } #endif // USE_SCRIPT