File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -80,9 +80,19 @@ void URI::parse(const string& url_s)
8080
8181int rp2040_connect_onOTARequest (char const * ota_url)
8282{
83+ mbed_watchdog_reset ();
84+
8385 SFU::begin ();
8486
85- remove (" /ota/UPDATE.BIN.LZSS" );
87+ mbed_watchdog_reset ();
88+
89+ FILE * file = fopen (" /ota/UPDATE.BIN.LZSS" , " wb" );
90+ if (!file)
91+ {
92+ DEBUG_ERROR (" %s: fopen() failed" , __FUNCTION__);
93+ fclose (file);
94+ return static_cast <int >(OTAError::RP2040_ErrorOpenUpdateFile);
95+ }
8696
8797 mbed_watchdog_reset ();
8898
@@ -103,9 +113,9 @@ int rp2040_connect_onOTARequest(char const * ota_url)
103113
104114 mbed_watchdog_reset ();
105115
106- int ret = client->connect (url.host_ .c_str (), port);
107- if (!ret)
116+ if (!client->connect (url.host_ .c_str (), port))
108117 {
118+ fclose (file);
109119 DEBUG_ERROR (" %s: Connection failure with OTA storage server %s" , __FUNCTION__, url.host_ .c_str ());
110120 return static_cast <int >(OTAError::RP2040_ServerConnectError);
111121 }
@@ -119,14 +129,6 @@ int rp2040_connect_onOTARequest(char const * ota_url)
119129
120130 mbed_watchdog_reset ();
121131
122- FILE * file = fopen (" /ota/UPDATE.BIN.LZSS" , " wb" );
123- if (!file)
124- {
125- DEBUG_ERROR (" %s: fopen() failed" , __FUNCTION__);
126- fclose (file);
127- return static_cast <int >(OTAError::RP2040_ErrorOpenUpdateFile);
128- }
129-
130132 /* Receive HTTP header. */
131133 String http_header;
132134 bool is_header_complete = false ,
You can’t perform that action at this time.
0 commit comments