26
26
27
27
#include < Arduino_DebugUtils.h>
28
28
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
+
29
36
/* *****************************************************************************
30
37
* CTOR/DTOR
31
38
******************************************************************************/
@@ -56,10 +63,10 @@ bool OTAStorage_SFU::init()
56
63
return true ;
57
64
}
58
65
59
- bool OTAStorage_SFU::open (char const * file_name )
66
+ bool OTAStorage_SFU::open ()
60
67
{
61
68
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));
63
70
if (SPIFFS_OK != filesystem.err ()) {
64
71
DBG_ERROR (" OTAStorage_SFU::open - open() failed with error code %d" , filesystem.err ());
65
72
delete _file;
@@ -79,14 +86,14 @@ void OTAStorage_SFU::close()
79
86
delete _file;
80
87
}
81
88
82
- void OTAStorage_SFU::remove (char const * file_name )
89
+ void OTAStorage_SFU::remove ()
83
90
{
84
- filesystem.remove (file_name );
91
+ filesystem.remove (SFU_TEMP_UPDATE_FILENAME );
85
92
}
86
93
87
- bool OTAStorage_SFU::rename (char const * old_file_name, char const * new_file_name )
94
+ bool OTAStorage_SFU::rename ()
88
95
{
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 ));
90
97
}
91
98
92
99
void OTAStorage_SFU::deinit ()
0 commit comments