@@ -124,7 +124,9 @@ void OTALogic::onOTADataReceived(uint8_t const * const data, size_t const length
124124
125125OTAState OTALogic::handle_Init ()
126126{
127+ #ifndef HOST
127128 DBG_VERBOSE (__PRETTY_FUNCTION__);
129+ #endif
128130 if (_ota_storage->init ()) {
129131 return OTAState::Idle;
130132 } else {
@@ -143,7 +145,9 @@ OTAState OTALogic::handle_Idle()
143145
144146OTAState OTALogic::handle_StartDownload ()
145147{
148+ #ifndef HOST
146149 DBG_VERBOSE (__PRETTY_FUNCTION__);
150+ #endif
147151 if (_ota_storage->open ()) {
148152 return OTAState::WaitForHeader;
149153 } else {
@@ -154,7 +158,9 @@ OTAState OTALogic::handle_StartDownload()
154158
155159OTAState OTALogic::handle_WaitForHeader ()
156160{
161+ #ifndef HOST
157162 DBG_VERBOSE (__PRETTY_FUNCTION__);
163+ #endif
158164 if (_mqtt_ota_buf.num_bytes >= OTA_BINARY_HEADER_SIZE) {
159165 return OTAState::HeaderReceived;
160166 }
@@ -163,7 +169,6 @@ OTAState OTALogic::handle_WaitForHeader()
163169
164170OTAState OTALogic::handle_HeaderReceived ()
165171{
166- DBG_VERBOSE (__PRETTY_FUNCTION__);
167172 /* The OTA header has been received, let's extract it
168173 * from the MQTT OTA receive buffer.
169174 */
@@ -184,8 +189,10 @@ OTAState OTALogic::handle_HeaderReceived()
184189 _ota_bin_data.hdr_len = ota_header.header .len ;
185190 _ota_bin_data.hdr_crc32 = ota_header.header .crc32 ;
186191
192+ #ifndef HOST
187193 DBG_VERBOSE (" %s: header length = %d" , __PRETTY_FUNCTION__, _ota_bin_data.hdr_len );
188194 DBG_VERBOSE (" %s: header CRC32 = %d" , __PRETTY_FUNCTION__, _ota_bin_data.hdr_crc32 );
195+ #endif
189196
190197 /* Reset the counter which is responsible for keeping tabs on how many bytes have been received */
191198 _ota_bin_data.bytes_received = 0 ;
@@ -226,7 +233,9 @@ OTAState OTALogic::handle_BinaryReceived()
226233 _ota_bin_data.bytes_received += _mqtt_ota_buf.num_bytes ;
227234 _mqtt_ota_buf.num_bytes = 0 ;
228235
236+ #ifndef HOST
229237 DBG_VERBOSE (" %s: %d bytes written" , __PRETTY_FUNCTION__, _ota_bin_data.bytes_received );
238+ #endif
230239
231240 if (_ota_bin_data.bytes_received >= _ota_bin_data.hdr_len ) {
232241 _ota_storage->close ();
@@ -239,7 +248,9 @@ OTAState OTALogic::handle_BinaryReceived()
239248
240249OTAState OTALogic::handle_Verify ()
241250{
251+ #ifndef HOST
242252 DBG_VERBOSE (__PRETTY_FUNCTION__);
253+ #endif
243254 if (_ota_bin_data.crc32 == _ota_bin_data.hdr_crc32 ) {
244255 return OTAState::Rename;
245256 } else {
@@ -251,7 +262,9 @@ OTAState OTALogic::handle_Verify()
251262
252263OTAState OTALogic::handle_Rename ()
253264{
265+ #ifndef HOST
254266 DBG_VERBOSE (__PRETTY_FUNCTION__);
267+ #endif
255268 if (_ota_storage->rename ()) {
256269 _ota_storage->deinit ();
257270 return OTAState::Reset;
@@ -272,8 +285,10 @@ OTAState OTALogic::handle_Reset()
272285 * update before starting the application, otherwise the app
273286 * is started directly.
274287 */
288+ #ifndef HOST
275289 DBG_VERBOSE (__PRETTY_FUNCTION__);
276290 delay (250 );
291+ #endif
277292 NVIC_SystemReset ();
278293#endif /* HOST */
279294 return OTAState::Reset;
0 commit comments