Skip to content

Commit 167b3d3

Browse files
committed
IDFv4 logic for f.setBufferSize()
1 parent 77a463e commit 167b3d3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

wled00/file.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ static bool bufferedFind(const char *target, bool fromStart = true) {
6666

6767
size_t index = 0;
6868
byte buf[FS_BUFSIZE];
69+
#if ESP_IDF_VERSION_MAJOR >= 4
6970
f.setBufferSize(FS_BUFSIZE);
71+
#endif
7072
if (fromStart) f.seek(0);
7173

7274
while (f.position() < f.size() -1) {
@@ -108,7 +110,9 @@ static bool bufferedFindSpace(size_t targetLen, bool fromStart = true) {
108110

109111
size_t index = 0; // better to use size_t instead if uint16_t
110112
byte buf[FS_BUFSIZE];
113+
#if ESP_IDF_VERSION_MAJOR >= 4
111114
f.setBufferSize(FS_BUFSIZE);
115+
#endif
112116
if (fromStart) f.seek(0);
113117

114118
while (f.position() < f.size() -1) {
@@ -152,8 +156,9 @@ static bool bufferedFindObjectEnd() {
152156
uint16_t objDepth = 0; //num of '{' minus num of '}'. return once 0
153157
//size_t start = f.position();
154158
byte buf[FS_BUFSIZE];
159+
#if ESP_IDF_VERSION_MAJOR >= 4
155160
f.setBufferSize(FS_BUFSIZE);
156-
161+
#endif
157162
while (f.position() < f.size() -1) {
158163
size_t bufsize = f.read(buf, FS_BUFSIZE); // better to use size_t instead of uint16_t
159164
size_t count = 0;
@@ -178,7 +183,9 @@ static void writeSpace(size_t l)
178183
{
179184
byte buf[FS_BUFSIZE];
180185
memset(buf, ' ', FS_BUFSIZE);
186+
#if ESP_IDF_VERSION_MAJOR >= 4
181187
f.setBufferSize(FS_BUFSIZE);
188+
#endif
182189
while (l > 0) {
183190
size_t block = (l>FS_BUFSIZE) ? FS_BUFSIZE : l;
184191
f.write(buf, block);

0 commit comments

Comments
 (0)