mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 02:34:29 +05:00
Use USE_BLE flag to enable/disable BLE temp sensors
This commit is contained in:
@@ -58,6 +58,7 @@ extra_scripts =
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-D CORE_DEBUG_LEVEL=0
|
||||
-D USE_BLE=1
|
||||
|
||||
|
||||
; Boards
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
#if defined(ESP32)
|
||||
#if USE_BLE
|
||||
#include <NimBLEDevice.h>
|
||||
|
||||
// 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());
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user