Improve reconnect
This commit is contained in:
@@ -44,8 +44,8 @@ void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
Serial.println("Starting Smart RGB ESP32...");
|
||||
initializeScheduler();
|
||||
stateMachine = new StateMachine<maxNumberOfStates>();
|
||||
initializeScheduler();
|
||||
appContext->pinR = pinR;
|
||||
appContext->pinG = pinG;
|
||||
appContext->pinB = pinB;
|
||||
|
||||
@@ -52,12 +52,10 @@ public:
|
||||
|
||||
void onEnter(StateMachineBase &stateMachine) override {
|
||||
Serial.println("Entering NetworkInitializeState");
|
||||
if (appContext && appContext->network) {
|
||||
delete appContext->network;
|
||||
appContext->network = nullptr;
|
||||
}
|
||||
if (appContext && !appContext->network) {
|
||||
appContext->network = new Network(hostName, friendlyName);
|
||||
} else if (appContext && appContext->network) {
|
||||
appContext->network->reconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user