@@ -99,7 +99,7 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
99
99
http_res = http_client->read (buffer, buf_len);
100
100
101
101
if (http_res < 0 ) {
102
- DEBUG_INFO ( " Download read error %d" , http_res);
102
+ DEBUG_VERBOSE ( " OTA ERROR: Download read error %d" , http_res);
103
103
res = OtaDownloadFail;
104
104
goto exit ;
105
105
}
@@ -114,16 +114,17 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
114
114
// validate CRC
115
115
context->calculatedCrc32 ^= 0xFFFFFFFF ; // finalize CRC
116
116
if (context->header .header .crc32 == context->calculatedCrc32 ) {
117
- DEBUG_INFO (" Ota download completed successfully" );
117
+ DEBUG_VERBOSE (" Ota download completed successfully" );
118
118
res = FlashOTA;
119
119
} else {
120
120
res = OtaHeaderCrcFail;
121
121
}
122
122
} else if (context->downloadState == OtaDownloadError) {
123
- DEBUG_VERBOSE (" OtaDownloadError" );
123
+ DEBUG_VERBOSE (" OTA ERROR: OtaDownloadError" );
124
124
125
125
res = OtaDownloadFail;
126
126
} else if (context->downloadState == OtaDownloadMagicNumberMismatch) {
127
+ DEBUG_VERBOSE (" OTA ERROR: Magic number mismatch" );
127
128
res = OtaHeaterMagicNumberFail;
128
129
}
129
130
@@ -158,7 +159,6 @@ void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t buf_len)
158
159
);
159
160
160
161
if (context->header .header .magic_number != OtaMagicNumber) {
161
- DEBUG_VERBOSE (" Magic number mismatch" );
162
162
context->downloadState = OtaDownloadMagicNumberMismatch;
163
163
return ;
164
164
}
@@ -178,7 +178,10 @@ void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t buf_len)
178
178
cursor += buf_len - (cursor-buffer);
179
179
context->downloadedSize += (cursor-buffer);
180
180
181
- DEBUG_VERBOSE (" Download %d/%d" , context->downloadedSize , http_client->contentLength ());
181
+ if (float (context->downloadedSize - context->prevDownloadedSize )/http_client->contentLength () > 0.05 ) {
182
+ DEBUG_VERBOSE (" Download %d/%d" , context->downloadedSize , http_client->contentLength ());
183
+ reportStatus (context->downloadedSize );
184
+ }
182
185
183
186
// TODO there should be no more bytes available when the download is completed
184
187
if (context->downloadedSize == http_client->contentLength ()) {
@@ -220,6 +223,7 @@ OTADefaultCloudProcessInterface::Context::Context(
220
223
, calculatedCrc32(0xFFFFFFFF )
221
224
, headerCopiedBytes(0 )
222
225
, downloadedSize(0 )
226
+ , prevDownloadedSize(0 )
223
227
, decoder(putc) { }
224
228
225
229
static const uint32_t crc_table[256 ] = {
0 commit comments