Skip to content

Commit be33da1

Browse files
committed
Fix OTA multiple definition build error
1 parent b5d541f commit be33da1

File tree

3 files changed

+37
-30
lines changed

3 files changed

+37
-30
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Settings
2-
version=1.0.15
2+
version=1.0.16
33
author=AlexGyver <[email protected]>
44
maintainer=AlexGyver <[email protected]>
55
sentence=Simple UI webface builder for esp8266/esp32

src/core/ota.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "ota.h"
2+
3+
namespace sets {
4+
5+
bool beginOta(bool ota_flash, bool async) {
6+
size_t ota_size = 0;
7+
int ota_type = 0;
8+
9+
if (ota_flash) {
10+
ota_type = U_FLASH;
11+
#ifdef ESP8266
12+
ota_size = (size_t)((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000);
13+
#else
14+
ota_size = UPDATE_SIZE_UNKNOWN;
15+
#endif
16+
} else {
17+
#ifdef ESP8266
18+
ota_type = U_FS;
19+
close_all_fs();
20+
#ifndef GH_NO_FS
21+
ota_size = (size_t)&_FS_end - (size_t)&_FS_start;
22+
#endif
23+
#else
24+
ota_type = U_SPIFFS;
25+
ota_size = UPDATE_SIZE_UNKNOWN;
26+
#endif
27+
}
28+
29+
#ifdef ESP8266
30+
if (async) Update.runAsync(true);
31+
#endif
32+
return Update.begin(ota_size, ota_type);
33+
}
34+
35+
}

src/core/ota.h

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,6 @@
1212

1313
namespace sets {
1414

15-
bool beginOta(bool ota_flash = true, bool async = false) {
16-
size_t ota_size = 0;
17-
int ota_type = 0;
18-
19-
if (ota_flash) {
20-
ota_type = U_FLASH;
21-
#ifdef ESP8266
22-
ota_size = (size_t)((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000);
23-
#else
24-
ota_size = UPDATE_SIZE_UNKNOWN;
25-
#endif
26-
} else {
27-
#ifdef ESP8266
28-
ota_type = U_FS;
29-
close_all_fs();
30-
#ifndef GH_NO_FS
31-
ota_size = (size_t)&_FS_end - (size_t)&_FS_start;
32-
#endif
33-
#else
34-
ota_type = U_SPIFFS;
35-
ota_size = UPDATE_SIZE_UNKNOWN;
36-
#endif
37-
}
38-
39-
#ifdef ESP8266
40-
if (async) Update.runAsync(true);
41-
#endif
42-
return Update.begin(ota_size, ota_type);
43-
}
15+
bool beginOta(bool ota_flash = true, bool async = false);
4416

4517
} // namespace sets

0 commit comments

Comments
 (0)