File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,8 @@ DeviceState handleFirstConfig() {
163
163
}
164
164
165
165
DeviceState handleCSR () {
166
- DeviceState nextState = _state;
167
166
ClaimingHandler.poll ();
167
+ DeviceState nextState = _state;
168
168
if (CSRHandler->poll () == CSRHandlerClass::CSRHandlerStates::COMPLETED) {
169
169
170
170
@@ -173,6 +173,9 @@ DeviceState handleCSR() {
173
173
Serial.println (" CSR done" );
174
174
display_freeram ();
175
175
nextState = DeviceState::BEGIN_CLOUD;
176
+ }else if (nextState == DeviceState::FIRST_CONFIG){
177
+ CSRHandler->end ();
178
+ delete CSRHandler;
176
179
}
177
180
return nextState;
178
181
}
@@ -192,14 +195,17 @@ DeviceState handleBeginCloud() {
192
195
}
193
196
194
197
DeviceState handleRun () {
198
+ ClaimingHandler.poll ();
195
199
DeviceState nextState = _state;
200
+ if (nextState == DeviceState::FIRST_CONFIG){
201
+ return nextState;
202
+ }
196
203
ArduinoCloud.update ();
197
204
198
- ClaimingHandler.poll ();
199
205
if (NetworkConfigurator.poll () == NetworkConfiguratorStates::UPDATING_CONFIG) {
200
206
nextState = DeviceState::FIRST_CONFIG;
201
207
}
202
-
208
+
203
209
// Your code here
204
210
if (millis () - lastUpdate > 10000 ) {
205
211
Serial.println (" alive" );
Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ void AgentsManagerClass::handleGetBleMacAddressCommand() {
379
379
380
380
void AgentsManagerClass::handleResetCommand () {
381
381
if (_statusRequest.pending ) {
382
- DEBUG_DEBUG (" AgentsManagerClass::%s received a GetUnique request while executing another request" , __FUNCTION__);
382
+ DEBUG_DEBUG (" AgentsManagerClass::%s received a Reset request while executing another request" , __FUNCTION__);
383
383
sendStatus (StatusMessage::OTHER_REQUEST_IN_EXECUTION);
384
384
return ;
385
385
}
Original file line number Diff line number Diff line change @@ -134,8 +134,11 @@ bool NetworkConfiguratorClass::resetStoredConfiguration() {
134
134
memset (&_networkSetting, 0x00 , sizeof (models::NetworkSetting));
135
135
if (_connectionHandlerIstantiated) {
136
136
disconnectFromNetwork ();
137
+ _connectionHandlerIstantiated = false ;
137
138
}
138
139
140
+ _state = NetworkConfiguratorStates::WAITING_FOR_CONFIG;
141
+
139
142
return true ;
140
143
}
141
144
You can’t perform that action at this time.
0 commit comments