2020 ******************************************************************************/
2121
2222#include < SFU.h>
23+ #include < BlockDevice.h>
24+ #include < MBRBlockDevice.h>
25+ #include < FATFileSystem.h>
2326#include < WiFiC3.h>
2427#include < Arduino_DebugUtils.h>
2528#include " arduino_secrets.h"
@@ -38,6 +41,10 @@ static char const OTA_FILE_LOCATION[] = "http://downloads.arduino.cc/ota/OTAUsag
3841#error "Board not supported"
3942#endif
4043
44+ BlockDevice* block_device = BlockDevice::get_default_instance();
45+ MBRBlockDevice mbr (block_device, 1 );
46+ FATFileSystem fs (" ota" );
47+
4148/* *****************************************************************************
4249 * SETUP/LOOP
4350 ******************************************************************************/
@@ -68,9 +75,24 @@ void setup()
6875 Serial.print (WiFi.SSID ());
6976 Serial.println (" '" );
7077
78+ int err = -1 ;
79+ /* Mount the filesystem. */
80+ if (err = fs.mount (&mbr) != 0 )
81+ {
82+ DEBUG_ERROR (" %s: fs.mount() failed with %d" , __FUNCTION__, err);
83+ return ;
84+ }
85+
7186 SFU::begin ();
7287
73- SFU::download (OTA_FILE_LOCATION);
88+ SFU::download (" /ota/UPDATE.BIN.OTA" , OTA_FILE_LOCATION);
89+
90+ /* Unmount the filesystem. */
91+ if ((err = fs.unmount ()) != 0 )
92+ {
93+ DEBUG_ERROR (" %s: fs.unmount() failed with %d" , __FUNCTION__, err);
94+ return ;
95+ }
7496
7597 SFU::apply ();
7698}
0 commit comments