Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Settings
version=1.0.15
version=1.0.16
author=AlexGyver <alex@alexgyver.ru>
maintainer=AlexGyver <alex@alexgyver.ru>
sentence=Simple UI webface builder for esp8266/esp32
Expand Down
35 changes: 35 additions & 0 deletions src/core/ota.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "ota.h"

namespace sets {

bool beginOta(bool ota_flash, bool async) {
size_t ota_size = 0;
int ota_type = 0;

if (ota_flash) {
ota_type = U_FLASH;
#ifdef ESP8266
ota_size = (size_t)((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000);
#else
ota_size = UPDATE_SIZE_UNKNOWN;
#endif
} else {
#ifdef ESP8266
ota_type = U_FS;
close_all_fs();
#ifndef GH_NO_FS
ota_size = (size_t)&_FS_end - (size_t)&_FS_start;
#endif
#else
ota_type = U_SPIFFS;
ota_size = UPDATE_SIZE_UNKNOWN;
#endif
}

#ifdef ESP8266
if (async) Update.runAsync(true);
#endif
return Update.begin(ota_size, ota_type);
}

}
30 changes: 1 addition & 29 deletions src/core/ota.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,6 @@

namespace sets {

bool beginOta(bool ota_flash = true, bool async = false) {
size_t ota_size = 0;
int ota_type = 0;

if (ota_flash) {
ota_type = U_FLASH;
#ifdef ESP8266
ota_size = (size_t)((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000);
#else
ota_size = UPDATE_SIZE_UNKNOWN;
#endif
} else {
#ifdef ESP8266
ota_type = U_FS;
close_all_fs();
#ifndef GH_NO_FS
ota_size = (size_t)&_FS_end - (size_t)&_FS_start;
#endif
#else
ota_type = U_SPIFFS;
ota_size = UPDATE_SIZE_UNKNOWN;
#endif
}

#ifdef ESP8266
if (async) Update.runAsync(true);
#endif
return Update.begin(ota_size, ota_type);
}
bool beginOta(bool ota_flash = true, bool async = false);

} // namespace sets