mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
update to ufilesystem
This commit is contained in:
parent
0af9a948ee
commit
b8ce02c0ad
20
tasmota/xdrv_13_display.ino
Normal file → Executable file
20
tasmota/xdrv_13_display.ino
Normal file → Executable file
@ -497,7 +497,7 @@ void DisplayText(void)
|
|||||||
cp += var;
|
cp += var;
|
||||||
linebuf[fill] = 0;
|
linebuf[fill] = 0;
|
||||||
break;
|
break;
|
||||||
#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
|
#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM)
|
||||||
case 'P':
|
case 'P':
|
||||||
{ char *ep=strchr(cp,':');
|
{ char *ep=strchr(cp,':');
|
||||||
if (ep) {
|
if (ep) {
|
||||||
@ -682,7 +682,7 @@ void DisplayText(void)
|
|||||||
RedrawGraph(temp,temp1);
|
RedrawGraph(temp,temp1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
|
#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM)
|
||||||
if (*cp=='s') {
|
if (*cp=='s') {
|
||||||
cp++;
|
cp++;
|
||||||
var=atoiv(cp,&temp);
|
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 // JPEG_PICTS
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT) && defined(USE_DISPLAY)
|
#if (defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)) || defined(UFILESYSTEM)
|
||||||
extern FS *fsp;
|
extern FS *ufsp;
|
||||||
#define XBUFF_LEN 128
|
#define XBUFF_LEN 128
|
||||||
void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) {
|
void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp, bool inverted ) {
|
||||||
if (!renderer) return;
|
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")) {
|
if (!strcmp(estr,"rgb")) {
|
||||||
// special rgb format
|
// special rgb format
|
||||||
fp=fsp->open(file,FILE_READ);
|
fp=ufsp->open(file,FS_FILE_READ);
|
||||||
if (!fp) return;
|
if (!fp) return;
|
||||||
uint16_t xsize;
|
uint16_t xsize;
|
||||||
fp.read((uint8_t*)&xsize,2);
|
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
|
// jpeg files on ESP32 with more memory
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
#ifdef JPEG_PICTS
|
#ifdef JPEG_PICTS
|
||||||
fp=fsp->open(file,FILE_READ);
|
fp=ufsp->open(file,FS_FILE_READ);
|
||||||
if (!fp) return;
|
if (!fp) return;
|
||||||
uint32_t size = fp.size();
|
uint32_t size = fp.size();
|
||||||
uint8_t *mem = (uint8_t *)special_malloc(size+4);
|
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
|
#ifdef ESP32
|
||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#endif
|
#endif
|
||||||
@ -1925,8 +1925,8 @@ void Save_graph(uint8_t num, char *path) {
|
|||||||
struct GRAPH *gp=graph[index];
|
struct GRAPH *gp=graph[index];
|
||||||
if (!gp) return;
|
if (!gp) return;
|
||||||
File fp;
|
File fp;
|
||||||
fsp->remove(path);
|
ufsp->remove(path);
|
||||||
fp=fsp->open(path,FILE_WRITE);
|
fp=ufsp->open(path,FS_FILE_WRITE);
|
||||||
if (!fp) return;
|
if (!fp) return;
|
||||||
char str[32];
|
char str[32];
|
||||||
sprintf_P(str,PSTR("%d\t%d\t%d\t"),gp->xcnt,gp->xs,gp->ys);
|
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];
|
struct GRAPH *gp=graph[index];
|
||||||
if (!gp) return;
|
if (!gp) return;
|
||||||
File fp;
|
File fp;
|
||||||
fp=fsp->open(path,FILE_READ);
|
fp=ufsp->open(path,FS_FILE_READ);
|
||||||
if (!fp) return;
|
if (!fp) return;
|
||||||
char vbuff[32];
|
char vbuff[32];
|
||||||
char *cp=vbuff;
|
char *cp=vbuff;
|
||||||
|
@ -69,6 +69,8 @@ AudioGeneratorMP3 *decoder = NULL;
|
|||||||
void *mp3ram = NULL;
|
void *mp3ram = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
extern FS *ufsp;
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
const int preallocateBufferSize = 5*1024;
|
const int preallocateBufferSize = 5*1024;
|
||||||
const int preallocateCodecSize = 29192; // MP3 codec max mem needed
|
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 };
|
0x64, 0x61, 0x74, 0x61, 0xff, 0xff, 0xff, 0xff };
|
||||||
|
|
||||||
bool SaveWav(char *path, uint8_t *buff, uint32_t size) {
|
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)];
|
uint8_t wavHeader[sizeof(wavHTemplate)];
|
||||||
memcpy_P(wavHeader, wavHTemplate, sizeof(wavHTemplate));
|
memcpy_P(wavHeader, wavHTemplate, sizeof(wavHTemplate));
|
||||||
|
|
||||||
@ -552,7 +554,7 @@ void I2S_WR_Show(void) {
|
|||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
void Play_mp3(const char *path) {
|
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 (decoder || mp3) return;
|
||||||
if (!out) return;
|
if (!out) return;
|
||||||
|
|
||||||
@ -566,7 +568,7 @@ void Play_mp3(const char *path) {
|
|||||||
I2S_Task = false;
|
I2S_Task = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new AudioFileSourceFS(*fsp,path);
|
file = new AudioFileSourceFS(*ufsp,path);
|
||||||
id3 = new AudioFileSourceID3(file);
|
id3 = new AudioFileSourceID3(file);
|
||||||
|
|
||||||
if (mp3ram) {
|
if (mp3ram) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user