We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using SDFS.info64() with a 32GB SD card doesn't return the SD card capacity.
I modified SDFS.h file, function bool info64(fs::FSInfo64& info) from this:
SDFS.h
bool info64(fs::FSInfo64& info)
info.totalBytes =_fs.vol()->clusterCount() * info.blockSize; info.usedBytes = (_fs.vol()->clusterCount() - _fs.vol()->freeClusterCount()) * info.blockSize;
to this:
info.totalBytes = (uint64_t)_fs.vol()->clusterCount() * (uint64_t)info.blockSize; info.usedBytes = (uint64_t)(_fs.vol()->clusterCount() - _fs.vol()->freeClusterCount()) * (uint64_t)info.blockSize;
and it fixed the issue. However, I'm not sure if it's the best fix.
#include <Arduino.h> #include <LittleFS.h> #include <SD.h> void setup() { Serial.begin(115200); if (!SDFS.begin()) { Serial.println("Initialization failed!"); } else { Serial.println("Initialization successful!"); FSInfo64 sd_info; SDFS.info64(sd_info); Serial.print("Total space: "); Serial.printf("%02llX", (sd_info.totalBytes >> 56) & 0xff); Serial.printf("%02llX", (sd_info.totalBytes >> 48) & 0xff); Serial.printf("%02llX", (sd_info.totalBytes >> 40) & 0xff); Serial.printf("%02llX", (sd_info.totalBytes >> 32) & 0xff); Serial.printf("%02llX", (sd_info.totalBytes >> 24) & 0xff); Serial.printf("%02llX", (sd_info.totalBytes >> 16) & 0xff); Serial.printf("%02llX", (sd_info.totalBytes >> 8) & 0xff); Serial.printf("%02llX", sd_info.totalBytes & 0xff); Serial.println(); } } void loop() { }
Code above outputs this:
Initialization successful! Total space: 000000006D880000
Once function info64 in file SDFS.h, it outputs this (which is the correct value):
info64
Initialization successful! Total space: 000000076D880000
The text was updated successfully, but these errors were encountered:
Seems to be related to issue #8445.
Sorry, something went wrong.
No branches or pull requests
Basic Infos
Platform
Settings in IDE
Problem Description
Using SDFS.info64() with a 32GB SD card doesn't return the SD card capacity.
I modified
SDFS.h
file, functionbool info64(fs::FSInfo64& info)
from this:to this:
and it fixed the issue.
However, I'm not sure if it's the best fix.
MCVE Sketch
Debug Messages
Code above outputs this:
Once function
info64
in fileSDFS.h
, it outputs this (which is the correct value):The text was updated successfully, but these errors were encountered: