ESP_IOT v2.5
IOT ESP Coding
SPIFFModule.cpp
Go to the documentation of this file.
1
2#include "SPIFFModule.h"
3
4#ifdef USE_SPIFF_MODULE
5
6#define SPIFF_FILE_NAME (char*)"/messages.txt"
7
8#include "FS.h"
9#include "SPIFFS.h"
10
11/* You only need to format SPIFFS the first time you run a
12 test or else use the SPIFFS plugin to create a partition
13 https://github.com/me-no-dev/arduino-esp32fs-plugin */
14
15//! @see https://techtutorialsx.com/2019/06/02/esp8266-spiffs-reading-a-file/
16#define FORMAT_SPIFFS_IF_FAILED true
17
18//!helper for using the spiff or not..
19boolean useSpiff()
20{
22
23}
24
25//!list the directory of the SPIFF
26void listDir(fs::FS &fs, const char * dirname, uint8_t levels)
27{
28 if (!useSpiff())
29 return;
30
31 SerialDebug.printf("Listing directory: %s\r\n", dirname);
32
33 File root = fs.open(dirname);
34 if(!root){
35 SerialDebug.println("- failed to open directory");
36 return;
37 }
38 if(!root.isDirectory()){
39 SerialDebug.println(" - not a directory");
40 return;
41 }
42
43 File file = root.openNextFile();
44 while(file){
45 if(file.isDirectory()){
46 SerialDebug.print(" DIR : ");
47 SerialDebug.println(file.name());
48 if(levels){
49 //listDir(fs, file.path(), levels -1);
50 listDir(fs, file.name(), levels -1);
51
52 }
53 } else {
54 SerialDebug.print(" FILE: ");
55 SerialDebug.print(file.name());
56 SerialDebug.print("\tSIZE: ");
57 SerialDebug.println(file.size());
58 }
59 file = root.openNextFile();
60 }
61}
62
63//!reads the file name specified. The result is SerialDebug.write
64void readFile(fs::FS &fs, const char * path)
65{
66 if (!useSpiff())
67 return;
68
69 SerialDebug.printf("Reading file: %s\r\n", path);
70 SerialDebug.printf(" *** Done reading ****");
71
72 File file = fs.open(path);
73 if(!file || file.isDirectory()){
74 SerialDebug.println("- failed to open file for reading");
75 return;
76 }
77
78 SerialDebug.println("- read from file:");
79 while(file.available()){
80 SerialDebug.write(file.read());
81 }
82 file.close();
83}
84
85//!writes the message to the file specified
86void writeFile(fs::FS &fs, const char * path, const char * message)
87{
88 if (!useSpiff())
89 return;
90
91 SerialDebug.printf("Writing file: %s\r\n", path);
92
93 File file = fs.open(path, FILE_WRITE);
94 if(!file){
95 SerialDebug.println("- failed to open file for writing");
96 return;
97 }
98 if(file.print(message)){
99 SerialDebug.println("- file written");
100 } else {
101 SerialDebug.println("- write failed");
102 }
103 file.close();
104}
105
106//! appends the message to the file
107void appendFile(fs::FS &fs, const char * path, const char * message)
108{
109 if (!useSpiff())
110 return;
111
112 SerialLots.printf("Appending to file: %s\r\n", path);
113
114 File file = fs.open(path, FILE_APPEND);
115 if(!file){
116 SerialDebug.println("- failed to open file for appending");
117 return;
118 }
119 if(file.print(message)){
120 SerialLots.println("- message appended");
121 } else {
122 SerialDebug.println("- append failed");
123 }
124 file.close();
125}
126
127//! renames the file
128void renameFile(fs::FS &fs, const char * path1, const char * path2)
129{
130 if (!useSpiff())
131 return;
132
133 SerialMin.printf("Renaming file %s to %s\r\n", path1, path2);
134 if (fs.rename(path1, path2)) {
135 SerialMin.println("- file renamed");
136 } else {
137 SerialDebug.println("- rename failed");
138 }
139}
140
141//!deletes the file specified
142void deleteFile(fs::FS &fs, const char * path)
143{
144 if (!useSpiff())
145 return;
146
147 SerialMin.printf("Deleting file: %s\r\n", path);
148 if(fs.remove(path)){
149 SerialMin.println("- file deleted");
150 } else {
151 SerialDebug.println("- delete failed");
152 }
153}
154
155#ifdef NOT_USED
156void testFileIO(fs::FS &fs, const char * path)
157{
158 SerialLots.printf("Testing file I/O with %s\r\n", path);
159
160 static uint8_t buf[512];
161 size_t len = 0;
162 File file = fs.open(path, FILE_WRITE);
163 if(!file){
164 SerialDebug.println("- failed to open file for writing");
165 return;
166 }
167
168 size_t i;
169 SerialDebug.print("- writing" );
170 uint32_t start = millis();
171 for(i=0; i<2048; i++){
172 if ((i & 0x001F) == 0x001F){
173 SerialDebug.print(".");
174 }
175 file.write(buf, 512);
176 }
177 SerialDebug.println("");
178 uint32_t end = millis() - start;
179 SerialDebug.printf(" - %u bytes written in %u ms\r\n", 2048 * 512, end);
180 file.close();
181
182 file = fs.open(path);
183 start = millis();
184 end = start;
185 i = 0;
186 if(file && !file.isDirectory()){
187 len = file.size();
188 size_t flen = len;
189 start = millis();
190 SerialDebug.print("- reading" );
191 while(len){
192 size_t toRead = len;
193 if(toRead > 512){
194 toRead = 512;
195 }
196 file.read(buf, toRead);
197 if ((i++ & 0x001F) == 0x001F){
198 SerialDebug.print(".");
199 }
200 len -= toRead;
201 }
202 SerialDebug.println("");
203 end = millis() - start;
204 SerialDebug.printf("- %u bytes read in %u ms\r\n", flen, end);
205 file.close();
206 } else {
207 SerialDebug.println("- failed to open file for reading");
208 }
209}
210#endif
211
212
213 // writeFile(SPIFFS, "/hello.txt", "Hello ESP ");
214 //appendFile(SPIFFS, "/hello.txt", "Another line of text\r\n");
215
216 // appendFile(SPIFFS, "/hello.txt", "World!\r\n");
217
218
219 //readFile(SPIFFS, "/hello.txt");
220 // renameFile(SPIFFS, "/hello.txt", "/foo.txt");
221 // readFile(SPIFFS, "/foo.txt");
222 // deleteFile(SPIFFS, "/foo.txt");
223 // testFileIO(SPIFFS, "/test.txt");
224 // deleteFile(SPIFFS, "/test.txt");
225 //SerialDebug.println( "Test complete" );
226
227//! The SPIFF module is for storing messages that are retrievable later as it stores on a folder area of the ESP chip
228
229//!print a string to spiff (a new line is added)
230void println_SPIFFModule(char *string)
231{
232 print_SPIFFModule(string);
233 print_SPIFFModule((char*)"\r\n");
234}
235
236//!print a string to spiff (NO new line is added)
237void print_SPIFFModule(char *string)
238{
239 appendFile(SPIFFS, SPIFF_FILE_NAME, string);
240}
241//!print a int to spiff (NO new line is added)
243{
244 char str[20];
245 sprintf(str,"%d",val);
247}
248
249//! delete the spiff files..
251{
253}
254
255//! prints the spiff file to the SerialDebug output
257{
258 readFile(SPIFFS, SPIFF_FILE_NAME);
259}
260
261
262//! calculate the length of the SPFF file
263int len_SPIFFFile(fs::FS &fs, const char * path)
264{
265 int len = 0;
266 File file = fs.open(path);
267
268 if(!file || file.isDirectory()){
269 SerialDebug.println("- failed to open file for reading");
270 return 0;
271 }
272
273 //now the rest of the lines can be sent..
274 while(file.available())
275 {
276 String line = file.readString();
277
278 //char * cstr = new char [str.length()+1];
279 if (line)
280 {
281 len += line.length();
282 }
283 }
284 file.close();
285 return len;
286}
287
288//!reads the file name specified. returning the number of lines..
289int linesInFile_SPIFFModule(fs::FS &fs, const char * path)
290{
291
292 if (!useSpiff())
293 return 0;
294
295 //count the lines
296 int lines = 0;
297 File file = fs.open(path);
298 if(!file || file.isDirectory()){
299 SerialDebug.println("- failed to open file for reading");
300 return lines;
301 }
302
303 while(file.available()){
304 lines++;
305 file.readString();
306 }
307 file.close();
308 return lines;
309}
310
311#ifdef OLD
312#define BUFFER_MAX 15000f
313char *_buffer = NULL;
314#endif
315
316//! sends SPIFF module strings over MQTT, starting at the number back specified. This will use the current users MQTT credentials..
317void sendStrings_SPIFFModule(int numberOfLines)
318{
319 if (!useSpiff())
320 return;
321 //! publish a binary file..
322 //! fileExtension is .jpg, .json, .txt etc
323
324 int len = len_SPIFFFile(SPIFFS, SPIFF_FILE_NAME);
325 SerialDebug.printf("sendStrings_SPIFFModule (%d)\n", len);
326 //! 8.16.25 MQTT
327 publishSPIFFFile_MQTT((char*)"usersP/bark/images", SPIFF_FILE_NAME, len);
328
329#ifdef OLD
330
331 SerialDebug.println("sendStrings_SPIFFModule");
332
333 fs::FS fs = SPIFFS;
334 char *path = SPIFF_FILE_NAME;
335 int linesMax = linesInFile_SPIFFModule(SPIFFS, SPIFF_FILE_NAME);
336 SerialDebug.printf("linesMax = %d\n", linesMax);
337 //somehow send over MQTT..
338 //! 8.16.25 MQTT
339// if (numberOfLines > 120)
340// numberOfLines = 120;
341 // no limit
342 numberOfLines = 500;
343
344
345 //fast forward lines - numberOfLines
346 // eg. if # = 100, but only want last 10, then
347 int skipLines = linesMax - numberOfLines;
348 if (skipLines < 0)
349 skipLines = 0;
350
351 //! PROBLEM: if only N lines fit into buffer .. how to delete only up to those lines?
352
353 File file = fs.open(path);
354 if(!file || file.isDirectory()){
355 SerialDebug.println("- failed to open file for reading");
356 return;
357 }
358
359 int counter = 0;
360 while(file.available() && counter < skipLines){
361 file.readString();
362 counter++;
363 }
364#define POST_AS_BUFFER
365#ifdef POST_AS_BUFFER
366
367 if (!_buffer)
368 {
369 _buffer = (char*) calloc(1,BUFFER_MAX);
370 }
371
372 //!send a header
373 //sendMessageNoChangeMQTT((char*)"Sending Post Mortum Debug");
374 counter = 0;
375//#define BUFFER_MAX 15000
376// char buffer[BUFFER_MAX];
377 //now the rest of the lines can be sent..
378 while(file.available() && counter < numberOfLines)
379 {
380 String line = file.readString();
381 SerialDebug.println(line);
382 //char * cstr = new char [str.length()+1];
383 if (line)
384 {
385
386 //! get out if too big..
387 if (strlen(_buffer) > line.length() + 100)
388 {
389 sendMessageNoChangeMQTT((char*)"BUFFER too big for SPIFF POST");
390
391 SerialDebug.println(" **** BUFFER too big stopping");
392 numberOfLines = 0;
393 }
394 else
395
396 //strcpy (buffer, line.c_str());
397 strcpy (_buffer, line.c_str());
398
399
400 //send the string verbatum..
401 //sendMessageNoChangeMQTT(buffer);
402 }
403 counter++;
404 }
405 file.close();
406 //!send a header
407 //sendMessageNoChangeMQTT((char*)"Done Post Mortum Debug");
408 SerialDebug.printf("now publishBinary(%d)\n", strlen(_buffer));
409 publishBinaryFile((char*)"usersP/bark/images",(uint8_t*) _buffer, strlen(_buffer),"json");
410
411#else
412 sendMessageNoChangeMQTT((char*)"Sending Post Mortum Debug ..todo");
413
414#endif
415#endif // OLD
416}
417
418//!writes a FB to a file..
420 uint8_t * buf, /*!< Pointer to the pixel data */
421 size_t len, /*!< Length of the buffer in bytes */
422 char *fileName)
423{
424 if (!useSpiff())
425 return;
426
427 File file = SPIFFS.open(fileName, FILE_WRITE);
428 if(!file){
429 SerialDebug.println("- failed to open file for writing");
430 return;
431 }
432 if(file.write(buf,len)){
433 SerialDebug.println("- file written");
434 } else {
435 SerialDebug.println("- write failed");
436 }
437 file.close();
438}
439
440//! the setup for this module
442{
443 SerialDebug.println("SPIFFS setup");
444
445 if (!useSpiff())
446 {
447 SerialDebug.println("not being used: SPIFFS");
448
449 return;
450 }
451
452 if(!SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)){
453 SerialDebug.println("SPIFFS Mount Failed");
454 return;
455 }
456 listDir(SPIFFS, "/", 0);
457
458//testing:
459 boolean test1 = false;
460 if (test1)
461 {
462 // try reading the file
464 }
465
466 boolean test2 = false;
467 if (test2)
468 {
469 // try reading the file
471 }
472}
473
474//! a loop if anything (nothing right now)
476{
477}
478
479//! sends the Semantic Marker onto the SPIFF
480//! format- {'time':time, 'SM':'<sm>'}
481void printSM_SPIFFModule(char *semanticMarker)
482{
483 println_SPIFFModule_JSON((char*)"SM",semanticMarker);
484
485}
486
487//! 4.4.24 output a line in JSON format adding timestamp as well
488//! {'time':time, 'attribute':'value'}
489void println_SPIFFModule_JSON(char *attribute, char *value)
490{
492 {
493 //!print a time too..
494 //!NEED a format for this to distinguish from others..
495 print_SPIFFModule((char*) "{\"time\":\"");
497 print_SPIFFModule((char*) "\",");
498 print_SPIFFModule((char*) "\"");
499 print_SPIFFModule(attribute);
500 print_SPIFFModule((char*)"\":\"");
501 print_SPIFFModule(value);
502 println_SPIFFModule((char*)"\"},");
503 }
504}
505
506//!prints a timestamp time: <time> :
508{
509 if (!useSpiff())
510 return;
511
512 print_SPIFFModule((char*)" time: ");
514 print_SPIFFModule((char*)": ");
515}
516
517#ifdef M5_CAPTURE_SCREEN
518/***************************************************************************************
519 * Function name: M5Screen2bmp
520 * Description: Dump the screen to a WiFi client
521 * Image file format: Content-type:image/bmp
522 * return value: always true
523 ***************************************************************************************/
524bool M5Screen2bmp(WiFiClient &client){
525 TFT_eSprite canvas = TFT_eSprite(&M5.Lcd);
526
527 int image_height = M5.Lcd.height();
528 int image_width = M5.Lcd.width();
529
530 //https://docs.m5stack.com/en/api/core2/lcd_api
531 canvas.createSprite(image_width, image_height);
532 //canvas.println("HELLO M5 Canvas");
533 canvas.fillSprite(RED);
534 canvas.fillCircle(100,100,20,GREEN);
535 canvas.pushSprite(0,0,WHITE);
536
537 const uint pad=(4-(3*image_width)%4)%4;
538 uint filesize=54+(3*image_width+pad)*image_height;
539 unsigned char header[54] = {
540 'B','M', // BMP signature (Windows 3.1x, 95, NT, …)
541 0,0,0,0, // image file size in bytes
542 0,0,0,0, // reserved
543 54,0,0,0, // start of pixel array
544 40,0,0,0, // info header size
545 0,0,0,0, // image width
546 0,0,0,0, // image height
547 1,0, // number of color planes
548 24,0, // bits per pixel
549 0,0,0,0, // compression
550 0,0,0,0, // image size (can be 0 for uncompressed images)
551 0,0,0,0, // horizontal resolution (dpm)
552 0,0,0,0, // vertical resolution (dpm)
553 0,0,0,0, // colors in color table (0 = none)
554 0,0,0,0 };// important color count (0 = all colors are important)
555 // fill filesize, width and heigth in the header array
556 for(uint i=0; i<4; i++) {
557 header[ 2+i] = (char)((filesize>>(8*i))&255);
558 header[18+i] = (char)((image_width >>(8*i))&255);
559 header[22+i] = (char)((image_height >>(8*i))&255);
560 }
561 // write the header to the file
562 client.write(header, 54);
563
564 // To keep the required memory low, the image is captured line by line
565 unsigned char line_data[image_width*3+pad];
566 // initialize padded pixel with 0
567 for(int i=(image_width-1)*3; i<(image_width*3+pad); i++){
568 line_data[i]=0;
569 }
570 // The coordinate origin of a BMP image is at the bottom left.
571 // Therefore, the image must be read from bottom to top.
572 for(int y=image_height; y>0; y--){
573 // get one line of the screen content
574 // M5.Lcd.readRectRGB(0, y-1, image_width, 1, line_data);
575 canvas.readRectRGB(0, y-1, image_width, 1, line_data);
576
577 // BMP color order is: Blue, Green, Red
578 // return values from readRectRGB is: Red, Green, Blue
579 // therefore: R und B need to be swapped
580 for(int x=0; x<image_width; x++){
581 unsigned char r_buff = line_data[x*3];
582 SerialTemp.print(r_buff);
583 line_data[x*3] = line_data[x*3+2];
584 line_data[x*3+2] = r_buff;
585 }
586 SerialTemp.println();
587 // write the line to the file
588 client.write(line_data, (image_width*3)+pad);
589 }
590 return true;
591}
592
593//!https://github.com/m5stack/M5StickC/issues/74
594//!Says replace M5.Lcd with LCD::canvas
595
596//!save the screen to the SPIFF .. testing
597//!@see https://github.com/electricidea/M5Stack-Screen-Capture
598//!@see https://www.hackster.io/hague/m5stack-screen-capture-and-remote-control-142cfe
599//!
600/***************************************************************************************
601 * Function name: M5Screen2bmp
602 * Description: Dump the screen to a bmp image File
603 * Image file format: .bmp
604 * return value: true: succesfully wrote screen to file
605 * false: unabel to open file for writing
606 * example for screen capture onto SD-Card:
607 * M5Screen2bmp(SD, "/screen.bmp");
608 * inspired by: https://stackoverflow.com/a/58395323
609 ***************************************************************************************/
610bool M5Screen2bmp(fs::FS &fs, const char * path){
611 // Open file for writing
612 // The existing image file will be replaced
613 File file = fs.open(path, FILE_WRITE);
614 if(file){
615 // M5Stack: TFT_WIDTH = 240 / TFT_HEIGHT = 320
616 // M5StickC: TFT_WIDTH = 80 / TFT_HEIGHT = 160
617 // M5StickCplus: TFT_WIDTH = 135 / TFT_HEIGHT = 240
618 int image_height = M5.Lcd.height();
619 int image_width = M5.Lcd.width();
620 SerialDebug.printf("Saving screen to bmp file (%d,%d)\n", image_width, image_height);
621
622 // horizontal line must be a multiple of 4 bytes long
623 // add padding to fill lines with 0
624 const uint pad=(4-(3*image_width)%4)%4;
625 // header size is 54 bytes:
626 // File header = 14 bytes
627 // Info header = 40 bytes
628 uint filesize=54+(3*image_width+pad)*image_height;
629 unsigned char header[54] = {
630 'B','M', // BMP signature (Windows 3.1x, 95, NT, …)
631 0,0,0,0, // image file size in bytes
632 0,0,0,0, // reserved
633 54,0,0,0, // start of pixel array
634 40,0,0,0, // info header size
635 0,0,0,0, // image width
636 0,0,0,0, // image height
637 1,0, // number of color planes
638 24,0, // bits per pixel
639 0,0,0,0, // compression
640 0,0,0,0, // image size (can be 0 for uncompressed images)
641 0,0,0,0, // horizontal resolution (dpm)
642 0,0,0,0, // vertical resolution (dpm)
643 0,0,0,0, // colors in color table (0 = none)
644 0,0,0,0 };// important color count (0 = all colors are important)
645 // fill filesize, width and heigth in the header array
646 for(uint i=0; i<4; i++) {
647 header[ 2+i] = (char)((filesize>>(8*i))&255);
648 header[18+i] = (char)((image_width >>(8*i))&255);
649 header[22+i] = (char)((image_height >>(8*i))&255);
650 }
651 // write the header to the file
652 file.write(header, 54);
653
654 // To keep the required memory low, the image is captured line by line
655 unsigned char line_data[image_width*3+pad];
656 // initialize padded pixel with 0
657 for(int i=(image_width-1)*3; i<(image_width*3+pad); i++){
658 line_data[i]=0;
659 }
660 // The coordinate origin of a BMP image is at the bottom left.
661 // Therefore, the image must be read from bottom to top.
662 for(int y=image_height; y>0; y--){
663 // get one line of the screen content
664 M5.Lcd.readRectRGB(0, y-1, image_width, 1, line_data);
665 // BMP color order is: Blue, Green, Red
666 // return values from readRectRGB is: Red, Green, Blue
667 // therefore: R und B need to be swapped
668 for(int x=0; x<image_width; x++){
669 unsigned char r_buff = line_data[x*3];
670 line_data[x*3] = line_data[x*3+2];
671 line_data[x*3+2] = r_buff;
672 }
673 // write the line to the file
674 file.write(line_data, (image_width*3)+pad);
675 }
676 file.close();
677 return true;
678 }
679 else
680 {
681 SerialDebug.printf(" *** Cannot open file: %s\n", path);
682 }
683 return false;
684}
685#else
686
687#endif // M5_CAPTURE_SCREEN
688
689//!save the screen to a file on the SPIFF
691{
692#define SPIFF_SCREEN_FILE_NAME (char*)"/M5Screen.bmp"
693
694#ifdef M5_CAPTURE_SCREEN
695 boolean linesMax = M5Screen2bmp(SPIFFS, SPIFF_SCREEN_FILE_NAME);
696
697 listDir(SPIFFS, "/", 0);
698#endif
699}
700
701#else //**** PLACEHOLDERS so the callers don't need ifdef
702
703//!save the screen to a file on the SPIFF
705{
706
707}
708
709//!print a string to spiff (a new line is added)
710void println_SPIFFModule(char *string)
711{
712
713}
714
715//!print a string to spiff (NO new line is added)
716void print_SPIFFModule(char *string)
717{
718
719}
720
721//!print a int to spiff (NO new line is added)
722void printInt_SPIFFModule(int val)
723{
724
725}
726
727//! delete the spiff files..
729{
730
731}
732
733//! prints the spiff file to the SerialDebug output
735{
736
737}
738
739//! sends SPIFF module strings over MQTT, starting at the number back specified. This will use the current users MQTT credentials..
740void sendStrings_SPIFFModule(int numberOfLines)
741{
742
743}
744
745//! the setup for this module
747{
748
749}
750
751//! a loop if anything (nothing right now)
752void loop_SPIFFModule()
753{
754
755}
756
757//!prints a timestamp
759{
760
761}
762
763//! sends the Semantic Marker onto the SPIFF
764//! format- {'time':time, 'SM':'<sm>'}
765void printSM_SPIFFModule(char *semanticMarker)
766{
767
768}
769#endif // USE_SPIFF_MODULE
void publishBinaryFile(char *topic, uint8_t *buf, size_t len, String fileExtension)
void publishSPIFFFile_MQTT(char *topic, char *path, int len)
void sendMessageNoChangeMQTT(char *message)
just send a message but without any extras
int getTimeStamp_mainModule()
boolean getPreferenceBoolean_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
#define PREFERENCE_USE_SPIFF_SETTING
8.22.22 to turn on/off SPIFF use (more below..)
#define PREFERENCE_USE_SPIFF_QRATOM_SETTING
For MQTT writing to the QRATOM.
void loop_SPIFFModule()
a loop if anything (nothing right now)
void println_SPIFFModule(char *string)
The SPIFF module is for storing messages that are retrievable later as it stores on a folder area of ...
void printInt_SPIFFModule(int val)
print a int to spiff (NO new line is added)
#define SPIFF_FILE_NAME
Definition: SPIFFModule.cpp:6
void appendFile(fs::FS &fs, const char *path, const char *message)
appends the message to the file
void readFile(fs::FS &fs, const char *path)
reads the file name specified. The result is SerialDebug.write
Definition: SPIFFModule.cpp:64
int linesInFile_SPIFFModule(fs::FS &fs, const char *path)
reads the file name specified. returning the number of lines..
void deleteFile(fs::FS &fs, const char *path)
deletes the file specified
#define SPIFF_SCREEN_FILE_NAME
void sendStrings_SPIFFModule(int numberOfLines)
sends SPIFF module strings over MQTT, starting at the number back specified. This will use the curren...
void printTimestamp_SPIFFModule()
prints a timestamp time: <time> :
void renameFile(fs::FS &fs, const char *path1, const char *path2)
renames the file
void printFile_SPIFFModule()
prints the spiff file to the SerialDebug output
#define FORMAT_SPIFFS_IF_FAILED
Definition: SPIFFModule.cpp:16
void listDir(fs::FS &fs, const char *dirname, uint8_t levels)
list the directory of the SPIFF
Definition: SPIFFModule.cpp:26
void print_SPIFFModule(char *string)
print a string to spiff (NO new line is added)
int len_SPIFFFile(fs::FS &fs, const char *path)
calculate the length of the SPFF file
boolean useSpiff()
helper for using the spiff or not..
Definition: SPIFFModule.cpp:19
void deleteFiles_SPIFFModule()
delete the spiff files..
void writeFB_SPIFFModule(uint8_t *buf, size_t len, char *fileName)
writes a FB to a file..
void println_SPIFFModule_JSON(char *attribute, char *value)
4.4.24 output a line in JSON format adding timestamp as well
void printSM_SPIFFModule(char *semanticMarker)
void writeFile(fs::FS &fs, const char *path, const char *message)
writes the message to the file specified
Definition: SPIFFModule.cpp:86
void setup_SPIFFModule()
the setup for this module
void saveScreen_SPIFFModule()
save the screen to a file on the SPIFF
unsigned long millis()
Definition: TinyGPS.cpp:35
Definition: WebServer.h:66