diff --git a/.github/workflows/arduino_ci.yml b/.github/workflows/arduino_ci.yml index c2419acc..7a88d270 100644 --- a/.github/workflows/arduino_ci.yml +++ b/.github/workflows/arduino_ci.yml @@ -94,7 +94,7 @@ jobs: - examples/peripheral/PMU_ADC/PMU_ADC.ino - examples/peripheral/PMU_Interrupt/PMU_Interrupt.ino - examples/peripheral/PlayMusicFromPROGMEM/PlayMusicFromPROGMEM.ino - - examples/peripheral/PlayMusicFromSPIFFS/PlayMusicFromSPIFFS.ino + - examples/peripheral/PlayMusicFromFATFS/PlayMusicFromFATFS.ino - examples/peripheral/RTC_AlarmByUnits/RTC_AlarmByUnits.ino - examples/peripheral/RTC_TimeLib/RTC_TimeLib.ino - examples/peripheral/RTC_TimeSynchronization/RTC_TimeSynchronization.ino diff --git a/.github/workflows/platformio.yml b/.github/workflows/platformio.yml index 54eeb535..85a6945f 100644 --- a/.github/workflows/platformio.yml +++ b/.github/workflows/platformio.yml @@ -95,7 +95,7 @@ jobs: - examples/peripheral/PMU_ADC - examples/peripheral/PMU_Interrupt - examples/peripheral/PlayMusicFromPROGMEM - - examples/peripheral/PlayMusicFromSPIFFS + - examples/peripheral/PlayMusicFromFATFS - examples/peripheral/RTC_AlarmByUnits - examples/peripheral/RTC_TimeLib - examples/peripheral/RTC_TimeSynchronization diff --git a/examples/demo/LilyGoGui/LilyGoGui.ino b/examples/demo/LilyGoGui/LilyGoGui.ino index d97499ad..46bf6ede 100644 --- a/examples/demo/LilyGoGui/LilyGoGui.ino +++ b/examples/demo/LilyGoGui/LilyGoGui.ino @@ -39,7 +39,7 @@ IRsend irsend(BOARD_IR_PIN); #include #include #include -#include +#include #include #include #include @@ -61,7 +61,7 @@ SX1280 radio = newModule(); extern const unsigned char mp3_array[16509]; extern unsigned char mp3_ring_setup[86144]; -AudioFileSourceSPIFFS *file_fs; +AudioFileSourceFATFS *file_fs; AudioGeneratorWAV *wav = NULL; AudioFileSourcePROGMEM *file = NULL; AudioOutputI2S *out = NULL; @@ -933,7 +933,7 @@ void wav_task(void *param) // if (!audio->isRunning()) { mp3->stop(); suspend_playMP3Handler(); - //mp3->connecttoFS(SPIFFS, "/ring_1.mp3"); + //mp3->connecttoFS(FFat, "/ring_1.mp3"); // Serial.println("play \"/ring_1.mp3\""); is_pause = false; // } @@ -1279,7 +1279,7 @@ void settingPlayer() mp3 = new AudioGeneratorMP3(); mp3->begin(id3, out); - file_fs = new AudioFileSourceSPIFFS(); + file_fs = new AudioFileSourceFATFS(); wav = new AudioGeneratorWAV(); player_task_cb = playMP3; @@ -1317,7 +1317,7 @@ static bool CreateWAV(const char *song_name, uint32_t duration, uint16_t num_cha // data size in bytes - > this amount of data should be recorded from microphone later uint32_t data_size = sampling_rate * num_channels * bits_per_sample * duration / 8; - File new_audio_file = SPIFFS.open(song_name, FILE_WRITE); + File new_audio_file = FFat.open(song_name, FILE_WRITE); if (!new_audio_file) { Serial.println("Failed to create file"); return false; @@ -1603,7 +1603,7 @@ static void PDM_Record(const char *song_name, uint32_t duration) } // Open created .wav file in append+binary mode to add PCM data - File audio_file = SPIFFS.open(song_name, FILE_APPEND); + File audio_file = FFat.open(song_name, FILE_APPEND); if (!audio_file) { Serial.println("Failed to create file"); return; @@ -1640,7 +1640,7 @@ static void PDM_Record(const char *song_name, uint32_t duration) if (bytes_written != BUFFER_SIZE) { Serial.println("Bytes written error"); } - // Save data to SPIFFS + // Save data to FFat audio_file.write( buf, BUFFER_SIZE); // Increment the counter counter += BUFFER_SIZE; diff --git a/examples/demo/factory/factory.ino b/examples/demo/factory/factory.ino index 906dd2cc..f99332f1 100644 --- a/examples/demo/factory/factory.ino +++ b/examples/demo/factory/factory.ino @@ -4,19 +4,29 @@ * @license MIT * @copyright Copyright (c) 2023 Shenzhen Xinyuan Electronic Technology Co., Ltd * @date 2023-04-05 - * @note Arduino Setting + * @note Arduino esp version 2.0.9 Setting , not support esp 3.x * Tools -> * Board:"ESP32S3 Dev Module" * USB CDC On Boot:"Enable" - * USB DFU On Boot:"Disable" - * Flash Size : "16MB(128Mb)" - * Flash Mode"QIO 80MHz - * Partition Scheme:"16M Flash(3M APP/9.9MB FATFS)" - * PSRAM:"OPI PSRAM" - * Upload Mode:"UART0/Hardware CDC" - * USB Mode:"Hardware CDC and JTAG" + * CPU Frequency: "240MHz (WiFi)" + * Core Debug Level: "Verbose" + * USB DFU On Boot: "Disabled" + * Erase All Flash Before Sketch Upload: "Disabled" + * Events Run On: "Core 1" + * Flash Mode: "QI0 80MHz" + * Flash Size: "16MB (128Mb)" + * JTAG Adapter: "Disabled" + * Arduino Runs On: "Core 1" + * USB Firmware MSC On Boot: "Disabled" + * Partition Scheme: "16M Flash (3MB APP/9.9MB FATFS)" + * PSRAM: "OPI PSRAM" + * Upload Mode: "UART0/Hardware CDC" + * Upload Speed: "921600" + * USB Mode: "Hardware CDC and JTAG" + * Programmer: "Esptool" */ + //! Two transceivers, SX1262 and SX1280, are defined based on the actual model // #define USE_RADIO_SX1280 #define USE_RADIO_SX1262 @@ -49,14 +59,14 @@ IRsend irsend(BOARD_IR_PIN); #include #include #include -#include +#include AudioGeneratorMP3 *mp3; AudioFileSourcePROGMEM *file; AudioOutputI2S *out; AudioFileSourceID3 *id3; AudioGeneratorWAV *wav; -AudioFileSourceSPIFFS *file_fs; +AudioFileSourceFATFS *file_fs; extern const uint8_t boot_music[4365]; #endif @@ -452,7 +462,13 @@ static void charge_anim_cb(void *obj, int32_t v) if (last_check_inteval < millis()) { battery_percent = watch.getBatteryPercent(); lv_obj_t *label_percent = (lv_obj_t *)lv_obj_get_user_data(arc); - lv_label_set_text_fmt(label_percent, "%d%%", battery_percent); + if (battery_percent != - 1) { + lv_label_set_text_fmt(label_percent, "%d%%", battery_percent); + } else { + lv_label_set_long_mode(label_percent,LV_LABEL_LONG_WRAP); + lv_obj_set_width(label_percent,lv_pct(90)); + lv_label_set_text(label_percent, "Please turn the battery switch to ON"); + } if (battery_percent == 100) { lv_obj_t *img = (lv_obj_t *)lv_obj_get_user_data(label_percent); lv_anim_del(arc, charge_anim_cb); @@ -2533,7 +2549,7 @@ void settingPlayer() mp3 = new AudioGeneratorMP3(); mp3->begin(id3, out); - file_fs = new AudioFileSourceSPIFFS(); + file_fs = new AudioFileSourceFATFS(); wav = new AudioGeneratorWAV(); player_task_cb = playMP3; @@ -2574,7 +2590,7 @@ static bool CreateWAV(const char *song_name, uint32_t duration, uint16_t num_cha // data size in bytes - > this amount of data should be recorded from microphone later uint32_t data_size = sampling_rate * num_channels * bits_per_sample * duration / 8; - File new_audio_file = SPIFFS.open(song_name, FILE_WRITE); + File new_audio_file = FFat.open(song_name, FILE_WRITE); if (!new_audio_file) { Serial.println("Failed to create file"); return false; @@ -2677,7 +2693,7 @@ static void PDM_Record(const char *song_name, uint32_t duration) } // Open created .wav file in append+binary mode to add PCM data - File audio_file = SPIFFS.open(song_name, FILE_APPEND); + File audio_file = FFat.open(song_name, FILE_APPEND); if (!audio_file) { Serial.println("Failed to create file"); return; @@ -2716,7 +2732,7 @@ static void PDM_Record(const char *song_name, uint32_t duration) Serial.println("Bytes written error"); } - // Save data to SPIFFS + // Save data to FFat audio_file.write( buf, BUFFER_SIZE); // Increment the counter diff --git a/examples/lvgl/third_party/ImageDecoder/ImageDecoder.ino b/examples/lvgl/third_party/ImageDecoder/ImageDecoder.ino index 6e8c00dd..88179749 100644 --- a/examples/lvgl/third_party/ImageDecoder/ImageDecoder.ino +++ b/examples/lvgl/third_party/ImageDecoder/ImageDecoder.ino @@ -4,7 +4,7 @@ * @license MIT * @copyright Copyright (c) 2023 Shenzhen Xinyuan Electronic Technology Co., Ltd * @date 2023-05-01 - * @Note You need to upload the files from the data file to the SPIFFS + * @Note You need to upload the files from the data file to the FFat * file system before using this example * @note platfromio user use , * * Note that you need to place the sample data folder in the same level directory as @@ -31,9 +31,9 @@ void setup(void) beginLvglHelper(); String file = String("/") + filename[0]; - if (!SPIFFS.exists(file)) { + if (!FFat.exists(file)) { while (1) { - Serial.println("You need to upload the files from the data file to the SPIFFS file system before using this example"); + Serial.println("You need to upload the files from the data file to the FFat file system before using this example"); delay(1000); } } diff --git a/examples/peripheral/PDM_Recording/PDM_Recording.ino b/examples/peripheral/PDM_Recording/PDM_Recording.ino index 5db09a95..30e1074c 100644 --- a/examples/peripheral/PDM_Recording/PDM_Recording.ino +++ b/examples/peripheral/PDM_Recording/PDM_Recording.ino @@ -11,13 +11,13 @@ #include #include -#include +#include #include "AudioGeneratorWAV.h" #include "AudioFileSourceFunction.h" AudioGeneratorWAV *wav; -AudioFileSourceSPIFFS *file; +AudioFileSourceFATFS *file; AudioOutputI2S *out; void microphone_record(const char *song_name, uint32_t duration); @@ -43,7 +43,7 @@ void setup(void) out = new AudioOutputI2S(1, AudioOutputI2S::EXTERNAL_I2S); out->SetPinout(BOARD_DAC_IIS_BCK, BOARD_DAC_IIS_WS, BOARD_DAC_IIS_DOUT); - file = new AudioFileSourceSPIFFS("/rec.wav"); + file = new AudioFileSourceFATFS("/rec.wav"); wav = new AudioGeneratorWAV(); wav->begin(file, out); @@ -73,7 +73,7 @@ bool create_wav_file(const char *song_name, uint32_t duration, uint16_t num_chan // data size in bytes - > this amount of data should be recorded from microphone later uint32_t data_size = sampling_rate * num_channels * bits_per_sample * duration / 8; - File new_audio_file = SPIFFS.open(song_name, FILE_WRITE); + File new_audio_file = FFat.open(song_name, FILE_WRITE); if (new_audio_file == NULL) { Serial.println("Failed to create file"); return false; @@ -148,7 +148,7 @@ void microphone_record(const char *song_name, uint32_t duration) } // Open created .wav file in append+binary mode to add PCM data - File audio_file = SPIFFS.open(song_name, FILE_APPEND); + File audio_file = FFat.open(song_name, FILE_APPEND); if (!audio_file) { Serial.println("Failed to create file"); return; diff --git a/examples/peripheral/PlayMusicFromSPIFFS/PlayMusicFromSPIFFS.ino b/examples/peripheral/PlayMusicFromFATFS/PlayMusicFromFATFS.ino similarity index 95% rename from examples/peripheral/PlayMusicFromSPIFFS/PlayMusicFromSPIFFS.ino rename to examples/peripheral/PlayMusicFromFATFS/PlayMusicFromFATFS.ino index ca7de080..a1583f23 100644 --- a/examples/peripheral/PlayMusicFromSPIFFS/PlayMusicFromSPIFFS.ino +++ b/examples/peripheral/PlayMusicFromFATFS/PlayMusicFromFATFS.ino @@ -1,5 +1,5 @@ /** - * @file PlayMusicFromSPIFFS.ino + * @file PlayMusicFromFATFS.ino * @author Lewis He (lewishe@outlook.com) * @license MIT * @copyright Copyright (c) 2023 Shenzhen Xinyuan Electronic Technology Co., Ltd @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -23,7 +23,7 @@ const uint8_t i2sPort = 1; AudioGeneratorWAV *wav = NULL; -AudioFileSourceSPIFFS *file = NULL; +AudioFileSourceFATFS *file = NULL; AudioOutputI2S *out = NULL; AudioGeneratorMP3 *mp3 = NULL; AudioFileSourceID3 *id3 = NULL; @@ -157,7 +157,7 @@ void setup(void) Serial.begin(115200); // When initializing the watch, - // SPIFFS has already been initialized internally + // FFat has already been initialized internally watch.begin(); beginLvglHelper(); @@ -172,7 +172,7 @@ void setup(void) lv_obj_t *label; label = lv_label_create(cont); - lv_label_set_text(label, "PlayMusicFromSPIFFS"); + lv_label_set_text(label, "PlayMusicFromFFat"); //Play wav Button lv_obj_t *btn1 = lv_btn_create(cont); @@ -210,7 +210,7 @@ void setup(void) lv_label_set_text(label, "Play AAC"); lv_obj_center(label); - file = new AudioFileSourceSPIFFS(); + file = new AudioFileSourceFATFS(); // Set up the use of an external decoder out = new AudioOutputI2S(i2sPort, AudioOutputI2S::EXTERNAL_I2S); diff --git a/platformio.ini b/platformio.ini index c33e0a73..18cca45e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,7 +23,7 @@ ; src_dir = examples/peripheral/PMU_ADC ; src_dir = examples/peripheral/PMU_Interrupt ; src_dir = examples/peripheral/PlayMusicFromPROGMEM -; src_dir = examples/peripheral/PlayMusicFromSPIFFS +; src_dir = examples/peripheral/PlayMusicFromFATFS ; src_dir = examples/peripheral/GPSFullExample ; src_dir = examples/peripheral/GPSFactory @@ -153,8 +153,8 @@ boards_dir = ./board/LilyGoWatch-S3 lib_extra_dirs = . upload_speed = 921600 monitor_speed = 115200 -board_build.filesystem = spiffs -board_build.partitions = default_16MB.csv +board_build.filesystem = fatfs +board_build.partitions = app3M_fat9M_16MB.csv [env:twatch-s3] platform = espressif32@6.3.0 diff --git a/src/LilyGoLib.cpp b/src/LilyGoLib.cpp index 79b692d9..f9f95f10 100644 --- a/src/LilyGoLib.cpp +++ b/src/LilyGoLib.cpp @@ -117,14 +117,14 @@ bool LilyGoLib::begin(Stream *stream) setTextFont(2); fillScreen(TFT_BLACK); - log_println("Init SPIFFS"); - if (!SPIFFS.begin()) { + log_println("Init FFat"); + if (!FFat.begin()) { if (bootDisplay) { setBrightness(50); - drawString("Format SPIFFS...", 120, 120); + drawString("Format FFat...", 120, 120); } - SPIFFS.format(); + FFat.format(); } if (bootDisplay) { diff --git a/src/LilyGoLib.h b/src/LilyGoLib.h index 902e0d7c..29c09e92 100644 --- a/src/LilyGoLib.h +++ b/src/LilyGoLib.h @@ -16,7 +16,7 @@ #error "Please manually update and install Arduino Core ESP32 to the latest version, how to update, please see here https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#windows-manual-installation" #endif -#include +#include #include #include #include diff --git a/src/lv_conf.h b/src/lv_conf.h index 15e267ad..c1165a07 100644 --- a/src/lv_conf.h +++ b/src/lv_conf.h @@ -612,7 +612,7 @@ e.g. "stm32f7xx.h" or "stm32f4xx.h"*/ #define LV_USE_FS_POSIX 1 #if LV_USE_FS_POSIX #define LV_FS_POSIX_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ -#define LV_FS_POSIX_PATH "/spiffs" /*Set the working directory. File/directory paths will be appended to it.*/ +#define LV_FS_POSIX_PATH "/ffat" /*Set the working directory. File/directory paths will be appended to it.*/ #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif