Skip to content

Commit bb6a70c

Browse files
committed
Storing update and temporary update file names within OTAStorage_SFU module in preparation for removing those parameters all together
1 parent 858cf33 commit bb6a70c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/utility/ota/OTAStorage_SFU.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626

2727
#include <Arduino_DebugUtils.h>
2828

29+
/******************************************************************************
30+
* CONSTANTS
31+
******************************************************************************/
32+
33+
static char const SFU_UPDATE_FILENAME[] = "UPDATE.BIN";
34+
static char const SFU_TEMP_UPDATE_FILENAME[] = "UPDATE.BIN.TMP";
35+
2936
/******************************************************************************
3037
* CTOR/DTOR
3138
******************************************************************************/
@@ -56,10 +63,10 @@ bool OTAStorage_SFU::init()
5663
return true;
5764
}
5865

59-
bool OTAStorage_SFU::open(char const * file_name)
66+
bool OTAStorage_SFU::open(char const * /* file_name */)
6067
{
6168
filesystem.clearerr();
62-
_file = new File(filesystem.open(file_name, CREATE | WRITE_ONLY| TRUNCATE));
69+
_file = new File(filesystem.open(SFU_TEMP_UPDATE_FILENAME, CREATE | WRITE_ONLY| TRUNCATE));
6370
if(SPIFFS_OK != filesystem.err()) {
6471
DBG_ERROR("OTAStorage_SFU::open - open() failed with error code %d", filesystem.err());
6572
delete _file;
@@ -79,14 +86,14 @@ void OTAStorage_SFU::close()
7986
delete _file;
8087
}
8188

82-
void OTAStorage_SFU::remove(char const * file_name)
89+
void OTAStorage_SFU::remove(char const * /* file_name */)
8390
{
84-
filesystem.remove(file_name);
91+
filesystem.remove(SFU_TEMP_UPDATE_FILENAME);
8592
}
8693

87-
bool OTAStorage_SFU::rename(char const * old_file_name, char const * new_file_name)
94+
bool OTAStorage_SFU::rename(char const * /* old_file_name */, char const * new_file_name)
8895
{
89-
return (SPIFFS_OK == filesystem.rename(old_file_name, new_file_name));
96+
return (SPIFFS_OK == filesystem.rename(SFU_TEMP_UPDATE_FILENAME, SFU_UPDATE_FILENAME));
9097
}
9198

9299
void OTAStorage_SFU::deinit()

0 commit comments

Comments
 (0)