File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,9 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::startOTA() {
35
35
context = new Context (
36
36
OTACloudProcessInterface::context->url ,
37
37
[this ](uint8_t c) {
38
- // int res =
39
- this ->writeFlash (&c, 1 );
40
-
41
- // TODO report error in write flash, throw it?
38
+ if (this ->writeFlash (&c, 1 ) != 1 ) {
39
+ this ->context ->writeError = true ;
40
+ }
42
41
}
43
42
);
44
43
@@ -107,6 +106,12 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
107
106
}
108
107
109
108
parseOta (context->buffer , http_res);
109
+
110
+ if (context->writeError ) {
111
+ DEBUG_VERBOSE (" OTA ERROR: File write error" );
112
+ res = ErrorWriteUpdateFileFail;
113
+ goto exit ;
114
+ }
110
115
} while ((context->downloadState == OtaDownloadFile || context->downloadState == OtaDownloadHeader) &&
111
116
millis () - start < downloadTime);
112
117
@@ -234,6 +239,7 @@ OTADefaultCloudProcessInterface::Context::Context(
234
239
, headerCopiedBytes(0 )
235
240
, downloadedSize(0 )
236
241
, lastReportTime(0 )
242
+ , writeError(false )
237
243
, decoder(putc) { }
238
244
239
245
static const uint32_t crc_table[256 ] = {
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ class OTADefaultCloudProcessInterface: public OTACloudProcessInterface {
74
74
uint32_t headerCopiedBytes;
75
75
uint32_t downloadedSize;
76
76
uint32_t lastReportTime;
77
+ bool writeError;
77
78
78
79
// LZSS decoder
79
80
LZSSDecoder decoder;
You can’t perform that action at this time.
0 commit comments