diff --git a/FreeRTOS-Plus/Demo/FreeRTOS-IoT-Libraries-LTS-Beta1/ota/common/DemoTasks/aws_iot_ota_update_demo.c b/FreeRTOS-Plus/Demo/FreeRTOS-IoT-Libraries-LTS-Beta1/ota/common/DemoTasks/aws_iot_ota_update_demo.c index bf937fa209..e01839c718 100755 --- a/FreeRTOS-Plus/Demo/FreeRTOS-IoT-Libraries-LTS-Beta1/ota/common/DemoTasks/aws_iot_ota_update_demo.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS-IoT-Libraries-LTS-Beta1/ota/common/DemoTasks/aws_iot_ota_update_demo.c @@ -80,10 +80,8 @@ static void prvInitialiseLibraries( void ); static void _connectionRetryDelay( void ); /** - * @brief Initialize the libraries required for OTA demo. + * @brief Callback invoked when MQTT library detects a disconnection. * - * @return `EXIT_SUCCESS` if all libraries were successfully initialized; - * `EXIT_FAILURE` otherwise. */ static void prvNetworkDisconnectCallback( void * param, @@ -103,11 +101,11 @@ static void prvNetworkDisconnectCallback( void * param, * @param[in] pNetworkInterface The network interface to use for this demo. * @param[out] pMqttConnection Set to the handle to the new MQTT connection. * - * @return `EXIT_SUCCESS` if the connection is successfully established; `EXIT_FAILURE` - * otherwise. + * @return `IOT_MQTT_SUCCESS` if the connection is successfully established; Otherwise + * error code returned by `IotMqtt_Connect`. */ -static int _establishMqttConnection( bool awsIotMqttMode, - IotMqttConnection_t * pMqttConnection ); +static IotMqttError_t _establishMqttConnection( bool awsIotMqttMode, + IotMqttConnection_t * pMqttConnection ); /*-----------------------------------------------------------*/ #define otaDemoCONN_TIMEOUT_MS ( 2000UL ) @@ -326,9 +324,11 @@ OTA_Err_t xErr = kOTA_Err_Uninitialized; OTA_ActivateNewImage(); /* We should never get here as new image activation must reset the device.*/ + configPRINTF( ( "ERROR: New image activation failed.\r\n" ) ); + for( ; ; ) { - __debugbreak(); + IotClock_SleepMs( otaDemoTASK_DELAY_SECONDS * 1000 ); } } else if( eEvent == eOTA_JobEvent_Fail )