@@ -91,7 +91,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
91
91
if ((err = flash.init ()) < 0 )
92
92
{
93
93
DEBUG_ERROR (" %s: flash.init() failed with %d" , __FUNCTION__, err);
94
- return err ;
94
+ return static_cast < int >(OTAError::RP2040_ErrorFlashInit) ;
95
95
}
96
96
97
97
mbed_watchdog_reset ();
@@ -104,7 +104,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
104
104
if ((err = fs.mount (&flash)) != 0 )
105
105
{
106
106
DEBUG_ERROR (" %s: fs.mount() failed with %d" , __FUNCTION__, err);
107
- return err ;
107
+ return static_cast < int >(OTAError::RP2040_ErrorMount) ;
108
108
}
109
109
110
110
mbed_watchdog_reset ();
@@ -231,9 +231,17 @@ int rp2040_connect_onOTARequest(char const * ota_url)
231
231
return static_cast <int >(OTAError::RP2040_HttpDataError);
232
232
}
233
233
234
- /* Perform the reset to reboot to SFU. */
235
234
DEBUG_INFO (" %s: %d bytes received" , __FUNCTION__, ftell (file));
236
235
fclose (file);
236
+
237
+ /* Unmount the filesystem. */
238
+ if ((err = fs.unmount ()) != 0 )
239
+ {
240
+ DEBUG_ERROR (" %s: fs.unmount() failed with %d" , __FUNCTION__, err);
241
+ return static_cast <int >(OTAError::RP2040_ErrorUnmount);
242
+ }
243
+
244
+ /* Perform the reset to reboot to SFU. */
237
245
mbed_watchdog_trigger_reset ();
238
246
239
247
return static_cast <int >(OTAError::None);
0 commit comments