Added support WebSocket for control via a WEB-APP#34
Conversation
DAXPL
left a comment
There was a problem hiding this comment.
Looks good, but we need to test it on the drone before merging to main
| sharedData->throttle = 0; | ||
| sharedData->yaw = 0; | ||
| sharedData->pitch = 0; | ||
| sharedData->roll = 0; |
There was a problem hiding this comment.
Nie możemy w locie nagle wyłączyć silników. Do tego mamy metodę z odpowiednią procedurą. Póki co jest ona pusta, ale planowo będzie odpowiadała za powolne wyłączanie silników tak aby nie zagrażały nikomu
| instance->sharedData->throttle = 0; | ||
| instance->sharedData->yaw = 0; | ||
| instance->sharedData->pitch = 0; | ||
| instance->sharedData->roll = 0; |
There was a problem hiding this comment.
Rozłączenie nie może powodować nagłego wyłączenia silników. Raz że mamy od tego specjalną funkcję a dwa rozłączenie może być chwilowe
| #include "communicationModules/CommunicationWebSocket.h" | ||
| CommunicationWebSocket* CommunicationWebSocket::instance = nullptr; | ||
| CommunicationWebSocket::CommunicationWebSocket(DroneControlData *dataPtr, DroneStatus *status) | ||
| : server(80), ws("/ws") |
There was a problem hiding this comment.
Przenieś protokół do pliku z konfiguracją. Obecnie będziemy mieli konflikt portów niestety
| ws.onEvent(onWsEvent); | ||
| server.addHandler(&ws); | ||
| server.begin(); | ||
| Serial.println("WebSocket server started on port 80"); |
There was a problem hiding this comment.
Konkatenuj zmieenną z numerem portu - użytkownik może chcieć zmienić
| ws.textAll((char*)data, sizeof(SensorsData)); | ||
| } | ||
| void CommunicationWebSocket::checkConnectionTimeout() { | ||
| if (millis() - lastDataTime > 500) { |
There was a problem hiding this comment.
Nie zakładaj sztywnego czasu. W pliku konfiguracyjnym mamy zdefiniowany rogue time
| br3ttb/PID@^1.2.1 | ||
| adafruit/Adafruit ADXL345@^1.3.4 | ||
| adafruit/Adafruit Unified Sensor@^1.1.14 | ||
| esp32async/AsyncTCP@^3.4.10 |
No description provided.