|
|
@ -1,19 +1,16 @@
|
|
|
|
#include "comm.h"
|
|
|
|
#include "comm.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CommunicationsController::initota() {
|
|
|
|
void CommunicationsController::initOta() {
|
|
|
|
ArduinoOTA.setHostname(WIFI_SSID);
|
|
|
|
ArduinoOTA.setHostname(WIFI_SSID);
|
|
|
|
ArduinoOTA.setPassword(WIFI_PASSWORD);
|
|
|
|
ArduinoOTA.setPassword(WIFI_PASSWORD);
|
|
|
|
ArduinoOTA.begin();
|
|
|
|
ArduinoOTA.begin();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CommunicationsController::init_wifi() {
|
|
|
|
void CommunicationsController::initWifi() {
|
|
|
|
WiFiSettings.hostname = WIFI_SSID;
|
|
|
|
WiFiSettings.hostname = WIFI_SSID;
|
|
|
|
WiFiSettings.password = WIFI_PASSWORD;
|
|
|
|
WiFiSettings.password = WIFI_PASSWORD;
|
|
|
|
|
|
|
|
|
|
|
|
WiFiSettings.onPortal = []() {
|
|
|
|
|
|
|
|
ota();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
WiFiSettings.onPortalWaitLoop = []() {
|
|
|
|
WiFiSettings.onPortalWaitLoop = []() {
|
|
|
|
ArduinoOTA.handle();
|
|
|
|
ArduinoOTA.handle();
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -22,8 +19,8 @@ void CommunicationsController::init_wifi() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CommunicationsController::init() {
|
|
|
|
void CommunicationsController::init() {
|
|
|
|
ota();
|
|
|
|
initOta();
|
|
|
|
wifi();
|
|
|
|
initWifi();
|
|
|
|
WebMonitor.begin();
|
|
|
|
WebMonitor.begin();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -35,6 +32,7 @@ void CommunicationsController::process() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (l4s.connected()) {
|
|
|
|
if (l4s.connected()) {
|
|
|
|
|
|
|
|
|
|
|
|
handle_client();
|
|
|
|
handle_client();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
create_connection();
|
|
|
|
create_connection();
|
|
|
@ -43,13 +41,13 @@ void CommunicationsController::process() {
|
|
|
|
|
|
|
|
|
|
|
|
void CommunicationsController::handle_client() {
|
|
|
|
void CommunicationsController::handle_client() {
|
|
|
|
l4s.flush();
|
|
|
|
l4s.flush();
|
|
|
|
recv = recv();
|
|
|
|
received = recv();
|
|
|
|
Serial.println(recv);
|
|
|
|
WebMonitor.println(received);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CommunicationsController::parseLook4Sat(float* azimuth, float* altitude) {
|
|
|
|
void CommunicationsController::parseLook4Sat(float* azimuth, float* altitude) {
|
|
|
|
azimuth = recv.substring();
|
|
|
|
*azimuth = received.substring(0, 3).toFloat();
|
|
|
|
altitude = recv.substring(); //TODO
|
|
|
|
*altitude = received.substring(3, 6).toFloat(); //TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CommunicationsController::create_connection() {
|
|
|
|
void CommunicationsController::create_connection() {
|
|
|
|