Merged mqtt

This commit is contained in:
Magnus Persson 2022-01-12 18:55:54 +01:00
parent aad35e20bd
commit a270faa480
3 changed files with 17 additions and 13 deletions

View File

@ -39,7 +39,7 @@ build_flags =
-D EMBED_HTML # If this is not used the html files needs to be on the file system (can be uploaded)
-D USER_SSID=\""\"" # =\""myssid\""
-D USER_SSID_PWD=\""\"" # =\""mypwd\""
-D CFG_APPVER="\"0.5.2\""
-D CFG_APPVER="\"0.5.3\""
lib_deps = # Switched to forks for better version control.
# Using local copy of this library
#https://github.com/jrowberg/i2cdevlib.git#<document>
@ -52,7 +52,7 @@ lib_deps = # Switched to forks for better version control.
https://github.com/mp-se/OneWire#v2.3.6 # https://github.com/PaulStoffregen/OneWire
https://github.com/mp-se/Arduino-Temperature-Control-Library#3.9.1 # https://github.com/milesburton/Arduino-Temperature-Control-Library
https://github.com/mp-se/arduinoCurveFitting#v1.0.6 # https://github.com/Rotario/arduinoCurveFitting
https://github.com/256dpi/arduino-mqtt
https://github.com/mp-se/arduino-mqtt#v2.5.0 # https://github.com/256dpi/arduino-mqtt
[env:gravity-debug]
upload_speed = ${common_env_data.upload_speed}

View File

@ -301,7 +301,8 @@ void PushTarget::sendMqtt(float angle, float gravity, float corrGravity,
if (mqtt.publish(myConfig.getMqttTopic(), json)) {
Log.notice(F("PUSH: MQTT publish successful" CR));
} else {
Log.error(F("PUSH: MQTT publish failed err=%d, ret=%d" CR), mqtt.lastError(), mqtt.returnCode());
Log.error(F("PUSH: MQTT publish failed err=%d, ret=%d" CR),
mqtt.lastError(), mqtt.returnCode());
}
mqtt.disconnect();

View File

@ -109,7 +109,9 @@ String WifiConnection::getIPAddress() { return WiFi.localIP().toString(); }
//
// Additional method to detect double reset.
//
bool WifiConnection::isDoubleResetDetected() { return myDRD->detectDoubleReset(); }
bool WifiConnection::isDoubleResetDetected() {
return myDRD->detectDoubleReset();
}
//
// Stop double reset detection
@ -180,7 +182,8 @@ bool WifiConnection::waitForConnection(int maxTime) {
if (i % 10) Serial.print(".");
if (i++ > (maxTime*10)) { // Try for maxTime seconds. Since delay is 100ms.
if (i++ >
(maxTime * 10)) { // Try for maxTime seconds. Since delay is 100ms.
Log.error(F("WIFI: Failed to connect to wifi %d, aborting %s." CR),
WiFi.status(), getIPAddress().c_str());
WiFi.disconnect();