vitotai / BrewManiacEsp8266

BrewManiac on ESP8266. Only ESP8266 needed.
158 stars 71 forks source link

how install audio files in esp32 #114

Open felipeserta opened 2 years ago

felipeserta commented 2 years ago

The code runs perfectly in esp32 but i dont know how to install the audio files. I tried copy files to esp32 via http://bm.local:8008/filemanager in the same way I did with esp8266 without sucess and file names lost the first letter. How to solve this issue. Thanks

image

felipeserta commented 2 years ago

Also, after saving a recipe file it doesnt apear in saved list for future use. Maybe the cause is the diference in file names without the first letter. I ll try to download to a different esp32 board.

thnaks

vitotai commented 2 years ago

Which version do you use? I know there are issues about file names because of difference between SPIFFS and LITTLEFS. I've spent some time on this.

felipeserta commented 2 years ago

I´m using last one, version 0.5.1. Yesterday I tried new board and update firmware esp32 to 5.2.0 without success. I tried to upload files creating a data folder and upload via platformio but in file manager lost the first letter again. thanks for any help.

vitotai commented 2 years ago

I am sorry by neglecting BrewManiacEx in this issue when I had fixed this in BrewPiLess. Please check the latest update.

felipeserta commented 2 years ago

After a tried the new code the first letter apears again but without R/ at recipes files.

Before that I did the changes below and worked at filemanager image

At ESPAUpdateServer.cpp I made this changes static void handleFileList(void) { ....

if UseLittleFS

output += entry.name();
#else

//new code

if ESP32

    output += String(entry.path()).substring(1);
  #else
output += String(entry.name()).substring(1);
     #endif                                 
#endif

//end of new code output += "\"}";

But I still can´t retry recipes files image Serial print shows at this time image

I didn´t try brewlogs yet but show this image

Thanks a lot

felipeserta commented 2 years ago

Vito, Recipes now work with few modifs image in BrewmaniacEx.cpp void listDirectory(const String& path,String& json){

    #if !UseLittleFS
    uint16_t len=path.length();
    #endif
    #if ESP32
    String tpath = path.substring(0,(len-1)); //to remove "/" from path "/R/"
    File dir = FileSystem.open(tpath);
    //File dir = FileSystem.open("/R"); //temporary test works fine 
    #else
    Dir dir = FileSystem.openDir(path);
    #endif

    json=String("[");
    bool comma=false;

    #if defined(ESP32)
    File entry = dir.openNextFile();
    DBG_PRINTF("LS path %s listdir:%s\n",path,String(entry.path()).substring(1));
    while(entry){
         // String file=entry.name();

//new code String file= String(entry.path()).substring(len);

else

Best Regards, Felipe

felipeserta commented 2 years ago

Brew logs are being saved, but still get this empty logs, I did not remember in other versions. image thanks

vitotai commented 2 years ago

I tried and found out that the latest SPIFFS of ESP32 framework might have issue with directory listing. I inserted a test code to create a file with subdirectory, but it appeared in root directory.

It might take a while to solve this issue. Well, It might never be solved.

I tried with LittleFS, and it seems to work.

BTW, I have issues with SPIFFS on BrewPiLess after running for 3 months. I am now switching to LittleFS and running.

felipeserta commented 2 years ago

Sure looks like new issues with spiffs libs. With the changes above it behaves like previous version and everything is working filemanager, recipes and logs with esp32. Now I´ll take a look at audio files. Little FS looks like a better and cleaner code. Thanks

felipeserta commented 2 years ago

After uploading sounds.json and sounds.mp4 I forgot to configure webpage to allow sound. All fine by now.

thks