From b8ce02c0ada584f769688c3a80bf8686bff153a8 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Tue, 5 Jan 2021 16:39:16 +0100 Subject: [PATCH] update to ufilesystem --- tasmota/xdrv_13_display.ino | 20 ++++++++++---------- tasmota/xdrv_42_i2s_audio.ino | 8 +++++--- 2 files changed, 15 insertions(+), 13 deletions(-) mode change 100644 => 100755 tasmota/xdrv_13_display.ino diff --git a/tasmota/xdrv_13_display.ino b/tasmota/xdrv_13_display.ino old mode 100644 new mode 100755 index 3a1abe6d2..6e5e7a138 --- a/tasmota/xdrv_13_display.ino +++ b/tasmota/xdrv_13_display.ino @@ -497,7 +497,7 @@ void DisplayText(void) cp += var; linebuf[fill] = 0; break; -#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT) +#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM) case 'P': { char *ep=strchr(cp,':'); if (ep) { @@ -682,7 +682,7 @@ void DisplayText(void) RedrawGraph(temp,temp1); break; } -#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT) +#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM) if (*cp=='s') { cp++; var=atoiv(cp,&temp); @@ -1569,8 +1569,8 @@ char get_jpeg_size(unsigned char* data, unsigned int data_size, unsigned short * #endif // JPEG_PICTS #endif // ESP32 -#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT) && defined(USE_DISPLAY) -extern FS *fsp; +#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM) +extern FS *ufsp; #define XBUFF_LEN 128 void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) { if (!renderer) return; @@ -1586,7 +1586,7 @@ void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) { if (!strcmp(estr,"rgb")) { // special rgb format - fp=fsp->open(file,FILE_READ); + fp=ufsp->open(file,FS_FILE_READ); if (!fp) return; uint16_t xsize; fp.read((uint8_t*)&xsize,2); @@ -1621,7 +1621,7 @@ void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) { // jpeg files on ESP32 with more memory #ifdef ESP32 #ifdef JPEG_PICTS - fp=fsp->open(file,FILE_READ); + fp=ufsp->open(file,FS_FILE_READ); if (!fp) return; uint32_t size = fp.size(); uint8_t *mem = (uint8_t *)special_malloc(size+4); @@ -1914,7 +1914,7 @@ void DisplayCheckGraph() { } -#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT) +#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM) #ifdef ESP32 #include #endif @@ -1925,8 +1925,8 @@ void Save_graph(uint8_t num, char *path) { struct GRAPH *gp=graph[index]; if (!gp) return; File fp; - fsp->remove(path); - fp=fsp->open(path,FILE_WRITE); + ufsp->remove(path); + fp=ufsp->open(path,FS_FILE_WRITE); if (!fp) return; char str[32]; sprintf_P(str,PSTR("%d\t%d\t%d\t"),gp->xcnt,gp->xs,gp->ys); @@ -1951,7 +1951,7 @@ void Restore_graph(uint8_t num, char *path) { struct GRAPH *gp=graph[index]; if (!gp) return; File fp; - fp=fsp->open(path,FILE_READ); + fp=ufsp->open(path,FS_FILE_READ); if (!fp) return; char vbuff[32]; char *cp=vbuff; diff --git a/tasmota/xdrv_42_i2s_audio.ino b/tasmota/xdrv_42_i2s_audio.ino index 1e468593b..576ba2380 100644 --- a/tasmota/xdrv_42_i2s_audio.ino +++ b/tasmota/xdrv_42_i2s_audio.ino @@ -69,6 +69,8 @@ AudioGeneratorMP3 *decoder = NULL; void *mp3ram = NULL; +extern FS *ufsp; + #ifdef ESP8266 const int preallocateBufferSize = 5*1024; const int preallocateCodecSize = 29192; // MP3 codec max mem needed @@ -391,7 +393,7 @@ static const uint8_t wavHTemplate[] PROGMEM = { // Hardcoded simple WAV header w 0x64, 0x61, 0x74, 0x61, 0xff, 0xff, 0xff, 0xff }; bool SaveWav(char *path, uint8_t *buff, uint32_t size) { - File fwp = fsp->open(path, FILE_WRITE); + File fwp = ufsp->open(path, FILE_WRITE); uint8_t wavHeader[sizeof(wavHTemplate)]; memcpy_P(wavHeader, wavHTemplate, sizeof(wavHTemplate)); @@ -552,7 +554,7 @@ void I2S_WR_Show(void) { #ifdef ESP32 void Play_mp3(const char *path) { -#if defined(USE_SCRIPT) && defined(USE_SCRIPT_FATFS) +#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM) if (decoder || mp3) return; if (!out) return; @@ -566,7 +568,7 @@ void Play_mp3(const char *path) { I2S_Task = false; } - file = new AudioFileSourceFS(*fsp,path); + file = new AudioFileSourceFS(*ufsp,path); id3 = new AudioFileSourceID3(file); if (mp3ram) {