Просмотр исходного кода

Merge pull request #1202 from jomjol/consolidate-uart-and-logfile-logging

Consolidate uart and logfile logging
jomjol 3 лет назад
Родитель
Сommit
0a2b6b71ca

+ 0 - 1
code/components/jomjol_fileserver_ota/server_ota.cpp

@@ -494,7 +494,6 @@ void task_reboot(void *pvParameter)
 void doReboot(){
     LogFile.SwitchOnOff(true);
     LogFile.WriteToFile("Reboot triggered by Software (5s).");
-    ESP_LOGI(TAGPARTOTA, "Reboot in 5sec");
     LogFile.WriteToFile("Reboot in 5sec");
     xTaskCreate(&task_reboot, "reboot", configMINIMAL_STACK_SIZE * 64, NULL, 10, NULL);
     // KillTFliteTasks(); // kills itself 

+ 3 - 6
code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

@@ -548,8 +548,7 @@ bool ClassFlowCNNGeneral::getNetworkParameter()
     zwcnn = FormatFileName(zwcnn);
     ESP_LOGD(TAG, "%s", zwcnn.c_str());
     if (!tflite->LoadModel(zwcnn)) {
-        ESP_LOGD(TAG, "Can't read model file /sdcard%s", cnnmodelfile.c_str());
-        LogFile.WriteToFile("Cannot load model");
+        LogFile.WriteToFile("Can't read model file /sdcard%s", cnnmodelfile.c_str());
         delete tflite;
         return false;
     } 
@@ -617,8 +616,7 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time)
     zwcnn = FormatFileName(zwcnn);
     ESP_LOGD(TAG, "%s", zwcnn.c_str());
     if (!tflite->LoadModel(zwcnn)) {
-        ESP_LOGD(TAG, "Can't read model file /sdcard%s", cnnmodelfile.c_str());
-        LogFile.WriteToFile("Cannot load model");
+        LogFile.WriteToFile("Can't read model file /sdcard%s", cnnmodelfile.c_str());
 
         delete tflite;
         return false;
@@ -804,8 +802,7 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time)
                             GENERAL[_ana]->ROI[i]->isReject = true;
                             result = -1;
                             _result_save_file+= 100;     // Für den Fall, dass fit nicht ausreichend, soll trotzdem das Ergebnis mit "-10x.y" abgespeichert werden.
-                            string zw = "Value Rejected due to Threshold (Fit: " + to_string(_fit) + "Threshold: " + to_string(CNNGoodThreshold);
-                            ESP_LOGD(TAG, "Value Rejected due to Threshold (Fit: %f, Threshold: %f", _fit, CNNGoodThreshold);
+                            string zw = "Value Rejected due to Threshold (Fit: " + to_string(_fit) + "Threshold: " + to_string(CNNGoodThreshold) + ")";
                             LogFile.WriteToFile(zw);
                         }
                         else

+ 1 - 2
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -493,9 +493,8 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
             {
                 // reboot notwendig damit die neue wlan.ini auch benutzt wird !!!
                 fclose(pfile);
-                ESP_LOGD(TAG, "do reboot");
                 LogFile.SwitchOnOff(true);
-                LogFile.WriteToFile("Reboot to activate new HOSTNAME.");
+                LogFile.WriteToFile("Rebooting to activate new HOSTNAME...");
                 esp_restart();
                 hard_restart();                   
                 doReboot();

+ 0 - 2
code/components/jomjol_flowcontroll/ClassFlowImage.cpp

@@ -47,7 +47,6 @@ string ClassFlowImage::CreateLogFolder(string time) {
 	string logPath = LogImageLocation + "/" + time.LOGFILE_TIME_FORMAT_DATE_EXTR + "/" + time.LOGFILE_TIME_FORMAT_HOUR_EXTR;
     isLogImage = mkdir_r(logPath.c_str(), S_IRWXU) == 0;
     if (!isLogImage) {
-        ESP_LOGW(logTag, "Can't create log folder for analog images. Path %s", logPath.c_str());
         LogFile.WriteToFile("Can't create log folder for analog images. Path " + logPath);
     }
 
@@ -129,7 +128,6 @@ void ClassFlowImage::RemoveOldLogs()
             }
 		}
     }
-    ESP_LOGI(logTag, "%d image folder deleted. %d image folder not deleted.", deleted, notDeleted);
     LogFile.WriteToFile("Image folder deleted: " + std::to_string(deleted) + ". Image folder not deleted: " + std::to_string(notDeleted));	
     closedir(dir);
 }

+ 1 - 2
code/components/jomjol_helper/Helper.cpp

@@ -108,8 +108,7 @@ FILE* OpenFileAndWait(const char* nm, const char* _mode, int _waitsec)
 		TickType_t xDelay;
 		xDelay = _waitsec * 1000 / portTICK_PERIOD_MS;
 		std::string zw = "File is locked: " + std::string(nm) + " - wait for " + std::to_string(_waitsec) + " seconds";
-	    ESP_LOGD(TAG, "%s", zw.c_str());
-		LogFile.WriteToFile(zw);      
+	    LogFile.WriteToFile(zw);
 		vTaskDelay( xDelay );
 		pfile = fopen(nm, _mode);
 	}

+ 0 - 1
code/components/jomjol_logfile/ClassLogFile.cpp

@@ -248,7 +248,6 @@ void ClassLogFile::RemoveOld()
             }
         }
     }
-    ESP_LOGI(TAG, "%d logfiles deleted. %d files not deleted (incl. leer.txt).", deleted, notDeleted);
     LogFile.WriteToFile("logfiles deleted: " + std::to_string(deleted) + " files not deleted (incl. leer.txt): " + std::to_string(notDeleted));	
     closedir(dir);
 

+ 0 - 2
code/components/jomjol_mqtt/interface_mqtt.cpp

@@ -32,7 +32,6 @@ bool MQTTPublish(std::string _key, std::string _content, int retained_flag){
     }
     zw = "MQTT - sent publish successful in MQTTPublish, msg_id=" + std::to_string(msg_id) + ", " + _key + ", " + _content;
     if (debugdetail) LogFile.WriteToFile(zw);
-    ESP_LOGD(TAG_INTERFACEMQTT, "sent publish successful in MQTTPublish, msg_id=%d, %s, %s", msg_id, _key.c_str(), _content.c_str());
     return true;
 }
 
@@ -223,7 +222,6 @@ void MQTTconnected(){
        if (subscribeFunktionMap != NULL) {
             for(std::map<std::string, std::function<bool(std::string, char*, int)>>::iterator it = subscribeFunktionMap->begin(); it != subscribeFunktionMap->end(); ++it) {
                 int msg_id = esp_mqtt_client_subscribe(client, it->first.c_str(), 0);
-                ESP_LOGD(TAG_INTERFACEMQTT, "topic %s subscribe successful, msg_id=%d", it->first.c_str(), msg_id);
                 LogFile.WriteToFile("MQTT - topic " + it->first + " subscribe successful, msg_id=" + std::to_string(msg_id));
             }
         }

+ 0 - 2
code/components/jomjol_tfliteclass/server_tflite.cpp

@@ -718,7 +718,6 @@ void task_autodoFlow(void *pvParameter)
     {
         std::string _zw = "task_autodoFlow - next round - Round #" + std::to_string(++countRounds);
         LogFile.WriteToFile(_zw); 
-        ESP_LOGD(TAGTFLITE, "Autoflow: start");
         fr_start = esp_timer_get_time();
 
         if (flowisrunning)
@@ -747,7 +746,6 @@ void task_autodoFlow(void *pvParameter)
         stream << std::fixed << std::setprecision(1) << cputmp;
         string zwtemp = "CPU Temperature: " + stream.str();
         LogFile.WriteToFile(zwtemp); 
-        ESP_LOGD(TAGTFLITE, "CPU Temperature: %.2f", cputmp);
         fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
         if (auto_intervall > fr_delta_ms)
         {

+ 0 - 1
code/components/jomjol_time_sntp/time_sntp.cpp

@@ -85,7 +85,6 @@ void setTimeZone(std::string _tzstring)
 {
     setenv("TZ", _tzstring.c_str(), 1);
     tzset();    
-    ESP_LOGD(TAG, "TimeZone set to %s", _tzstring.c_str());
     _tzstring = "Time zone set to " + _tzstring;
     LogFile.WriteToFile(_tzstring);
 }

+ 0 - 5
code/main/main.cpp

@@ -212,15 +212,11 @@ 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!!";
-        ESP_LOGD(TAGMAIN, "%s", _zws.c_str());
         LogFile.SwitchOnOff(true);
         LogFile.WriteToFile(_zws);
         LogFile.SwitchOnOff(false);
     } else {
         if (cam != ESP_OK) {
-                ESP_LOGE(TAGMAIN, "Failed to initialize camera module. "
-                    "Check that your camera module is working and connected properly.");
-
                 LogFile.SwitchOnOff(true);
                 LogFile.WriteToFile("Failed to initialize camera module. "
                         "Check that your camera module is working and connected properly.");
@@ -229,7 +225,6 @@ extern "C" void app_main(void)
 // Test Camera            
             camera_fb_t * fb = esp_camera_fb_get();
             if (!fb) {
-                ESP_LOGE(TAGMAIN, "esp_camera_fb_get: Camera Capture Failed");
                 LogFile.SwitchOnOff(true);
                 LogFile.WriteToFile("Camera cannot be initialzed. "
                         "System will reboot.");