Skip to content

Commit 29f21d9

Browse files
committed
If board has a valid _dataTopicIn also _shadowTopicIn is valid
1 parent 88d1f96 commit 29f21d9

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -548,26 +548,20 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics()
548548
return State::SubscribeThingTopics;
549549
}
550550

551-
if (_shadowTopicIn != "")
551+
if (!_mqttClient.subscribe(_shadowTopicIn))
552552
{
553-
if (!_mqttClient.subscribe(_shadowTopicIn))
554-
{
555-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _shadowTopicIn.c_str());
553+
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _shadowTopicIn.c_str());
556554
#if !defined(__AVR__)
557-
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
555+
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
558556
#endif
559-
return State::SubscribeThingTopics;
560-
}
557+
return State::SubscribeThingTopics;
561558
}
562559

563560
DEBUG_INFO("Connected to Arduino IoT Cloud");
564561
execCloudEventCallback(ArduinoIoTCloudEvent::CONNECT);
565562
_deviceSubscribedToThing = true;
566563

567-
if (_shadowTopicIn != "")
568-
return State::RequestLastValues;
569-
else
570-
return State::Connected;
564+
return State::RequestLastValues;
571565
}
572566

573567
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()

0 commit comments

Comments
 (0)