Make loop more readable
This commit is contained in:
parent
887b64ddf2
commit
4946080c19
1 changed files with 17 additions and 8 deletions
|
@ -63,18 +63,27 @@ void setup()
|
||||||
websocket = new WebsocketCommunicator(ws, server, 50);
|
websocket = new WebsocketCommunicator(ws, server, 50);
|
||||||
|
|
||||||
connectWifi();
|
connectWifi();
|
||||||
|
server.begin();
|
||||||
registerTasks();
|
registerTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void computerCycle()
|
||||||
|
{
|
||||||
|
light->updateState(computer->receiveMessage(), STEPS);
|
||||||
|
computer->sendMessage(light->getBjtState(), light->getBjtCount());
|
||||||
|
computer->clearBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void phoneCycle()
|
||||||
|
{
|
||||||
|
light->updateState(phone->receiveMessage(), STEPS);
|
||||||
|
phone->sendMessage(light->getBjtState(), light->getBjtCount());
|
||||||
|
phone->clearBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
light->updateState(computer->receiveMessage(), STEPS);
|
computerCycle();
|
||||||
light->updateState(phone->receiveMessage(), STEPS);
|
phoneCycle();
|
||||||
computer->sendMessage(light->getBjtState(), light->getBjtCount());
|
|
||||||
computer->clearBuffer();
|
|
||||||
phone->sendMessage(light->getBjtState(), light->getBjtCount());
|
|
||||||
phone->clearBuffer();
|
|
||||||
|
|
||||||
ws.cleanupClients();
|
ws.cleanupClients();
|
||||||
server.begin();
|
|
||||||
}
|
}
|
Reference in a new issue