Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f24375c

Browse files
committedJan 24, 2022
If board has a valid _dataTopicIn also _shadowTopicIn is valid
1 parent cda1243 commit f24375c

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed
 

‎src/ArduinoIoTCloudTCP.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -570,27 +570,20 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics()
570570
return State::SubscribeThingTopics;
571571
}
572572

573-
if (_shadowTopicIn != "")
573+
if (!_mqttClient.subscribe(_shadowTopicIn))
574574
{
575-
if (!_mqttClient.subscribe(_shadowTopicIn))
576-
{
577-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _shadowTopicIn.c_str());
575+
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _shadowTopicIn.c_str());
578576
#if !defined(__AVR__)
579-
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
577+
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
580578
#endif
581-
return State::SubscribeThingTopics;
582-
}
579+
return State::SubscribeThingTopics;
583580
}
584581

585582
DEBUG_INFO("Connected to Arduino IoT Cloud");
586583
execCloudEventCallback(ArduinoIoTCloudEvent::CONNECT);
587584
_deviceSubscribedToThing = true;
588585

589-
if (_shadowTopicIn != "")
590-
return State::RequestLastValues;
591-
else
592-
return State::Connected;
593-
586+
return State::RequestLastValues;
594587
}
595588

596589
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()

0 commit comments

Comments
 (0)
Please sign in to comment.