reactivate mqtt output
This commit is contained in:
@@ -61,6 +61,7 @@ class Network {
|
|||||||
* @return false if not connected
|
* @return false if not connected
|
||||||
*/
|
*/
|
||||||
static bool checkMQTT();
|
static bool checkMQTT();
|
||||||
|
static bool initMQTT();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks if WiFi is still connected
|
* @brief Checks if WiFi is still connected
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class NTRIPClient {
|
|||||||
WiFiClient* ntripClient;
|
WiFiClient* ntripClient;
|
||||||
NTRIPClientStates state = NTRIPClientStates::notAvailable;
|
NTRIPClientStates state = NTRIPClientStates::notAvailable;
|
||||||
|
|
||||||
bool transmitLocation = true;
|
bool transmitLocation = false;
|
||||||
bool activated = true;
|
bool activated = true;
|
||||||
bool autoReconnect = false;
|
bool autoReconnect = false;
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -92,6 +92,7 @@ void setup() {
|
|||||||
Network::setupMQTT();
|
Network::setupMQTT();
|
||||||
wifiIsActive = Network::connectWifi();
|
wifiIsActive = Network::connectWifi();
|
||||||
if (wifiIsActive) {
|
if (wifiIsActive) {
|
||||||
|
Network::initMQTT();
|
||||||
if (Network::checkMQTT()) {
|
if (Network::checkMQTT()) {
|
||||||
DebugMqtt::init(Network::getMqttClient(), Loglevel::debug);
|
DebugMqtt::init(Network::getMqttClient(), Loglevel::debug);
|
||||||
std::cout << "Activate additional output via MQTT..." << std::endl;
|
std::cout << "Activate additional output via MQTT..." << std::endl;
|
||||||
@@ -111,7 +112,7 @@ void setup() {
|
|||||||
|
|
||||||
driveManager = new DriveManager(&moveController, spiPort, controlPad->getControlPadDataPtr(), wifiIsActive);
|
driveManager = new DriveManager(&moveController, spiPort, controlPad->getControlPadDataPtr(), wifiIsActive);
|
||||||
|
|
||||||
outputBuf->activateMqtt(false);
|
outputBuf->activateMqtt(true);
|
||||||
|
|
||||||
lcd->backlight();
|
lcd->backlight();
|
||||||
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
||||||
@@ -129,7 +130,9 @@ void loop() {
|
|||||||
if (wifiIsActive) {
|
if (wifiIsActive) {
|
||||||
DebugTimes wifiTime;
|
DebugTimes wifiTime;
|
||||||
Network::checkWiFi();
|
Network::checkWiFi();
|
||||||
Network::checkMQTT();
|
bool err = Network::checkMQTT();
|
||||||
|
if (!err)
|
||||||
|
std::cout << "loop(): checkMQTT returns false" << std::endl;
|
||||||
wifiTime.stopConsol("WiFi-Time", 10);
|
wifiTime.stopConsol("WiFi-Time", 10);
|
||||||
}
|
}
|
||||||
driveManager->loop();
|
driveManager->loop();
|
||||||
|
|||||||
+7
-1
@@ -121,7 +121,7 @@ bool Network::checkMQTT() {
|
|||||||
lastReconnectAttempt = now;
|
lastReconnectAttempt = now;
|
||||||
// Attempt to reconnect
|
// Attempt to reconnect
|
||||||
if (connectMQTT())
|
if (connectMQTT())
|
||||||
lastReconnectAttempt = 0;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -129,6 +129,12 @@ bool Network::checkMQTT() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Network::initMQTT() {
|
||||||
|
if (connectMQTT())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t Network::getWiFiChannel(const char *ssid) {
|
int32_t Network::getWiFiChannel(const char *ssid) {
|
||||||
if (int32_t n = WiFi.scanNetworks())
|
if (int32_t n = WiFi.scanNetworks())
|
||||||
for (uint8_t i=0; i<n; i++)
|
for (uint8_t i=0; i<n; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user