🪵 Removes serial logging

This commit is contained in:
Rune Harlyk
2024-06-09 14:10:53 +02:00
committed by Rune Harlyk
parent f62a8a38cb
commit 55347f1cac
7 changed files with 1 additions and 54 deletions
+1 -2
View File
@@ -5,5 +5,4 @@ build_flags =
-D EMBED_WWW
-D SERVE_CONFIG_FILES
-D CORS_ORIGIN=\"*\"
-D ENABLE_CORS
;-D SERIAL_INFO
-D ENABLE_CORS
@@ -79,9 +79,6 @@ void updateTask(void *param)
_socket->emit(EVENT_DOWNLOAD_OTA, output.c_str());
ESP_LOGE("Download OTA", "HTTP Update failed with error (%d): %s", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
#ifdef SERIAL_INFO
Serial.printf("HTTP Update failed with error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
#endif
break;
case HTTP_UPDATE_NO_UPDATES:
@@ -91,15 +88,9 @@ void updateTask(void *param)
_socket->emit(EVENT_DOWNLOAD_OTA, output.c_str());
ESP_LOGE("Download OTA", "HTTP Update failed, has same firmware version");
#ifdef SERIAL_INFO
Serial.println("HTTP Update failed, has same firmware version");
#endif
break;
case HTTP_UPDATE_OK:
ESP_LOGI("Download OTA", "HTTP Update successful - Restarting");
#ifdef SERIAL_INFO
Serial.println("HTTP Update successful - Restarting");
#endif
break;
}
vTaskDelete(NULL);
@@ -135,9 +126,6 @@ esp_err_t DownloadFirmwareService::downloadUpdate(PsychicRequest *request, JsonV
String downloadURL = json["download_url"];
ESP_LOGI("Download OTA", "Starting OTA from: %s", downloadURL.c_str());
#ifdef SERIAL_INFO
Serial.println("Starting OTA from: " + downloadURL);
#endif
doc["status"] = "preparing";
doc["progress"] = 0;
@@ -119,18 +119,12 @@ String MqttSettingsService::getLastError()
void MqttSettingsService::onMqttConnect(bool sessionPresent)
{
ESP_LOGI("MQTT", "Connected to MQTT: %s", _mqttClient.getMqttConfig()->uri);
#ifdef SERIAL_INFO
Serial.printf("Connected to MQTT: %s\n", _mqttClient.getMqttConfig()->uri);
#endif
_lastError = "None";
}
void MqttSettingsService::onMqttDisconnect(bool sessionPresent)
{
ESP_LOGI("MQTT", "Disconnected from MQTT.");
#ifdef SERIAL_INFO
Serial.println("Disconnected from MQTT.");
#endif
}
void MqttSettingsService::onMqttError(esp_mqtt_error_codes_t error)
@@ -173,9 +167,6 @@ void MqttSettingsService::configureMqtt()
// only connect if WiFi is connected and MQTT is enabled
if (_state.enabled && WiFi.isConnected())
{
#ifdef SERIAL_INFO
Serial.println("Connecting to MQTT...");
#endif
_mqttClient.setServer(retainCstr(_state.uri.c_str(), &_retainedHost));
if (_state.username.length() > 0)
{
@@ -49,17 +49,11 @@ void NTPSettingsService::begin()
void NTPSettingsService::onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info)
{
#ifdef SERIAL_INFO
Serial.println(F("Got IP address, starting NTP Synchronization"));
#endif
configureNTP();
}
void NTPSettingsService::onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info)
{
#ifdef SERIAL_INFO
Serial.println(F("WiFi connection dropped, stopping NTP."));
#endif
configureNTP();
}
@@ -67,9 +61,6 @@ void NTPSettingsService::configureNTP()
{
if (WiFi.isConnected() && _state.enabled)
{
#ifdef SERIAL_INFO
Serial.println(F("Starting NTP..."));
#endif
configTzTime(_state.tzFormat.c_str(), _state.server.c_str());
}
else
@@ -42,9 +42,6 @@ esp_err_t SleepService::sleep(PsychicRequest *request)
void SleepService::sleepNow()
{
#ifdef SERIAL_INFO
Serial.println("Going into deep sleep now");
#endif
ESP_LOGI("SleepService", "Going into deep sleep now");
// Callback for main code sleep preparation
if (_callbackSleep != nullptr)
@@ -70,10 +67,6 @@ void SleepService::sleepNow()
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
#endif
#ifdef SERIAL_INFO
Serial.println("Good by!");
#endif
// Just to be sure
delay(100);
@@ -98,9 +98,6 @@ void WiFiSettingsService::manageSTA()
// Connect or reconnect as required
if ((WiFi.getMode() & WIFI_STA) == 0)
{
#ifdef SERIAL_INFO
Serial.println("Connecting to WiFi...");
#endif
connectToWiFi();
}
}
-12
View File
@@ -37,28 +37,16 @@ void WiFiStatus::begin()
void WiFiStatus::onStationModeConnected(WiFiEvent_t event, WiFiEventInfo_t info)
{
ESP_LOGI("WiFiStatus", "WiFi Connected.");
#ifdef SERIAL_INFO
Serial.println("WiFi Connected.");
#endif
}
void WiFiStatus::onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info)
{
ESP_LOGI("WiFiStatus", "WiFi Disconnected. Reason code=%d", info.wifi_sta_disconnected.reason);
#ifdef SERIAL_INFO
Serial.print("WiFi Disconnected. Reason code=");
Serial.println(info.wifi_sta_disconnected.reason);
#endif
}
void WiFiStatus::onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info)
{
ESP_LOGI("WiFiStatus", "WiFi Got IP. localIP=%s, hostName=%s", WiFi.localIP().toString().c_str(), WiFi.getHostname());
#ifdef SERIAL_INFO
Serial.printf("WiFi Got IP. localIP=%s, hostName=%s\r\n", WiFi.localIP().toString().c_str(), WiFi.getHostname());
#endif
}
esp_err_t WiFiStatus::wifiStatus(PsychicRequest *request)