ESP3D  3.0
Firmware for ESP boards connected to 3D Printer
esp_globalFS.cpp
Go to the documentation of this file.
1 /*
2  esp_globalFS.cpp - ESP3D global FS support class
3 
4  Copyright (c) 2014 Luc Lebosse. All rights reserved.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #include "../../include/esp3d_config.h"
22 #if defined(GLOBAL_FILESYSTEM_FEATURE)
23 #include "esp_globalFS.h"
24 //#include "../../core/genLinkedList.h"
25 
26 
27 //to verify FS is accessible
28 bool ESP_GBFS::isavailable(uint8_t FS)
29 {
30 #ifdef FILESYSTEM_FEATURE
31  if(FS == FS_FLASH) {
32  return ESP_FileSystem::started();
33  }
34 #endif //FILESYSTEM_FEATURE
35 #ifdef SD_DEVICE
36  if(FS == FS_SD) {
37  return (ESP_SD::getState(true) == ESP_SDCARD_IDLE);
38  }
39 #endif //SD_DEVICE
40  return false;
41 }
42 
43 uint8_t ESP_GBFS::_nbFS = 0;
44 String ESP_GBFS::_rootlist[MAX_FS];
45 //constructor
47 {
48  _nbFS = 0;
49 }
50 
51 //destructor
53 {
54 }
55 
56 //helper to format size to readable string
57 String & ESP_GBFS::formatBytes (uint64_t bytes)
58 {
59  static String res;
60  if (bytes < 1024) {
61  res = String ((uint16_t)bytes) + " B";
62  } else if (bytes < (1024 * 1024) ) {
63  res = String ((float)(bytes / 1024.0),2) + " KB";
64  } else if (bytes < (1024 * 1024 * 1024) ) {
65  res = String ((float)(bytes / 1024.0 / 1024.0),2) + " MB";
66  } else {
67  res = String ((float)(bytes / 1024.0 / 1024.0 / 1024.0),2) + " GB";
68  }
69  return res;
70 }
71 
72 //depending FS
73 uint64_t ESP_GBFS::totalBytes(uint8_t FS)
74 {
75 #ifdef FILESYSTEM_FEATURE
76  if(FS == FS_FLASH) {
78  }
79 #endif //FILESYSTEM_FEATURE
80 #ifdef SD_DEVICE
81  if(FS == FS_SD) {
82  return ESP_SD::totalBytes();
83  }
84 #endif //SD_DEVICE
85  return 0;
86 }
87 
88 uint64_t ESP_GBFS::usedBytes(uint8_t FS)
89 {
90 #ifdef FILESYSTEM_FEATURE
91  if(FS == FS_FLASH) {
93  }
94 #endif //FILESYSTEM_FEATURE
95 #ifdef SD_DEVICE
96  if(FS == FS_SD) {
97  return ESP_SD::usedBytes();
98  }
99 #endif //SD_DEVICE
100  return 0;
101 }
102 
103 uint64_t ESP_GBFS::freeBytes(uint8_t FS)
104 {
105 #ifdef FILESYSTEM_FEATURE
106  if(FS == FS_FLASH) {
107  return ESP_FileSystem::freeBytes();
108  }
109 #endif //FILESYSTEM_FEATURE
110 #ifdef SD_DEVICE
111  if(FS == FS_SD) {
112  return ESP_SD::freeBytes();
113  }
114 #endif //SD_DEVICE
115  return 0;
116 }
117 
118 //Format is not always available for all FS
119 bool format(uint8_t FS, ESP3DOutput * output = nullptr)
120 {
121 #ifdef FILESYSTEM_FEATURE
122  if(FS == FS_FLASH) {
123  return ESP_FileSystem::format();
124  }
125 #endif //FILESYSTEM_FEATURE
126 #ifdef SD_DEVICE
127  if(FS == FS_SD) {
128  return ESP_SD::format(output);
129  }
130 #endif //SD_DEVICE
131  output->printERROR("Not available");
132  return false;
133 }
134 
135 //check type of FS according root dir
136 uint8_t ESP_GBFS::getFSType(const char * path)
137 {
138  String p = path;
139  p.trim();
140  if (p == "/") {
141  return FS_ROOT;
142  }
143 #if defined (FILESYSTEM_FEATURE)
144  if (p.startsWith(ESP_FLASH_FS_HEADER)) {
145  return FS_FLASH;
146  }
147 #endif //FILESYSTEM_FEATURE
148 #if defined (SD_DEVICE)
149  if (p.startsWith(ESP_SD_FS_HEADER)) {
150  return FS_SD;
151  }
152 #endif //SD_DEVICE
153  return FS_UNKNOWN;
154 }
155 
156 const char * ESP_GBFS::getRealPath(const char * path)
157 {
158  static String p;
159  uint8_t t = getFSType(path);
160  p = "";
161 #if defined (FILESYSTEM_FEATURE)
162  if (t == FS_FLASH) {
163  p = path;
164  //remove header
165  p.remove(0,strlen(ESP_FLASH_FS_HEADER));
166  //if nothing it is root
167  if (p.length() == 0) {
168  p = "/";
169  }
170  }
171 #endif //FILESYSTEM_FEATURE
172 #if defined (SD_DEVICE)
173  if (t == FS_SD) {
174  p = path;
175  //remove header
176  p.remove(0,strlen(ESP_SD_FS_HEADER));
177  //if nothing it is root
178  if (p.length() == 0) {
179  p = "/";
180  }
181  }
182 #endif //SD_DEVICE
183  return p.c_str();
184 }
185 
186 //path exists on / or SD or FS
187 bool ESP_GBFS::exists(const char* path)
188 {
189 
190 #if defined (FILESYSTEM_FEATURE) || defined(SD_DEVICE)
191  uint8_t t = getFSType(path);
192  if (t == FS_ROOT) {
193  return true;
194  }
195 #if defined (FILESYSTEM_FEATURE)
196  if (t == FS_FLASH) {
197  return ESP_FileSystem::exists(getRealPath(path));
198  }
199 #endif //FILESYSTEM_FEATURE
200 #if defined (SD_DEVICE)
201  if (t == FS_SD) {
202  return ESP_SD::exists(getRealPath(path));
203  }
204 #endif //SD_DEVICE
205 #endif // FILESYSTEM_FEATURE || SD_DEVICE
206  return false;
207 }
208 
209 bool ESP_GBFS::remove(const char *path)
210 {
211 #if defined (FILESYSTEM_FEATURE) || defined(SD_DEVICE)
212  uint8_t t = getFSType(path);
213  if (t == FS_ROOT) {
214  return false;
215  }
216 #if defined (FILESYSTEM_FEATURE)
217  if (t == FS_FLASH) {
218  return ESP_FileSystem::remove(getRealPath(path));
219  }
220 #endif //FILESYSTEM_FEATURE
221 #if defined (SD_DEVICE)
222  if (t == FS_SD) {
223  return ESP_SD::remove(getRealPath(path));
224  }
225 #endif //SD_DEVICE
226 #endif // FILESYSTEM_FEATURE || SD_DEVICE
227  return false;
228 }
229 
230 bool ESP_GBFS::rename(const char *oldpath, const char *newpath)
231 {
232 #if defined (FILESYSTEM_FEATURE) || defined(SD_DEVICE)
233  uint8_t t = getFSType(oldpath);
234  if (t == FS_ROOT) {
235  return false;
236  }
237 #if defined (FILESYSTEM_FEATURE)
238  if (t == FS_FLASH) {
239  return ESP_FileSystem::rename(getRealPath(oldpath), getRealPath(newpath));
240  }
241 #endif //FILESYSTEM_FEATURE
242 #if defined (SD_DEVICE)
243  if (t == FS_SD) {
244  return ESP_SD::rename(getRealPath(oldpath), getRealPath(newpath));
245  }
246 #endif //SD_DEVICE
247 #endif // FILESYSTEM_FEATURE || SD_DEVICE
248  return false;
249 }
250 
251 bool ESP_GBFS::mkdir(const char *path)
252 {
253 #if defined (FILESYSTEM_FEATURE) || defined(SD_DEVICE)
254  uint8_t t = getFSType(path);
255  if (t == FS_ROOT) {
256  return false;
257  }
258 #if defined (FILESYSTEM_FEATURE)
259  if (t == FS_FLASH) {
260  return ESP_FileSystem::mkdir(getRealPath(path));
261  }
262 #endif //FILESYSTEM_FEATURE
263 #if defined (SD_DEVICE)
264  if (t == FS_SD) {
265  return ESP_SD::mkdir(getRealPath(path));
266  }
267 #endif //SD_DEVICE
268 #endif // FILESYSTEM_FEATURE || SD_DEVICE
269  return false;
270 }
271 
272 bool ESP_GBFS::rmdir(const char *path)
273 {
274 #if defined (FILESYSTEM_FEATURE) || defined(SD_DEVICE)
275  uint8_t t = getFSType(path);
276  if (t == FS_ROOT) {
277  return false;
278  }
279 #if defined (FILESYSTEM_FEATURE)
280  if (t == FS_FLASH) {
281  return ESP_FileSystem::rmdir(getRealPath(path));
282  }
283 #endif //FILESYSTEM_FEATURE
284 #if defined (SD_DEVICE)
285  if (t == FS_SD) {
286  return ESP_SD::rmdir(getRealPath(path));
287  }
288 #endif //SD_DEVICE
289 #endif // FILESYSTEM_FEATURE || SD_DEVICE
290  return false;
291 }
292 
294 {
295  getNextFS(true);
296 #if defined (FILESYSTEM_FEATURE)
298 #endif //FILESYSTEM_FEATURE
299 #if defined (SD_DEVICE)
301 #endif //SD_DEVICE
302 }
303 
304 ESP_GBFile ESP_GBFS::open(const char* path, uint8_t mode)
305 {
306  ESP_GBFile f;
307 #if defined (FILESYSTEM_FEATURE) || defined(SD_DEVICE)
308  uint8_t t = getFSType(path);
309  if ((t == FS_ROOT) && (mode == ESP_FILE_READ)) {
310  f = ESP_GBFile(FS_ROOT);
311  //reset index;
312  getNextFS(true);
313  }
314 #if defined (FILESYSTEM_FEATURE)
315  if (t == FS_FLASH) {
316  f = ESP_FileSystem::open(getRealPath(path), mode);
317  }
318 #endif //FILESYSTEM_FEATURE
319 #if defined (SD_DEVICE)
320  if (t == FS_SD) {
321  f = ESP_SD::open(getRealPath(path), mode);
322  }
323 #endif //SD_DEVICE
324 #endif // FILESYSTEM_FEATURE || SD_DEVICE
325  return f;
326 }
327 
328 
329 //Default File is no file
331 {
332  _type = FS_UNKNOWN;
333 }
334 
335 //File handle for the root
337 {
338  _type = FS;
339 }
340 
341 //Handle for flash file
342 #ifdef FILESYSTEM_FEATURE
344 {
345  _type = FS_FLASH;
346  _flashFile = flashFile;
347 #ifdef SD_DEVICE
348  _sdFile = ESP_SDFile();
349 #endif //SD_DEVICE
350 }
351 #endif //FILESYSTEM_FEATURE
352 
353 //Handle for SD file
354 #ifdef SD_DEVICE
356 {
357  _type = FS_SD;
358  _sdFile = sdFile;
359 #ifdef FILESYSTEM_FEATURE
360  _flashFile = ESP_File();
361 #endif //FILESYSTEM_FEATURE
362 }
363 #endif //SD_DEVICE
364 
365 //Destructor
367 {
368 }
369 
370 ESP_GBFile::operator bool() const
371 {
372 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
373  if (_type == FS_ROOT) {
374  return true;
375  }
376 #endif //FILESYSTEM_FEATURE || SD_DEVICE
377 #ifdef FILESYSTEM_FEATURE
378  if (_type == FS_FLASH) {
379  return _flashFile;
380  }
381 #endif //FILESYSTEM_FEATURE
382 #ifdef SD_DEVICE
383  if (_type == FS_SD) {
384  return _sdFile;
385  }
386 #endif //SD_DEVICE
387  return false;
388 }
389 
391 {
392 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
393  if (_type == FS_ROOT) {
394  //TBD
395  }
396 #endif //FILESYSTEM_FEATURE || SD_DEVICE
397 #ifdef FILESYSTEM_FEATURE
398  if (_type == FS_FLASH) {
399  _flashFile.close();
400  }
401 #endif //FILESYSTEM_FEATURE
402 #ifdef SD_DEVICE
403  if (_type == FS_SD) {
404  return _sdFile.close();
405  }
406 #endif //SD_DEVICE
407 }
408 
410 {
411 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
412  if (_type == FS_ROOT) {
413  return true;
414  }
415 #endif //FILESYSTEM_FEATURE || SD_DEVICE
416 #ifdef FILESYSTEM_FEATURE
417  if (_type == FS_FLASH) {
418  return _flashFile.isOpen();
419  }
420 #endif //FILESYSTEM_FEATURE
421 #ifdef SD_DEVICE
422  if (_type == FS_SD) {
423  return _sdFile.isOpen();
424  }
425 #endif //SD_DEVICE
426  return false;
427 }
428 
429 const char* ESP_GBFile::name() const
430 {
431  static String s;
432 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
433  if (_type == FS_ROOT) {
434  return "/";
435  }
436 #endif //FILESYSTEM_FEATURE || SD_DEVICE
437 #ifdef FILESYSTEM_FEATURE
438  if (_type == FS_FLASH) {
439  if (strcmp(_flashFile.name(), "/") == 0) {
441  s.remove(0,1);
442  return s.c_str();
443  }
444  return _flashFile.name();
445  }
446 #endif //FILESYSTEM_FEATURE
447 #ifdef SD_DEVICE
448  if (_type == FS_SD) {
449  if (strcmp(_sdFile.name(), "/") == 0) {
450  s = ESP_SD_FS_HEADER;
451  s.remove(0,1);
452  return s.c_str();
453  }
454  return _sdFile.name();
455  }
456 #endif //SD_DEVICE
457  return "";
458 }
459 
460 const char* ESP_GBFile::filename() const
461 {
462 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
463  static String s;
464  if (_type == FS_ROOT) {
465  return "/";
466  }
467 #endif //FILESYSTEM_FEATURE || SD_DEVICE
468 #ifdef FILESYSTEM_FEATURE
469  if (_type == FS_FLASH) {
471  s += _flashFile.filename();
472  return s.c_str();
473  }
474 #endif //FILESYSTEM_FEATURE
475 #ifdef SD_DEVICE
476  if (_type == FS_SD) {
477  s = ESP_SD_FS_HEADER;
478  s += s += _sdFile.filename();
479  return s.c_str();
480  }
481 #endif //SD_DEVICE
482  return "";
483 }
484 
486 {
487 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
488  if (_type == FS_ROOT) {
489  return true;
490  }
491 #endif //FILESYSTEM_FEATURE || SD_DEVICE
492 #ifdef FILESYSTEM_FEATURE
493  if (_type == FS_FLASH) {
494  return _flashFile.isDirectory();
495  }
496 #endif //FILESYSTEM_FEATURE
497 #ifdef SD_DEVICE
498  if (_type == FS_SD) {
499  return _sdFile.isDirectory();
500  }
501 #endif //SD_DEVICE
502  return false;
503 }
504 
506 {
507 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
508  if (_type == FS_ROOT) {
509  return 0;
510  }
511 #endif //FILESYSTEM_FEATURE || SD_DEVICE
512 #ifdef FILESYSTEM_FEATURE
513  if (_type == FS_FLASH) {
514  return _flashFile.size();
515  }
516 #endif //FILESYSTEM_FEATURE
517 #ifdef SD_DEVICE
518  if (_type == FS_SD) {
519  return _sdFile.size();
520  }
521 #endif //SD_DEVICE
522  return 0;
523 }
524 
526 {
527  if (_type == FS_FLASH) {
528  return _flashFile.getLastWrite();
529  }
530  if (_type == FS_SD) {
531  return _sdFile.getLastWrite();
532  }
533  return 0;
534 }
535 
537 {
538 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
539  if (_type == FS_ROOT) {
540  return 0;
541  }
542 #endif //FILESYSTEM_FEATURE || SD_DEVICE
543 #ifdef FILESYSTEM_FEATURE
544  if (_type == FS_FLASH) {
545  return _flashFile.available();
546  }
547 #endif //FILESYSTEM_FEATURE
548 #ifdef SD_DEVICE
549  if (_type == FS_SD) {
550  return _sdFile.available();
551  }
552 #endif //SD_DEVICE
553  return 0;
554 }
555 
556 size_t ESP_GBFile::write(uint8_t i)
557 {
558 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
559  if (_type == FS_ROOT) {
560  return 0;
561  }
562 #endif //FILESYSTEM_FEATURE || SD_DEVICE
563 #ifdef FILESYSTEM_FEATURE
564  if (_type == FS_FLASH) {
565  return _flashFile.write(i);
566  }
567 #endif //FILESYSTEM_FEATURE
568 #ifdef SD_DEVICE
569  if (_type == FS_SD) {
570  return _sdFile.write(i);
571  }
572 #endif //SD_DEVICE
573  return 0;
574 }
575 
576 size_t ESP_GBFile::write(const uint8_t *buf, size_t size)
577 {
578 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
579  if (_type == FS_ROOT) {
580  return 0;
581  }
582 #endif //FILESYSTEM_FEATURE || SD_DEVICE
583 #ifdef FILESYSTEM_FEATURE
584  if (_type == FS_FLASH) {
585  return _flashFile.write(buf, size);
586  }
587 #endif //FILESYSTEM_FEATURE
588 #ifdef SD_DEVICE
589  if (_type == FS_SD) {
590  return _sdFile.write(buf, size);
591  }
592 #endif //SD_DEVICE
593  return 0;
594 }
595 
597 {
598 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
599  if (_type == FS_ROOT) {
600  return -1;
601  }
602 #endif //FILESYSTEM_FEATURE || SD_DEVICE
603 #ifdef FILESYSTEM_FEATURE
604  if (_type == FS_FLASH) {
605  return _flashFile.read();
606  }
607 #endif //FILESYSTEM_FEATURE
608 #ifdef SD_DEVICE
609  if (_type == FS_SD) {
610  return _sdFile.read();
611  }
612 #endif //SD_DEVICE
613  return -1;
614 }
615 
616 size_t ESP_GBFile::read(uint8_t* buf, size_t size)
617 {
618 #if defined(FILESYSTEM_FEATURE) || defined(SD_DEVICE)
619  if (_type == FS_ROOT) {
620  return -1;
621  }
622 #endif //FILESYSTEM_FEATURE || SD_DEVICE
623 #ifdef FILESYSTEM_FEATURE
624  if (_type == FS_FLASH) {
625  return _flashFile.read(buf, size);
626  }
627 #endif //FILESYSTEM_FEATURE
628 #ifdef SD_DEVICE
629  if (_type == FS_SD) {
630  return _sdFile.read(buf, size);
631  }
632 #endif //SD_DEVICE
633  return -1;
634 }
635 
637 {
638 #ifdef FILESYSTEM_FEATURE
639  if (_type == FS_FLASH) {
640  return _flashFile.flush();
641  }
642 #endif //FILESYSTEM_FEATURE
643 #ifdef SD_DEVICE
644  if (_type == FS_SD) {
645  return _sdFile.flush();
646  }
647 #endif //SD_DEVICE
648  return ;
649 }
650 
652 {
653 #ifdef FILESYSTEM_FEATURE
654  _flashFile = other._flashFile;
655 #endif //FILESYSTEM_FEATURE
656 #ifdef SD_DEVICE
657  _sdFile = other._sdFile;
658 #endif //SD_DEVICE
659  _type = other._type;
660  return *this;
661 }
662 
663 #ifdef FILESYSTEM_FEATURE
665 {
666  _flashFile = other;
667 #ifdef SD_DEVICE
668  _sdFile = ESP_SDFile();
669 #endif //SD_DEVICE
670  _type = FS_FLASH;
671  return *this;
672 }
673 #endif //FILESYSTEM_FEATURE
674 #ifdef SD_DEVICE
676 {
677 #ifdef FILESYSTEM_FEATURE
678  _flashFile = ESP_File();
679 #endif //FILESYSTEM_FEATURE
680  _sdFile = other;
681  _type = FS_SD;
682  return *this;
683 }
684 #endif //SD_DEVICE
685 
686 const char * ESP_GBFS::getNextFS(bool reset)
687 {
688  static uint8_t index = 0;
689  if (reset) {
690  index = 0;
691  if(_nbFS == 0) {
692 #ifdef FILESYSTEM_FEATURE
693  _rootlist[_nbFS] = ESP_FLASH_FS_HEADER;
694  _nbFS++;
695 #endif //FILESYSTEM_FEATURE
696 #ifdef SD_DEVICE
697  _rootlist[_nbFS] = ESP_SD_FS_HEADER;
698  _nbFS++;
699 #endif //SD_DEVICE
700  }
701  return "";
702  }
703  if (index < _nbFS) {
704  uint8_t i = index;
705  index++;
706  return _rootlist[i].c_str();
707  }
708  return "";
709 }
710 
712 {
713  ESP_GBFile f;
714  if (_type == FS_ROOT) {
715  String path = ESP_GBFS::getNextFS();
716  if (path.length() > 0) {
717  f = ESP_GBFS::open(path.c_str());
718  f.close();
719  }
720  }
721 #ifdef FILESYSTEM_FEATURE
722  if (_type == FS_FLASH) {
723  f = _flashFile.openNextFile();
724  }
725 #endif //FILESYSTEM_FEATURE
726 #ifdef SD_DEVICE
727  if (_type == FS_SD) {
728  f = _sdFile.openNextFile();
729  }
730 #endif //SD_DEVICE
731  return f;
732 }
733 
734 #endif //GLOBAL_FILESYSTEM_FEATURE
ESP_GBFile::filename
const char * filename() const
Definition: esp_globalFS.cpp:460
ESP_File::close
void close()
ESP_FileSystem::closeAll
static void closeAll()
MAX_FS
#define MAX_FS
Definition: defines.h:129
ESP_GBFS::formatBytes
static String & formatBytes(uint64_t bytes)
Definition: esp_globalFS.cpp:57
ESP_GBFile::getLastWrite
time_t getLastWrite()
Definition: esp_globalFS.cpp:525
esp_globalFS.h
ESP_GBFile::available
int available()
Definition: esp_globalFS.cpp:536
ESP_SDFile::isDirectory
bool isDirectory()
Definition: esp_sd.cpp:125
ESP_GBFS::open
static ESP_GBFile open(const char *path, uint8_t mode=ESP_FILE_READ)
Definition: esp_globalFS.cpp:304
ESP_GBFile::isDirectory
bool isDirectory()
Definition: esp_globalFS.cpp:485
ESP_GBFile::~ESP_GBFile
~ESP_GBFile()
Definition: esp_globalFS.cpp:366
ESP_GBFS::mkdir
static bool mkdir(const char *path)
Definition: esp_globalFS.cpp:251
ESP_SD::closeAll
static void closeAll()
ESP_SD::open
static ESP_SDFile open(const char *path, uint8_t mode=ESP_FILE_READ)
ESP_SDFile::name
const char * name() const
Definition: esp_sd.cpp:115
ESP_File::name
const char * name() const
Definition: esp_filesystem.cpp:123
ESP_GBFile::openNextFile
ESP_GBFile openNextFile()
Definition: esp_globalFS.cpp:711
ESP_FILE_READ
#define ESP_FILE_READ
Definition: defines.h:120
ESP_SD::totalBytes
static uint64_t totalBytes()
ESP_SDFile::available
int available()
Definition: esp_sd.cpp:140
ESP_SDFile
Definition: esp_sd.h:31
ESP_SD::freeBytes
static uint64_t freeBytes()
ESP_FileSystem::usedBytes
static size_t usedBytes()
ESP_GBFile::close
void close()
Definition: esp_globalFS.cpp:390
ESP_SD::remove
static bool remove(const char *path)
ESP_GBFS::remove
static bool remove(const char *path)
Definition: esp_globalFS.cpp:209
ESP_GBFS::exists
static bool exists(const char *path)
Definition: esp_globalFS.cpp:187
ESP_SDFile::write
size_t write(uint8_t i)
Definition: esp_sd.cpp:148
ESP_FileSystem::remove
static bool remove(const char *path)
ESP_FileSystem::totalBytes
static size_t totalBytes()
ESP_SDFile::size
size_t size()
Definition: esp_sd.cpp:130
ESP_GBFile::write
size_t write(uint8_t i)
Definition: esp_globalFS.cpp:556
ESP_File::getLastWrite
time_t getLastWrite()
Definition: esp_filesystem.cpp:143
ESP_GBFS::rmdir
static bool rmdir(const char *path)
Definition: esp_globalFS.cpp:272
ESP_SDCARD_IDLE
#define ESP_SDCARD_IDLE
Definition: defines.h:80
ESP_GBFS::~ESP_GBFS
~ESP_GBFS()
Definition: esp_globalFS.cpp:52
FS_UNKNOWN
#define FS_UNKNOWN
Definition: defines.h:128
FS_FLASH
#define FS_FLASH
Definition: defines.h:125
ESP_File::isOpen
bool isOpen()
Definition: esp_filesystem.cpp:118
ESP_GBFile::operator=
ESP_GBFile & operator=(const ESP_GBFile &other)
Definition: esp_globalFS.cpp:651
ESP_SD::rmdir
static bool rmdir(const char *path)
ESP_FileSystem::mkdir
static bool mkdir(const char *path)
ESP_SD::mkdir
static bool mkdir(const char *path)
ESP_File::filename
const char * filename() const
Definition: esp_filesystem.cpp:128
ESP_GBFile::name
const char * name() const
Definition: esp_globalFS.cpp:429
ESP_SD_FS_HEADER
#define ESP_SD_FS_HEADER
Definition: esp_sd.h:27
ESP_GBFile
Definition: esp_globalFS.h:34
ESP_File::openNextFile
ESP_File openNextFile()
ESP_SDFile::getLastWrite
time_t getLastWrite()
Definition: esp_sd.cpp:135
ESP_FileSystem::format
static bool format()
ESP_GBFile::ESP_GBFile
ESP_GBFile()
Definition: esp_globalFS.cpp:330
ESP_GBFS::isavailable
static bool isavailable(uint8_t FS)
Definition: esp_globalFS.cpp:28
ESP_File
Definition: esp_filesystem.h:30
ESP_SDFile::openNextFile
ESP_SDFile openNextFile()
ESP_FLASH_FS_HEADER
#define ESP_FLASH_FS_HEADER
Definition: esp_filesystem.h:26
FS_ROOT
#define FS_ROOT
Definition: defines.h:124
ESP_SD::getState
static uint8_t getState(bool refresh)
ESP_GBFS::getNextFS
static const char * getNextFS(bool reset=false)
Definition: esp_globalFS.cpp:686
ESP_GBFS::closeAll
static void closeAll()
Definition: esp_globalFS.cpp:293
ESP_GBFS::freeBytes
static uint64_t freeBytes(uint8_t FS)
Definition: esp_globalFS.cpp:103
ESP_SDFile::read
int read()
Definition: esp_sd.cpp:164
ESP_SDFile::isOpen
bool isOpen()
Definition: esp_sd.cpp:110
ESP_GBFS::getFSType
static uint8_t getFSType(const char *path)
Definition: esp_globalFS.cpp:136
ESP_FileSystem::rmdir
static bool rmdir(const char *path)
ESP_FileSystem::rename
static bool rename(const char *oldpath, const char *newpath)
ESP_GBFile::flush
void flush()
Definition: esp_globalFS.cpp:636
ESP_SD::format
static bool format(ESP3DOutput *output=nullptr)
ESP_File::read
int read()
Definition: esp_filesystem.cpp:172
ESP_FileSystem::freeBytes
static size_t freeBytes()
ESP_SDFile::flush
void flush()
Definition: esp_sd.cpp:180
ESP_GBFS::totalBytes
static uint64_t totalBytes(uint8_t FS)
Definition: esp_globalFS.cpp:73
ESP_GBFS::rename
static bool rename(const char *oldpath, const char *newpath)
Definition: esp_globalFS.cpp:230
FS_SD
#define FS_SD
Definition: defines.h:126
ESP_SDFile::close
void close()
ESP_SD::rename
static bool rename(const char *oldpath, const char *newpath)
ESP_GBFile::read
int read()
Definition: esp_globalFS.cpp:596
ESP_GBFile::isOpen
bool isOpen()
Definition: esp_globalFS.cpp:409
format
bool format(uint8_t FS, ESP3DOutput *output=nullptr)
Definition: esp_globalFS.cpp:119
ESP_GBFS::ESP_GBFS
ESP_GBFS()
Definition: esp_globalFS.cpp:46
ESP_File::write
size_t write(uint8_t i)
Definition: esp_filesystem.cpp:156
ESP_GBFile::size
size_t size()
Definition: esp_globalFS.cpp:505
ESP_File::size
size_t size()
Definition: esp_filesystem.cpp:138
ESP_SD::exists
static bool exists(const char *path)
ESP_FileSystem::started
static bool started()
Definition: esp_filesystem.h:85
ESP_File::available
int available()
Definition: esp_filesystem.cpp:148
ESP_FileSystem::exists
static bool exists(const char *path)
ESP3DOutput
Definition: esp3doutput.h:48
ESP_SDFile::filename
const char * filename() const
Definition: esp_sd.cpp:120
ESP_GBFS::usedBytes
static uint64_t usedBytes(uint8_t FS)
Definition: esp_globalFS.cpp:88
ESP_SD::usedBytes
static uint64_t usedBytes()
ESP_FileSystem::open
static ESP_File open(const char *path, uint8_t mode=ESP_FILE_READ)
ESP_File::flush
void flush()
Definition: esp_filesystem.cpp:188
ESP_File::isDirectory
bool isDirectory()
Definition: esp_filesystem.cpp:133