mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
tidy up EMSESP_DEBUG
This commit is contained in:
@@ -26,11 +26,11 @@ class FSPersistence {
|
||||
if (error == DeserializationError::Ok && jsonDocument.is<JsonObject>()) {
|
||||
JsonObject jsonObject = jsonDocument.as<JsonObject>();
|
||||
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
|
||||
#ifdef EMSESP_DEBUG
|
||||
Serial.println();
|
||||
Serial.printf("Reading settings from %s ", _filePath);
|
||||
serializeJson(jsonDocument, Serial);
|
||||
Serial.println();
|
||||
#if defined(EMSESP_DEBUG)
|
||||
// Serial.println();
|
||||
// Serial.printf("Reading settings from %s ", _filePath);
|
||||
// serializeJson(jsonDocument, Serial);
|
||||
// Serial.println();
|
||||
#endif
|
||||
settingsFile.close();
|
||||
return;
|
||||
@@ -40,10 +40,10 @@ class FSPersistence {
|
||||
|
||||
// If we reach here we have not been successful in loading the config,
|
||||
// hard-coded emergency defaults are now applied.
|
||||
#ifdef EMSESP_DEBUG
|
||||
Serial.println();
|
||||
Serial.printf("Applying defaults to %s", _filePath);
|
||||
Serial.println();
|
||||
#if defined(EMSESP_DEBUG)
|
||||
// Serial.println();
|
||||
// Serial.printf("Applying defaults to %s", _filePath);
|
||||
// Serial.println();
|
||||
#endif
|
||||
applyDefaults();
|
||||
writeToFS(); // added to make sure the initial file is created
|
||||
@@ -74,11 +74,11 @@ class FSPersistence {
|
||||
}
|
||||
|
||||
// serialize the data to the file
|
||||
#ifdef EMSESP_DEBUG
|
||||
Serial.println();
|
||||
Serial.printf("Writing settings to %s ", _filePath);
|
||||
serializeJson(jsonDocument, Serial);
|
||||
Serial.println();
|
||||
#if defined(EMSESP_DEBUG)
|
||||
// Serial.println();
|
||||
// Serial.printf("Writing settings to %s ", _filePath);
|
||||
// serializeJson(jsonDocument, Serial);
|
||||
// Serial.println();
|
||||
#endif
|
||||
serializeJson(jsonDocument, settingsFile);
|
||||
settingsFile.close();
|
||||
|
||||
@@ -133,11 +133,7 @@ MqttClient * MqttSettingsService::getMqttClient() {
|
||||
|
||||
void MqttSettingsService::onMqttConnect(bool sessionPresent) {
|
||||
(void)sessionPresent;
|
||||
// _disconnectedAt = 0;
|
||||
emsesp::EMSESP::mqtt_.on_connect();
|
||||
#ifdef EMSESP_DEBUG
|
||||
emsesp::EMSESP::logger().debug("Connected to MQTT, %s", (sessionPresent) ? ("with persistent session") : ("without persistent session"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void MqttSettingsService::onMqttDisconnect(espMqttClientTypes::DisconnectReason reason) {
|
||||
@@ -190,7 +186,7 @@ bool MqttSettingsService::configureMqtt() {
|
||||
_reconfigureMqtt = false;
|
||||
#ifndef TASMOTA_SDK
|
||||
if (_state.enableTLS) {
|
||||
#if EMSESP_DEBUG
|
||||
#if defined(EMSESP_DEBUG)
|
||||
emsesp::EMSESP::logger().debug("Start secure MQTT with rootCA");
|
||||
#endif
|
||||
static_cast<espMqttClientSecure *>(_mqttClient)->setServer(_state.host.c_str(), _state.port);
|
||||
|
||||
@@ -180,9 +180,8 @@ void NetworkSettingsService::setWiFiPowerOnRSSI() {
|
||||
else if (min_tx_pwr > 20)
|
||||
p = WIFI_POWER_5dBm;
|
||||
|
||||
#ifdef EMSESP_DEBUG
|
||||
uint8_t set_power = min_tx_pwr / 10; // this is the recommended power setting to use
|
||||
emsesp::EMSESP::logger().debug("Recommended WiFi Tx Power (set_power %d, new power %d, rssi %d, threshold %d)", set_power, p, rssi, threshold);
|
||||
#if defined(EMSESP_DEBUG)
|
||||
// emsesp::EMSESP::logger().debug("Recommended WiFi Tx Power (set_power %d, new power %d, rssi %d, threshold %d)", min_tx_pwr / 10, p, rssi, threshold);
|
||||
#endif
|
||||
|
||||
if (!WiFi.setTxPower(p)) {
|
||||
|
||||
Reference in New Issue
Block a user