diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.cpp b/code/components/jomjol_controlcamera/ClassControllCamera.cpp index 5790cf70..208dcefb 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.cpp +++ b/code/components/jomjol_controlcamera/ClassControllCamera.cpp @@ -263,7 +263,6 @@ void CCamera::EnableAutoExposure(int flashdauer) ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed"); LEDOnOff(false); LightOnOff(false); - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Camera Capture Failed (Procedure 'EnableAutoExposure') --> Reboot! " "Check that your camera module is working and connected properly."); //doReboot(); @@ -315,7 +314,6 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay) LEDOnOff(false); LightOnOff(false); - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Camera is not working anymore (CCamera::CaptureToBasisImage) - most probably caused by a hardware problem (instablility, ...). " "System will reboot."); doReboot(); @@ -328,7 +326,6 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay) if (!zwischenspeicher) { ESP_LOGE(TAGCAMERACLASS, "Insufficient memory space for image in function CaptureToBasisImage()"); - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Insufficient memory space for image in function CaptureToBasisImage()"); } for (int i = 0; i < _size; ++i) @@ -413,7 +410,6 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay) ESP_LOGE(TAGCAMERACLASS, "CaptureToFile: Camera Capture Failed"); LEDOnOff(false); LightOnOff(false); - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Camera Capture Failed (CCamera::CaptureToFile) --> Reboot! " "Check that your camera module is working and connected properly."); //doReboot(); diff --git a/code/components/jomjol_fileserver_ota/server_ota.cpp b/code/components/jomjol_fileserver_ota/server_ota.cpp index 17facf15..7df5e72c 100644 --- a/code/components/jomjol_fileserver_ota/server_ota.cpp +++ b/code/components/jomjol_fileserver_ota/server_ota.cpp @@ -492,7 +492,6 @@ void task_reboot(void *pvParameter) } void doReboot(){ - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_INFO, "Reboot triggered by Software (5s)."); LogFile.WriteToFile(ESP_LOG_WARN, "Reboot in 5sec"); xTaskCreate(&task_reboot, "reboot", configMINIMAL_STACK_SIZE * 64, NULL, 10, NULL); diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp index e3e2e62e..ae4f6d63 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp @@ -305,7 +305,6 @@ bool ClassFlowControll::doFlow(string time) if (i) i -= 1; // vorheriger Schritt muss wiederholt werden (vermutlich Bilder aufnehmen) result = false; if (repeat > 5) { - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Wiederholung 5x nicht erfolgreich --> reboot"); doReboot(); // Schritt wurde 5x wiederholt --> reboot @@ -493,8 +492,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph) { // reboot notwendig damit die neue wlan.ini auch benutzt wird !!! fclose(pfile); - LogFile.SwitchOnOff(true); - LogFile.WriteToFile(ESP_LOG_WARN, "Rebooting to activate new HOSTNAME..."); + LogFile.WriteToFile(ESP_LOG_ERROR, "Rebooting to activate new HOSTNAME..."); esp_restart(); hard_restart(); doReboot(); diff --git a/code/components/jomjol_image_proc/CImageBasis.cpp b/code/components/jomjol_image_proc/CImageBasis.cpp index f72632c7..b7fa3e84 100644 --- a/code/components/jomjol_image_proc/CImageBasis.cpp +++ b/code/components/jomjol_image_proc/CImageBasis.cpp @@ -362,7 +362,6 @@ void CImageBasis::LoadFromMemory(stbi_uc *_buffer, int len) ESP_LOGD(TAG, "Image loaded from memory: %d, %d, %d", width, height, channels); if ((width * height * channels) == 0) { - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Image with size 0 loaded --> reboot to be done! " "Check that your camera module is working and connected properly."); diff --git a/code/components/jomjol_logfile/ClassLogFile.cpp b/code/components/jomjol_logfile/ClassLogFile.cpp index c40aeef9..05667514 100644 --- a/code/components/jomjol_logfile/ClassLogFile.cpp +++ b/code/components/jomjol_logfile/ClassLogFile.cpp @@ -120,7 +120,7 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, esp_log_level_t level, std::string zwtime; std::string logline = ""; - if (!doLogFile){ + if (!doLogFile && level != ESP_LOG_ERROR){ // Only write to file if logfile is enabled or its an error message return; } diff --git a/code/components/jomjol_mqtt/interface_mqtt.cpp b/code/components/jomjol_mqtt/interface_mqtt.cpp index 48a88f97..9714f158 100644 --- a/code/components/jomjol_mqtt/interface_mqtt.cpp +++ b/code/components/jomjol_mqtt/interface_mqtt.cpp @@ -11,7 +11,6 @@ static const char *TAG_INTERFACEMQTT = "interface_mqtt"; std::map>* connectFunktionMap = NULL; std::map>* subscribeFunktionMap = NULL; -bool debugdetail = true; // #define CONFIG_BROKER_URL "mqtt://192.168.178.43:1883" @@ -31,7 +30,7 @@ bool MQTTPublish(std::string _key, std::string _content, int retained_flag){ return false; } zw = "MQTT - sent publish successful in MQTTPublish, msg_id=" + std::to_string(msg_id) + ", " + _key + ", " + _content; - if (debugdetail) LogFile.WriteToFile(ESP_LOG_INFO, zw); + LogFile.WriteToFile(ESP_LOG_INFO, zw); return true; } diff --git a/code/main/main.cpp b/code/main/main.cpp index 9cdf60fc..5f1da209 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -219,7 +219,6 @@ extern "C" void app_main(void) LogFile.WriteToFile(ESP_LOG_INFO, "============================================================================================="); LogFile.WriteToFile(ESP_LOG_INFO, versionFormated); LogFile.WriteToFile(ESP_LOG_INFO, "Reset reason: " + getResetReason()); - LogFile.SwitchOnOff(false); std::string zw = gettimestring("%Y%m%d-%H%M%S"); ESP_LOGD(TAGMAIN, "time %s", zw.c_str()); @@ -229,20 +228,15 @@ extern "C" void app_main(void) { std::string _zws = "Not enough PSRAM available. Expected 4.194.304 MByte - available: " + std::to_string(_hsize); _zws = _zws + "\nEither not initialzed, too small (2MByte only) or not present at all. Firmware cannot start!!"; - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, _zws); - LogFile.SwitchOnOff(false); } else { if (cam != ESP_OK) { - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Failed to initialize camera module. " "Check that your camera module is working and connected properly."); - LogFile.SwitchOnOff(false); } else { // Test Camera camera_fb_t * fb = esp_camera_fb_get(); if (!fb) { - LogFile.SwitchOnOff(true); LogFile.WriteToFile(ESP_LOG_ERROR, "Camera cannot be initialzed. " "System will reboot."); doReboot();