20 #include "../../include/esp3d_config.h"
21 #ifdef FILESYSTEM_FEATURE
25 #ifdef ARDUINO_ARCH_ESP32
26 #include <esp_ota_ops.h>
27 #endif //ARDUINO_ARCH_ESP32
29 #define ESP_MAX_OPENHANDLE 4
32 bool ESP_FileSystem::_started =
false;
49 res = String ((uint16_t)bytes) +
" B";
50 }
else if (bytes < (1024 * 1024) ) {
51 res = String ((
float)(bytes / 1024.0),2) +
" KB";
52 }
else if (bytes < (1024 * 1024 * 1024) ) {
53 res = String ((
float)(bytes / 1024.0 / 1024.0),2) +
" MB";
55 res = String ((
float)(bytes / 1024.0 / 1024.0 / 1024.0),2) +
" GB";
63 #if defined (ARDUINO_ARCH_ESP8266)
64 flashsize = ESP.getFlashChipSize();
66 if (flashsize <= 1024 * 1024) {
67 flashsize = (1024 * 1024)-ESP.getSketchSize()-1024;
69 flashsize = flashsize - ESP.getSketchSize()-
totalBytes()-1024;
71 if (flashsize > 1024 * 1024) {
72 flashsize = (1024 * 1024) - 1024;
75 #endif //ARDUINO_ARCH_ESP8266
76 #if defined (ARDUINO_ARCH_ESP32)
78 if (esp_ota_get_running_partition()) {
79 const esp_partition_t* partition = esp_ota_get_next_update_partition(NULL);
81 flashsize = partition->size;
86 #endif //ARDUINO_ARCH_ESP32
108 ESP_File::operator bool()
const
110 if ((_index != -1) || (_filename.length() > 0)) {
120 return !(_index == -1);
125 return _name.c_str();
130 return _filename.c_str();
150 if (_index == -1 || _isdir) {
158 if ((_index == -1) || _isdir) {
166 if ((_index == -1) || _isdir) {
174 if ((_index == -1) || _isdir) {
182 if ((_index == -1) || _isdir) {
190 if ((_index == -1) || _isdir) {
199 _isdir = other._isdir;
200 _isfakedir = other._isfakedir;
201 _index = other._index;
202 _filename = other._filename;
205 _iswritemode = other._iswritemode;
206 _dirlist = other._dirlist;
207 _lastwrite = other._lastwrite;
211 #endif //FILESYSTEM_FEATURE