Skip to content

Commit 79480e2

Browse files
committed
OTA: TEMP debug prints
1 parent 53d7c4c commit 79480e2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/ota/implementation/OTASTM32H7.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ OTACloudProcessInterface::State STM32H7OTACloudProcess::startOTA() {
5858
}
5959

6060
// this could be useless, since we are writing over it
61-
remove(_filename.c_str());
61+
if (remove(_filename.c_str()) != 0) {
62+
DEBUG_VERBOSE("STM32H7OTA::%s remove error", __FUNCTION__);
63+
}
6264

6365
decompressed = fopen(_filename.c_str(), "wb");
6466

src/ota/interface/OTAInterfaceDefault.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
122122
} while((context->downloadState == OtaDownloadFile || context->downloadState == OtaDownloadHeader) &&
123123
millis() - start < downloadTime);
124124

125+
DEBUG_VERBOSE("fetch time %d/%d", millis() - start, downloadTime);
126+
DEBUG_VERBOSE("OTA fetch %d/%d", context->downloadedSize, http_client->contentLength());
127+
125128
// TODO verify that the information present in the ota header match the info in context
126129
if(context->downloadState == OtaDownloadCompleted) {
127130
// Verify that the downloaded file size is matching the expected size ??
@@ -193,10 +196,9 @@ void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t buf_len)
193196

194197
cursor += buf_len - (cursor-buffer);
195198
context->downloadedSize += (cursor-buffer);
199+
DEBUG_VERBOSE("OTA Download Progress %d/%d", context->downloadedSize, http_client->contentLength());
196200

197201
if((millis() - context->lastReportTime) > 10000) { // Report the download progress each X millisecond
198-
DEBUG_VERBOSE("OTA Download Progress %d/%d", context->downloadedSize, http_client->contentLength());
199-
200202
reportStatus(context->downloadedSize);
201203
context->lastReportTime = millis();
202204
}

0 commit comments

Comments
 (0)