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
9299void OTAStorage_SFU::deinit ()
0 commit comments