File tree 1 file changed +13
-11
lines changed 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)
80
80
81
81
int rp2040_connect_onOTARequest (char const * ota_url)
82
82
{
83
+ mbed_watchdog_reset ();
84
+
83
85
SFU::begin ();
84
86
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
+ }
86
96
87
97
mbed_watchdog_reset ();
88
98
@@ -103,9 +113,9 @@ int rp2040_connect_onOTARequest(char const * ota_url)
103
113
104
114
mbed_watchdog_reset ();
105
115
106
- int ret = client->connect (url.host_ .c_str (), port);
107
- if (!ret)
116
+ if (!client->connect (url.host_ .c_str (), port))
108
117
{
118
+ fclose (file);
109
119
DEBUG_ERROR (" %s: Connection failure with OTA storage server %s" , __FUNCTION__, url.host_ .c_str ());
110
120
return static_cast <int >(OTAError::RP2040_ServerConnectError);
111
121
}
@@ -119,14 +129,6 @@ int rp2040_connect_onOTARequest(char const * ota_url)
119
129
120
130
mbed_watchdog_reset ();
121
131
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
-
130
132
/* Receive HTTP header. */
131
133
String http_header;
132
134
bool is_header_complete = false ,
You can’t perform that action at this time.
0 commit comments