Implement websocket receive

This commit is contained in:
GHOSCHT 2022-04-13 18:42:39 +02:00
parent 833cc5bbd9
commit d285387f38
No known key found for this signature in database
GPG key ID: A35BD466B8871994
2 changed files with 4 additions and 2 deletions

View file

@ -46,5 +46,6 @@ char *WebsocketCommunicator::receiveMessage()
void WebsocketCommunicator::handleMessage(void *arg, uint8_t *data, size_t len)
{
Serial.println("data");
int effectiveLen = len < bufferSize ? len : bufferSize;
strncpy(messageBuffer, (char *)data, effectiveLen);
}

View file

@ -28,9 +28,10 @@ void websocketTask(void *parameter)
while (true)
{
websocket->sendMessage(light->getBjtState(), light->getBjtCount());
light->updateState(websocket->receiveMessage(), STEPS);
websocket->clearBuffer();
vTaskDelay(90 / portTICK_PERIOD_MS);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
vTaskDelete(NULL);
}