Implement websocket receive
This commit is contained in:
parent
833cc5bbd9
commit
d285387f38
2 changed files with 4 additions and 2 deletions
|
@ -46,5 +46,6 @@ char *WebsocketCommunicator::receiveMessage()
|
||||||
|
|
||||||
void WebsocketCommunicator::handleMessage(void *arg, uint8_t *data, size_t len)
|
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);
|
||||||
}
|
}
|
|
@ -28,9 +28,10 @@ void websocketTask(void *parameter)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
websocket->sendMessage(light->getBjtState(), light->getBjtCount());
|
websocket->sendMessage(light->getBjtState(), light->getBjtCount());
|
||||||
|
light->updateState(websocket->receiveMessage(), STEPS);
|
||||||
websocket->clearBuffer();
|
websocket->clearBuffer();
|
||||||
|
|
||||||
vTaskDelay(90 / portTICK_PERIOD_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue