-->
Page 1 of 4

Example for using

PostPosted: Sat Nov 21, 2015 8:08 pm
by Mmiscool
Hello,

Is there any example of how to use this.

https://github.com/esp8266/Arduino/blob ... ce.md#info

I have tried.
Code: Select all    struct FSInfo {
      size_t totalBytes;
      size_t usedBytes;
      size_t blockSize;
      size_t pageSize;
      size_t maxOpenFiles;
      size_t maxPathLength;
    };
    FSInfo fs_info;
    SPIFFS.info(fs_info);
    int FlashSize = totalBytes;
    FlashSize -= totalBytes;


but get the following msg at compile time
Code: Select allFunctions_and_var_management.ino: In function 'String GetMeThatVar(String)':
Functions_and_var_management.ino:144:24: error: no matching function for call to 'fs::FS::info(GetMeThatVar(String)::FSInfo&)'
Functions_and_var_management.ino:144:24: note: candidate is:
In file included from ESP8266Basic.ino:31:0:
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc1\cores\esp8266/FS.h:96:10: note: bool fs::FS::info(uint32_t*, uint32_t*)
     bool info(uint32_t *total, uint32_t *used);
          ^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc1\cores\esp8266/FS.h:96:10: note:   candidate expects 2 arguments, 1 provided
Functions_and_var_management.ino:145:21: error: 'totalBytes' was not declared in this scope
no matching function for call to 'fs::FS::info(GetMeThatVar(String)::FSInfo&)'

Re: Example for using

PostPosted: Sat Nov 21, 2015 11:45 pm
by forlotto
viewtopic.php?f=6&t=6470&start=5#p33588

Not to sure but this has some spiffs stuff in the code ...

It appears that spiffs has to be initialized first maybe this is just for his code and the way it is setup IDK I only read a little bit of it but is it possible that you must first initialize the file storage system before you get this data you are trying to get?

Re: Example for using

PostPosted: Sun Nov 22, 2015 10:21 am
by martinayotte
First, you need to pass pointer to the structure, second, you need to access member of the structure :

Code: Select allFSInfo fs_info;
SPIFFS.info(&fs_info);
int FlashSize = fs_info.totalBytes;

Re: Example for using

PostPosted: Sun Nov 22, 2015 11:08 am
by Mmiscool
Ok. Just tried this.

Code: Select all    struct FSInfo {
      size_t totalBytes;
      size_t usedBytes;
      size_t blockSize;
      size_t pageSize;
      size_t maxOpenFiles;
      size_t maxPathLength;
    };



    FSInfo fs_info;
    SPIFFS.info(&fs_info);
    int Flashfree = fs_info.totalBytes - fs_info.usedBytes;
    MyOut = String(Flashfree );


Getting this as the compiler error. I am not too familiar with these Structs
Code: Select allFunctions_and_var_management.ino: In function 'String GetMeThatVar(String)':
Functions_and_var_management.ino:139:25: error: no matching function for call to 'fs::FS::info(FSInfo*)'
Functions_and_var_management.ino:139:25: note: candidate is:
In file included from ESP8266Basic.ino:31:0:
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc1\cores\esp8266/FS.h:96:10: note: bool fs::FS::info(uint32_t*, uint32_t*)
     bool info(uint32_t *total, uint32_t *used);
          ^
C:\Users\user\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc1\cores\esp8266/FS.h:96:10: note:   candidate expects 2 arguments, 1 provided
no matching function for call to 'fs::FS::info(FSInfo*)'