mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
remove Serial.p*
This commit is contained in:
@@ -87,17 +87,19 @@ AsyncMqttClient* MqttSettingsService::getMqttClient() {
|
||||
}
|
||||
|
||||
void MqttSettingsService::onMqttConnect(bool sessionPresent) {
|
||||
/*
|
||||
Serial.print(F("Connected to MQTT, "));
|
||||
if (sessionPresent) {
|
||||
Serial.println(F("with persistent session"));
|
||||
} else {
|
||||
Serial.println(F("without persistent session"));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void MqttSettingsService::onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
||||
Serial.print(F("Disconnected from MQTT reason: "));
|
||||
Serial.println((uint8_t)reason);
|
||||
// Serial.print(F("Disconnected from MQTT reason: "));
|
||||
// Serial.println((uint8_t)reason);
|
||||
_disconnectReason = reason;
|
||||
_disconnectedAt = millis();
|
||||
}
|
||||
@@ -110,28 +112,28 @@ void MqttSettingsService::onConfigUpdated() {
|
||||
#ifdef ESP32
|
||||
void MqttSettingsService::onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
if (_state.enabled) {
|
||||
Serial.println(F("WiFi connection dropped, starting MQTT client."));
|
||||
// Serial.println(F("WiFi connection dropped, starting MQTT client."));
|
||||
onConfigUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
void MqttSettingsService::onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
if (_state.enabled) {
|
||||
Serial.println(F("WiFi connection dropped, stopping MQTT client."));
|
||||
// Serial.println(F("WiFi connection dropped, stopping MQTT client."));
|
||||
onConfigUpdated();
|
||||
}
|
||||
}
|
||||
#elif defined(ESP8266)
|
||||
void MqttSettingsService::onStationModeGotIP(const WiFiEventStationModeGotIP& event) {
|
||||
if (_state.enabled) {
|
||||
Serial.println(F("WiFi connection dropped, starting MQTT client."));
|
||||
// Serial.println(F("WiFi connection dropped, starting MQTT client."));
|
||||
onConfigUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
void MqttSettingsService::onStationModeDisconnected(const WiFiEventStationModeDisconnected& event) {
|
||||
if (_state.enabled) {
|
||||
Serial.println(F("WiFi connection dropped, stopping MQTT client."));
|
||||
// Serial.println(F("WiFi connection dropped, stopping MQTT client."));
|
||||
onConfigUpdated();
|
||||
}
|
||||
}
|
||||
@@ -143,7 +145,7 @@ void MqttSettingsService::configureMqtt() {
|
||||
|
||||
// only connect if WiFi is connected and MQTT is enabled
|
||||
if (_state.enabled && WiFi.isConnected()) {
|
||||
Serial.println(F("Connecting to MQTT..."));
|
||||
// Serial.println(F("Connecting to MQTT..."));
|
||||
_mqttClient.setServer(retainCstr(_state.host.c_str(), &_retainedHost), _state.port);
|
||||
if (_state.username.length() > 0) {
|
||||
_mqttClient.setCredentials(
|
||||
|
||||
Reference in New Issue
Block a user