Added timestamp to debugMqtt
This commit is contained in:
+7
-2
@@ -2,6 +2,7 @@
|
||||
#include <Ps3Controller.h>
|
||||
#include <WiFi.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "motorControl.h"
|
||||
@@ -67,7 +68,10 @@ void setup() {
|
||||
mqtt_client.setServer(mqtt_server, MQTT_PORT);
|
||||
reconnectMqtt();
|
||||
|
||||
configTime(3600, 3600, "192.168.1.2");
|
||||
|
||||
DebugMqtt::init(&mqtt_client, Loglevel::debug);
|
||||
DebugMqtt::initRealMillis();
|
||||
|
||||
Ps3.attach(callbackControllerAction);
|
||||
Ps3.attachOnConnect(callbackControllerConnect);
|
||||
@@ -91,7 +95,7 @@ void loop() {
|
||||
mqtt_client.loop();
|
||||
|
||||
if (millis() - last_millis > 1000) {
|
||||
debugger.sendMsg(Loglevel::info, "loop : eine Sekinde");
|
||||
debugger.sendTime();
|
||||
|
||||
last_millis = millis();
|
||||
}
|
||||
@@ -116,7 +120,7 @@ void reconnectMqtt() {
|
||||
if (mqtt_client.connect(clientId.c_str())) {
|
||||
Serial.println("connected");
|
||||
// Once connected, publish an announcement...
|
||||
mqtt_client.publish("/Rover/Info", "Connected");
|
||||
mqtt_client.publish("Rover/Info", "Connected to Mqtt-Broker");
|
||||
} else {
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(mqtt_client.state());
|
||||
@@ -206,3 +210,4 @@ void getDis(double lat1, double lon1, double lat2, double lon2) {
|
||||
double dy = 111.3 * (lat1 - lat2);
|
||||
double erg = sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user