44
44
45
45
enum class rp2040OTAError : int
46
46
{
47
- None = 0 ,
48
- ErrorFlashInit = RP2040_OTA_ERROR_BASE - 3 ,
49
- ErrorParseHttpHeader = RP2040_OTA_ERROR_BASE - 8 ,
50
- UrlParseError = RP2040_OTA_ERROR_BASE - 9 ,
51
- ServerConnectError = RP2040_OTA_ERROR_BASE - 10 ,
52
- HttpHeaderError = RP2040_OTA_ERROR_BASE - 11 ,
53
- HttpDataError = RP2040_OTA_ERROR_BASE - 12 ,
54
- ErrorOpenUpdateFile = RP2040_OTA_ERROR_BASE - 19 ,
55
- ErrorWriteUpdateFile = RP2040_OTA_ERROR_BASE - 20 ,
56
- ErrorReformat = RP2040_OTA_ERROR_BASE - 21 ,
57
- ErrorUnmount = RP2040_OTA_ERROR_BASE - 22 ,
47
+ None = 0 ,
48
+ OtaStorageInit = RP2040_OTA_ERROR_BASE - 3 ,
49
+ ParseHttpHeader = RP2040_OTA_ERROR_BASE - 8 ,
50
+ UrlParse = RP2040_OTA_ERROR_BASE - 9 ,
51
+ ServerConnect = RP2040_OTA_ERROR_BASE - 10 ,
52
+ HttpHeader = RP2040_OTA_ERROR_BASE - 11 ,
53
+ HttpData = RP2040_OTA_ERROR_BASE - 12 ,
54
+ OpenUpdateFile = RP2040_OTA_ERROR_BASE - 19 ,
55
+ WriteUpdateFile = RP2040_OTA_ERROR_BASE - 20 ,
56
+ Reformat = RP2040_OTA_ERROR_BASE - 21 ,
57
+ Unmount = RP2040_OTA_ERROR_BASE - 22 ,
58
58
};
59
59
60
60
/* *****************************************************************************
@@ -115,7 +115,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
115
115
if ((err = flash.init ()) < 0 )
116
116
{
117
117
DEBUG_ERROR (" %s: flash.init() failed with %d" , __FUNCTION__, err);
118
- return static_cast <int >(rp2040OTAError::ErrorFlashInit );
118
+ return static_cast <int >(rp2040OTAError::OtaStorageInit );
119
119
}
120
120
121
121
watchdog_reset ();
@@ -128,7 +128,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
128
128
if ((err = fs.reformat (&flash)) != 0 )
129
129
{
130
130
DEBUG_ERROR (" %s: fs.reformat() failed with %d" , __FUNCTION__, err);
131
- return static_cast <int >(rp2040OTAError::ErrorReformat );
131
+ return static_cast <int >(rp2040OTAError::Reformat );
132
132
}
133
133
134
134
watchdog_reset ();
@@ -138,7 +138,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
138
138
{
139
139
DEBUG_ERROR (" %s: fopen() failed" , __FUNCTION__);
140
140
fclose (file);
141
- return static_cast <int >(rp2040OTAError::ErrorOpenUpdateFile );
141
+ return static_cast <int >(rp2040OTAError::OpenUpdateFile );
142
142
}
143
143
144
144
watchdog_reset ();
@@ -156,7 +156,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
156
156
} else {
157
157
DEBUG_ERROR (" %s: Failed to parse OTA URL %s" , __FUNCTION__, ota_url);
158
158
fclose (file);
159
- return static_cast <int >(rp2040OTAError::UrlParseError );
159
+ return static_cast <int >(rp2040OTAError::UrlParse );
160
160
}
161
161
162
162
watchdog_reset ();
@@ -165,7 +165,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
165
165
{
166
166
DEBUG_ERROR (" %s: Connection failure with OTA storage server %s" , __FUNCTION__, url.host_ .c_str ());
167
167
fclose (file);
168
- return static_cast <int >(rp2040OTAError::ServerConnectError );
168
+ return static_cast <int >(rp2040OTAError::ServerConnect );
169
169
}
170
170
171
171
watchdog_reset ();
@@ -202,7 +202,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
202
202
{
203
203
DEBUG_ERROR (" %s: Error receiving HTTP header %s" , __FUNCTION__, is_http_header_timeout ? " (timeout)" :" " );
204
204
fclose (file);
205
- return static_cast <int >(rp2040OTAError::HttpHeaderError );
205
+ return static_cast <int >(rp2040OTAError::HttpHeader );
206
206
}
207
207
208
208
/* Extract concent length from HTTP header. A typical entry looks like
@@ -213,7 +213,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
213
213
{
214
214
DEBUG_ERROR (" %s: Failure to extract content length from http header" , __FUNCTION__);
215
215
fclose (file);
216
- return static_cast <int >(rp2040OTAError::ErrorParseHttpHeader );
216
+ return static_cast <int >(rp2040OTAError::ParseHttpHeader );
217
217
}
218
218
/* Find start of numerical value. */
219
219
char * ptr = const_cast <char *>(content_length_ptr);
@@ -242,7 +242,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
242
242
{
243
243
DEBUG_ERROR (" %s: Writing of firmware image to flash failed" , __FUNCTION__);
244
244
fclose (file);
245
- return static_cast <int >(rp2040OTAError::ErrorWriteUpdateFile );
245
+ return static_cast <int >(rp2040OTAError::WriteUpdateFile );
246
246
}
247
247
248
248
bytes_received++;
@@ -252,7 +252,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
252
252
if (bytes_received != content_length_val) {
253
253
DEBUG_ERROR (" %s: Error receiving HTTP data %s (%d bytes received, %d expected)" , __FUNCTION__, is_http_data_timeout ? " (timeout)" :" " , bytes_received, content_length_val);
254
254
fclose (file);
255
- return static_cast <int >(rp2040OTAError::HttpDataError );
255
+ return static_cast <int >(rp2040OTAError::HttpData );
256
256
}
257
257
258
258
DEBUG_INFO (" %s: %d bytes received" , __FUNCTION__, ftell (file));
@@ -262,7 +262,7 @@ int rp2040_connect_onOTARequest(char const * ota_url)
262
262
if ((err = fs.unmount ()) != 0 )
263
263
{
264
264
DEBUG_ERROR (" %s: fs.unmount() failed with %d" , __FUNCTION__, err);
265
- return static_cast <int >(rp2040OTAError::ErrorUnmount );
265
+ return static_cast <int >(rp2040OTAError::Unmount );
266
266
}
267
267
268
268
/* Perform the reset to reboot to SFU. */
0 commit comments