mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 18:54:28 +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 =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-D CORE_DEBUG_LEVEL=0
|
-D CORE_DEBUG_LEVEL=0
|
||||||
|
-D USE_BLE=1
|
||||||
|
|
||||||
|
|
||||||
; Boards
|
; Boards
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <OneWire.h>
|
#include <OneWire.h>
|
||||||
#include <DallasTemperature.h>
|
#include <DallasTemperature.h>
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if USE_BLE
|
||||||
#include <NimBLEDevice.h>
|
#include <NimBLEDevice.h>
|
||||||
|
|
||||||
// BLE services and characterstics that we are interested in
|
// BLE services and characterstics that we are interested in
|
||||||
@@ -37,7 +37,7 @@ protected:
|
|||||||
float filteredIndoorTemp = 0;
|
float filteredIndoorTemp = 0;
|
||||||
bool emptyIndoorTemp = true;
|
bool emptyIndoorTemp = true;
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if USE_BLE
|
||||||
BLEClient* pBleClient = nullptr;
|
BLEClient* pBleClient = nullptr;
|
||||||
BLERemoteService* pBleServiceBattery = nullptr;
|
BLERemoteService* pBleServiceBattery = nullptr;
|
||||||
BLERemoteService* pBleServiceEnvironment = nullptr;
|
BLERemoteService* pBleServiceEnvironment = nullptr;
|
||||||
@@ -64,12 +64,14 @@ protected:
|
|||||||
if (settings.sensors.indoor.type == 2 && settings.sensors.indoor.pin) {
|
if (settings.sensors.indoor.type == 2 && settings.sensors.indoor.pin) {
|
||||||
indoorTemperatureSensor();
|
indoorTemperatureSensor();
|
||||||
}
|
}
|
||||||
#if defined(ESP32)
|
#if USE_BLE
|
||||||
else if (settings.sensors.indoor.type == 3 && strlen(settings.sensors.indoor.bleAddresss)) {
|
else if (settings.sensors.indoor.type == 3 && strlen(settings.sensors.indoor.bleAddresss)) {
|
||||||
bluetoothSensor();
|
bluetoothSensor();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_BLE
|
||||||
void bluetoothSensor() {
|
void bluetoothSensor() {
|
||||||
if (!initBleSensor && millis() > 5000) {
|
if (!initBleSensor && millis() > 5000) {
|
||||||
Log.sinfoln(FPSTR(S_SENSORS_BLE), "Init BLE. Free heap %u bytes", ESP.getFreeHeap());
|
Log.sinfoln(FPSTR(S_SENSORS_BLE), "Init BLE. Free heap %u bytes", ESP.getFreeHeap());
|
||||||
|
|||||||
@@ -34,6 +34,10 @@
|
|||||||
#define USE_TELNET true
|
#define USE_TELNET true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_BLE
|
||||||
|
#define USE_BLE false
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DEBUG_BY_DEFAULT
|
#ifndef DEBUG_BY_DEFAULT
|
||||||
#define DEBUG_BY_DEFAULT false
|
#define DEBUG_BY_DEFAULT false
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user