各位好。
有一个简单的 SPIFFS 管理程序,上传到 ESP32-WROOM 后导致反复启动, 确实也列出了 SPIFFS 文件,但是反复列出,其他程序没有这个问题,应该怎么办?
谢谢。
-
-
-
- #include "SPIFFS.h"
-
- void listAllFiles(){
-
- File root = SPIFFS.open("/");
-
- File file = root.openNextFile();
-
- while(file){
-
- Serial.print("FILE: ");
- Serial.println(file.name());
-
- file = root.openNextFile();
- }
-
- }
-
- void setup() {
-
- Serial.begin(115200);
-
- if (!SPIFFS.begin(true)) {
- Serial.println("An Error has occurred while mounting SPIFFS");
- return;
- }
-
- File file = SPIFFS.open("/test.txt", FILE_WRITE);
-
- if (!file) {
- Serial.println("There was an error opening the file for writing");
- return;
- }
-
- if (file.print("some content")) {
- Serial.println("File was written");
- } else {
- Serial.println("File write failed");
- }
-
- file.close();
-
- Serial.println("\n\n---BEFORE RENAMING---");
- listAllFiles();
-
- SPIFFS.rename("/test.txt", "/renamed.txt");
-
- Serial.println("\n\n---AFTER RENAMING---");
- listAllFiles();
-
- }
-
- void loop() {}
-
-
复制代码
ERROR:
- 12:49:57.010 -> ELF file SHA256: 0000000000000000
- 12:49:57.010 ->
- 12:49:57.010 -> Rebooting...
- 12:49:57.010 -> ets Jul 29 2019 12:21:46
- 12:49:57.010 ->
- 12:49:57.010 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
- 12:49:57.010 -> configsip: 0, SPIWP:0xee
- 12:49:57.010 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
- 12:49:57.010 -> mode:DIO, clock div:2
- 12:49:57.010 -> load:0x3fff0030,len:1344
- 12:49:57.010 -> load:0x40078000,len:13836
- 12:49:57.010 -> load:0x40080400,len:3608
- 12:49:57.010 -> entry 0x400805f0
- 12:49:57.247 -> File was written
- 12:49:57.247 ->
- 12:49:57.247 ->
- 12:49:57.247 -> ---BEFORE RENAMING---
- 12:49:57.315 -> FILE: hello.txt
- 12:49:57.349 -> FILE: renamed.txt
- 12:49:57.349 -> FILE: test.txt
- 12:49:57.383 ->
- 12:49:57.383 ->
- 12:49:57.383 -> ---AFTER RENAMING---
- 12:49:57.485 -> FILE: hello.txt
- 12:49:57.485 -> FILE: renamed.txt
- 12:49:57.485 -> FILE: test.txt
复制代码
|