Browse Source

ENABLE_INFLUXDB c++ macro definition (#1547)

* macro

* 2

* 2

* delete jomjol_mqtt from CMakeLists

* mqtt macro

* final

* ENABLE_INFLUXDB c++ macro definition
Nicolas Liaudat 3 years ago
parent
commit
fd0ac182d2

+ 1 - 0
code/components/jomjol_controlGPIO/server_GPIO.cpp

@@ -705,3 +705,4 @@ GpioHandler* gpio_handler_get()
 {
     return gpioHandler;
 }
+

+ 2 - 1
code/components/jomjol_controlGPIO/server_GPIO.h

@@ -113,4 +113,5 @@ GpioHandler* gpio_handler_get();
 
 
 
-#endif //SERVER_GPIO_H
+#endif //SERVER_GPIO_H
+

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

@@ -56,9 +56,12 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
         _classname = "ClassFlowMQTT";
     }
 #endif //ENABLE_MQTT
+
+#ifdef ENABLE_INFLUXDB
     if ((_stepname.compare("[InfluxDB]") == 0) || (_stepname.compare(";[InfluxDB]") == 0)){
         _classname = "ClassFlowInfluxDB";
     }
+#endif //ENABLE_INFLUXDB
 
     for (int i = 0; i < FlowControll.size(); ++i)
         if (FlowControll[i]->name().compare(_classname) == 0){
@@ -85,8 +88,10 @@ std::string ClassFlowControll::TranslateAktstatus(std::string _input)
     if (_input.compare("ClassFlowMQTT") == 0)
         return ("Sending MQTT");
 #endif //ENABLE_MQTT
+#ifdef ENABLE_INFLUXDB
     if (_input.compare("ClassFlowInfluxDB") == 0)
         return ("Sending InfluxDB");
+#endif //ENABLE_INFLUXDB
     if (_input.compare("ClassFlowPostProcessing") == 0)
         return ("Post-Processing");
     if (_input.compare("ClassFlowWriteList") == 0)
@@ -205,10 +210,10 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
     if (toUpper(_type).compare("[MQTT]") == 0)
         cfc = new ClassFlowMQTT(&FlowControll);
 #endif //ENABLE_MQTT
-
+#ifdef ENABLE_INFLUXDB
     if (toUpper(_type).compare("[INFLUXDB]") == 0)
         cfc = new ClassFlowInfluxDB(&FlowControll);
-        
+#endif //ENABLE_INFLUXDB        
     if (toUpper(_type).compare("[WRITELIST]") == 0)
         cfc = new ClassFlowWriteList(&FlowControll);
 

+ 3 - 1
code/components/jomjol_flowcontroll/ClassFlowControll.h

@@ -13,7 +13,9 @@
 #ifdef ENABLE_MQTT
 	#include "ClassFlowMQTT.h"
 #endif //ENABLE_MQTT
-#include "ClassFlowInfluxDB.h"
+#ifdef ENABLE_INFLUXDB
+	#include "ClassFlowInfluxDB.h"
+#endif //ENABLE_INFLUXDB
 #include "ClassFlowCNNGeneral.h"
 #include "ClassFlowWriteList.h"
 

+ 4 - 0
code/components/jomjol_flowcontroll/ClassFlowInfluxDB.cpp

@@ -1,3 +1,4 @@
+#ifdef ENABLE_INFLUXDB
 #include <sstream>
 #include "ClassFlowInfluxDB.h"
 #include "Helper.h"
@@ -5,6 +6,7 @@
 
 #include "time_sntp.h"
 #include "interface_influxdb.h"
+
 #include "ClassFlowPostProcessing.h"
 #include "esp_log.h"
 
@@ -162,3 +164,5 @@ bool ClassFlowInfluxDB::doFlow(string zwtime)
     
     return true;
 }
+
+#endif //ENABLE_INFLUXDB

+ 2 - 0
code/components/jomjol_flowcontroll/ClassFlowInfluxDB.h

@@ -1,3 +1,4 @@
+#ifdef ENABLE_INFLUXDB
 #pragma once
 #include "ClassFlow.h"
 
@@ -29,3 +30,4 @@ public:
     string name(){return "ClassFlowInfluxDB";};
 };
 
+#endif //ENABLE_INFLUXDB

+ 2 - 1
code/components/jomjol_influxdb/interface_influxdb.cpp

@@ -1,3 +1,4 @@
+#ifdef ENABLE_INFLUXDB
 #include "interface_influxdb.h"
 
 //#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
@@ -111,4 +112,4 @@ void InfluxDBInit(std::string _uri, std::string _database, std::string _measurem
 void InfluxDBdestroy() {
 }
 
-
+#endif //ENABLE_INFLUXDB

+ 2 - 0
code/components/jomjol_influxdb/interface_influxdb.h

@@ -1,3 +1,4 @@
+#ifdef ENABLE_INFLUXDB
 #ifndef INTERFACE_INFLUXDB_H
 #define INTERFACE_INFLUXDB_H
 
@@ -11,3 +12,4 @@ void InfluxDBdestroy();
 void InfluxDBPublish(std::string _key, std::string _content, std::string _timestamp);
 
 #endif //INTERFACE_INFLUXDB_H
+#endif //ENABLE_INFLUXDB

+ 2 - 2
code/platformio.ini

@@ -18,8 +18,8 @@ board = esp32cam
 ;board = m5stack-core-esp32
 framework = espidf
 
-;Add macro definition ENABLE_MQTT
-build_flags = -D ENABLE_MQTT
+;Add macro definition ENABLE_MQTT, ENABLE_INFLUXDB
+build_flags = -D ENABLE_MQTT -D ENABLE_INFLUXDB
 
 ;board_build.partitions = partitions_singleapp.csv
 board_build.partitions = partitions.csv