From 73fde34e48ab42e504ff8bf86c6e9d01bb04203a Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Fri, 19 Jul 2024 12:15:44 +0200 Subject: [PATCH] - fix ntripClient - fix gyroscope - fix init screen --- doc/TODO allgemein.txt | 3 ++- include/networkConfig.h | 12 ++++++------ lib/LcdWrapper/LcdWrapper.cpp | 2 +- lib/MotorControl/motorControl.cpp | 1 + lib/NtripClient/ntripClient.cpp | 6 +++++- lib/NtripClient/ntripClient.h | 11 ++++++----- lib/Sensors/sensorData.cpp | 4 ++-- lib/Sensors/sensorData.h | 2 +- src/main.cpp | 2 +- 9 files changed, 25 insertions(+), 18 deletions(-) diff --git a/doc/TODO allgemein.txt b/doc/TODO allgemein.txt index df84b5d..e11431c 100644 --- a/doc/TODO allgemein.txt +++ b/doc/TODO allgemein.txt @@ -39,6 +39,7 @@ Have to: -> check new course calculation between points -> menu route data und ui disconnecten -> use routeCache in captureRoute and autopilot - + -> make ntrip client useable without user and password + -> understand gyroscope offsets diff --git a/include/networkConfig.h b/include/networkConfig.h index 1f6c28b..16bf1f2 100644 --- a/include/networkConfig.h +++ b/include/networkConfig.h @@ -14,16 +14,16 @@ #include -#define ZUHAUSE +#define HOTSPOT #ifdef HOTSPOT namespace NetworkConfig { - const char ssid[] = "Kleiax Handy"; + const char ssid[] = "Nubsi"; const char password[] = "12345677"; - const char ip[] = "192.168.43.4"; + const char ip[] = "192.168.72.7"; const char subnet[] = "255.255.255.0"; - const char gateway[] = "192.168.43.1"; + const char gateway[] = "192.168.72.228"; const char dns[] = "8.8.8.8"; const bool mqtt = false; } @@ -81,9 +81,9 @@ namespace NtripConfig { const char host[] = "rtk2go.com"; const uint16_t port = 2101; - // const char mountPoint[] = "GER-Dortmund"; + const char mountPoint[] = "GER-Dortmund"; // const char mountPoint[] = "GER-Papenburg"; - const char mountPoint[] = "Rtkramerntrip"; + // const char mountPoint[] = "Rtkramerntrip"; const char user[] = "alklein1@gmx.de"; const char password[] = "none"; } diff --git a/lib/LcdWrapper/LcdWrapper.cpp b/lib/LcdWrapper/LcdWrapper.cpp index 80d66db..d3952a5 100644 --- a/lib/LcdWrapper/LcdWrapper.cpp +++ b/lib/LcdWrapper/LcdWrapper.cpp @@ -14,7 +14,7 @@ LcdWrapper::LcdWrapper(LiquidCrystal_I2C *lcd) : lcd{lcd}, changed{false} { - this->clear(); + // this->clear(); } void LcdWrapper::run() diff --git a/lib/MotorControl/motorControl.cpp b/lib/MotorControl/motorControl.cpp index 6ff901f..61797f2 100644 --- a/lib/MotorControl/motorControl.cpp +++ b/lib/MotorControl/motorControl.cpp @@ -194,6 +194,7 @@ void MotorControl::setRealPower(int8_t power) } ledcWrite(this->pwmChannel, pwm_val); + std::cout << "MotorControl::serRealPower - pwm: " << static_cast(pwm_val) << std::endl; this->dutycycle = pwm_val; } diff --git a/lib/NtripClient/ntripClient.cpp b/lib/NtripClient/ntripClient.cpp index 7eeb2cc..e34f39a 100644 --- a/lib/NtripClient/ntripClient.cpp +++ b/lib/NtripClient/ntripClient.cpp @@ -12,8 +12,12 @@ #include "ntripClient.h" NTRIPClient::NTRIPClient(SFE_UBLOX_GNSS *gnss, const char *host, uint16_t port, const char *mountPoint, const char *user, const char *password) - : gnss{gnss}, port{port}, host{host}, mountPoint{mountPoint}, user{user}, password{password}, ntripClient{new WiFiClient}, state{NTRIPClientStates::closingConnection} + : gnss{gnss}, port{port}, ntripClient{new WiFiClient}, state{NTRIPClientStates::closingConnection} { + strcpy(this->host, host); + strcpy(this->mountPoint, mountPoint); + strcpy(this->user, user); + strcpy(this->password, password); Component::loopDelay = NTRIPClient::loopDelay; } diff --git a/lib/NtripClient/ntripClient.h b/lib/NtripClient/ntripClient.h index 5ea0dd3..86af643 100644 --- a/lib/NtripClient/ntripClient.h +++ b/lib/NtripClient/ntripClient.h @@ -120,12 +120,13 @@ private: uint32_t lastGPGGAPushTime = 0; uint32_t lastReconnectTime = 0; - const char *host; - const char *mountPoint; - const char *user; - const char *password; + static const uint8_t connectionDataLength = 32; + char host[connectionDataLength]; + char mountPoint[connectionDataLength]; + char user[connectionDataLength]; + char password[connectionDataLength]; const uint8_t maxReconnectAttemps = 10; - const uint16_t reconnectDelayTime = 1000; + const uint16_t reconnectDelayTime = 5000; const uint16_t timeOut = 10000; const uint16_t bufferSize = 512; const uint16_t bufferSizePushGPGGA = 128; diff --git a/lib/Sensors/sensorData.cpp b/lib/Sensors/sensorData.cpp index 70f9e39..689eb72 100644 --- a/lib/Sensors/sensorData.cpp +++ b/lib/Sensors/sensorData.cpp @@ -89,7 +89,7 @@ void SensorData::enableGyroscope() this->gyroscope->initialize(); if (!this->gyroscope->testConnection()) { - std::cout << "SensorData::enableGyroscope: Gyroskop is not conntected. Freeze!" << std::endl; + std::cout << "SensorData::enableGyroscope: Gyroscope is not connected. Freeze!" << std::endl; while (true) { } @@ -107,7 +107,7 @@ void SensorData::enableGyroscope() { this->gyroscope->CalibrateAccel(6); this->gyroscope->CalibrateGyro(6); - this->gyroscope->PrintActiveOffsets(); + // this->gyroscope->PrintActiveOffsets(); this->gyroscope->setDMPEnabled(true); } else diff --git a/lib/Sensors/sensorData.h b/lib/Sensors/sensorData.h index 7eb69cf..a441dea 100644 --- a/lib/Sensors/sensorData.h +++ b/lib/Sensors/sensorData.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include "calcAzimuth.h" #include "ntripClient.h" diff --git a/src/main.cpp b/src/main.cpp index 8fc49a6..8769fe0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -130,7 +130,7 @@ void setup() static_cast(NtripConfig::mountPoint), static_cast(NtripConfig::user), static_cast(NtripConfig::password)); - // sensorData->enableGyroscope(); + sensorData->enableGyroscope(); driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr()); char wifiIndicator = 'X';