mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 03:04:25 +01:00
To be able to store more images and never worry about running out of storage again we are adding support of SDCards. We are faced with two options: 1) Remove the LittleFS code 2) Allow for both FSs but increase the app partition as we run out of space. We have opted for 2 for two reasons: 1) Unformated SDCards can be initialized from the littleFS 2) If the SDCard and the flasher share the same SPI pins the SDCard needs to be completely disconnected so there needs to be a FS in that rare case. Performance wise the SDCard is not slowing the system down. Writing the AP db with 70 APs takes 2.5 seconds, on the SD only 800ms. This however is SD and setup depending. By default the SDCard is expected on pins 18,19,23 however this is configurable via preprocessor defines. Globally we replace LittleFS with a new pointer to the currently used FS allowing for hotswapping where the FS pointer is not saved. One case which is therefore not working is the SPIFSEditor which copies the FS interally. Signed-off-by: Mimoja <git@mimoja.de>
37 lines
487 B
C++
37 lines
487 B
C++
#ifndef _DYN_STORAGE_H_
|
|
#define _DYN_STORAGE_H_
|
|
|
|
#include "FS.h"
|
|
|
|
#ifdef HAS_SDCARD
|
|
#ifndef SD_CARD_SS
|
|
#error SD_CARD_SS UNDEFINED
|
|
#endif
|
|
|
|
#ifndef SD_CARD_CLK
|
|
#define SD_CARD_CLK 18
|
|
#endif
|
|
|
|
#ifndef SD_CARD_MISO
|
|
#define SD_CARD_MISO 19
|
|
#endif
|
|
|
|
#ifndef SD_CARD_MOSI
|
|
#define SD_CARD_MOSI 23
|
|
#endif
|
|
#endif
|
|
|
|
class DynStorage {
|
|
public:
|
|
DynStorage();
|
|
void begin();
|
|
void listFiles();
|
|
|
|
private:
|
|
bool isInited;
|
|
};
|
|
|
|
extern DynStorage Storage;
|
|
extern fs::FS *contentFS;
|
|
|
|
#endif |