diff --git a/platformio.ini b/platformio.ini index 92aebdf..ed77281 100644 --- a/platformio.ini +++ b/platformio.ini @@ -58,6 +58,7 @@ extra_scripts = build_flags = ${env.build_flags} -D CORE_DEBUG_LEVEL=0 + -D USE_BLE=1 ; Boards diff --git a/src/SensorsTask.h b/src/SensorsTask.h index 45323a3..8634f58 100644 --- a/src/SensorsTask.h +++ b/src/SensorsTask.h @@ -1,7 +1,7 @@ #include #include -#if defined(ESP32) +#if USE_BLE #include // BLE services and characterstics that we are interested in @@ -37,7 +37,7 @@ protected: float filteredIndoorTemp = 0; bool emptyIndoorTemp = true; -#if defined(ESP32) +#if USE_BLE BLEClient* pBleClient = nullptr; BLERemoteService* pBleServiceBattery = nullptr; BLERemoteService* pBleServiceEnvironment = nullptr; @@ -64,12 +64,14 @@ protected: if (settings.sensors.indoor.type == 2 && settings.sensors.indoor.pin) { indoorTemperatureSensor(); } -#if defined(ESP32) +#if USE_BLE else if (settings.sensors.indoor.type == 3 && strlen(settings.sensors.indoor.bleAddresss)) { bluetoothSensor(); } +#endif } +#if USE_BLE void bluetoothSensor() { if (!initBleSensor && millis() > 5000) { Log.sinfoln(FPSTR(S_SENSORS_BLE), "Init BLE. Free heap %u bytes", ESP.getFreeHeap()); diff --git a/src/defines.h b/src/defines.h index dd9767c..fad1f58 100644 --- a/src/defines.h +++ b/src/defines.h @@ -34,6 +34,10 @@ #define USE_TELNET true #endif +#ifndef USE_BLE + #define USE_BLE false +#endif + #ifndef DEBUG_BY_DEFAULT #define DEBUG_BY_DEFAULT false #endif