@@ -33,6 +33,7 @@ NetworkConfiguratorClass::NetworkConfiguratorClass(ConnectionHandler &connection
33
33
_state{ NetworkConfiguratorStates::END },
34
34
_connectionHandler{ &connectionHandler },
35
35
_connectionHandlerIstantiated{ false },
36
+ _configInProgress{ false },
36
37
_kvstore{ nullptr },
37
38
_connectionTimeout{ NC_CONNECTION_TIMEOUT_ms, NC_CONNECTION_TIMEOUT_ms },
38
39
_connectionRetryTimer{ NC_CONNECTION_RETRY_TIMER_ms, NC_CONNECTION_RETRY_TIMER_ms },
@@ -547,8 +548,11 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleConnecting() {
547
548
_agentsManager->update (); // To keep alive the connection with the configurator
548
549
StatusMessage err;
549
550
ConnectionResult res = connectToNetwork (&err);
550
-
551
+ _configInProgress = _agentsManager-> isConfigInProgress ();
551
552
if (res == ConnectionResult::SUCCESS) {
553
+ if (_configInProgress) {
554
+ _ledFeedback->setMode (LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED);
555
+ }
552
556
return NetworkConfiguratorStates::CONFIGURED;
553
557
} else if (res == ConnectionResult::FAILED) {
554
558
sendStatus (err);
@@ -560,17 +564,16 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleConnecting() {
560
564
}
561
565
562
566
NetworkConfiguratorStates NetworkConfiguratorClass::handleConfigured () {
563
- bool configInprogress = _agentsManager->isConfigInProgress ();
564
-
565
- if (configInprogress) {
566
- _ledFeedback->setMode (LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED);
567
- }
568
-
569
567
_agentsManager->update ();
568
+ bool updatedConfigInprogress = _agentsManager->isConfigInProgress ();
569
+
570
570
// If the agent manager changes state, it means that user is trying to configure the network, so the network configurator should change state
571
- if (_agentsManager->isConfigInProgress () && !configInprogress) {
572
- scanNetworkOptions ();
573
- return NetworkConfiguratorStates::UPDATING_CONFIG;
571
+ if (_configInProgress != updatedConfigInprogress) {
572
+ _configInProgress = updatedConfigInprogress;
573
+ if (_configInProgress) {
574
+ scanNetworkOptions ();
575
+ return NetworkConfiguratorStates::UPDATING_CONFIG;
576
+ }
574
577
}
575
578
576
579
return NetworkConfiguratorStates::CONFIGURED;
0 commit comments