@@ -49,19 +49,9 @@ bool NetworkConfiguratorClass::begin() {
49
49
if(_state != NetworkConfiguratorStates::END) {
50
50
return true;
51
51
}
52
- /*
53
- * If the board is zero touch capable, starts with zero touch configuration mode
54
- * In this state the board will try to connect to the network using a set of
55
- * default network settings ex. Ethernet with DHCP
56
- * This mode will fail if the provided ConnectionHandler is not GenericConnectionHandler type
57
- * falling back to read the network settings from the storage
58
- */
59
52
60
- #if ZERO_TOUCH_ENABLED
61
- _state = NetworkConfiguratorStates::ZERO_TOUCH_CONFIG;
62
- #else
63
53
_state = NetworkConfiguratorStates::READ_STORED_CONFIG;
64
- #endif
54
+
65
55
_connectionHandler->enableCheckInternetAvailability(true);
66
56
67
57
memset(&_networkSetting, 0x00, sizeof(models::NetworkSetting));
@@ -98,10 +88,10 @@ NetworkConfiguratorStates NetworkConfiguratorClass::update() {
98
88
_ledFeedback->update();
99
89
100
90
switch (_state) {
91
+ case NetworkConfiguratorStates::READ_STORED_CONFIG: nextState = handleReadStorage (); break;
101
92
#if ZERO_TOUCH_ENABLED
102
93
case NetworkConfiguratorStates::ZERO_TOUCH_CONFIG: nextState = handleZeroTouchConfig(); break;
103
94
#endif
104
- case NetworkConfiguratorStates::READ_STORED_CONFIG: nextState = handleReadStorage (); break;
105
95
case NetworkConfiguratorStates::WAITING_FOR_CONFIG: nextState = handleWaitingForConf (); break;
106
96
case NetworkConfiguratorStates::CONNECTING: nextState = handleConnecting (); break;
107
97
case NetworkConfiguratorStates::CONFIGURED: nextState = handleConfigured (); break;
@@ -475,9 +465,10 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleZeroTouchConfig() {
475
465
sendStatus(StatusMessage::ERROR);
476
466
}
477
467
_connectionHandlerIstantiated = false;
478
- return NetworkConfiguratorStates::READ_STORED_CONFIG ;
468
+ return NetworkConfiguratorStates::WAITING_FOR_CONFIG ;
479
469
}
480
- return NetworkConfiguratorStates::ZERO_TOUCH_CONFIG;
470
+
471
+ return handleWaitingForConf();
481
472
}
482
473
#endif
483
474
@@ -518,7 +509,16 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleReadStorage() {
518
509
if (_optionUpdateTimer.getWaitTime() == 0) {
519
510
scanNetworkOptions();
520
511
}
512
+ /*
513
+ * If the board is zero touch capable and without network configuration, it starts the zero touch configuration mode
514
+ * In this state the board will try to connect to the network using a set of
515
+ * default network settings ex. Ethernet with DHCP
516
+ */
517
+ #if ZERO_TOUCH_ENABLED
518
+ return NetworkConfiguratorStates::ZERO_TOUCH_CONFIG;
519
+ #else
521
520
return NetworkConfiguratorStates::WAITING_FOR_CONFIG;
521
+ #endif
522
522
}
523
523
524
524
NetworkConfiguratorStates NetworkConfiguratorClass::handleWaitingForConf() {
0 commit comments