summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sensor/thermostat.ino10
1 files changed, 9 insertions, 1 deletions
diff --git a/sensor/thermostat.ino b/sensor/thermostat.ino
index e9db767..8c2abb1 100644
--- a/sensor/thermostat.ino
+++ b/sensor/thermostat.ino
@@ -3,6 +3,7 @@
#include "SSD1306.h"
#include "DHTesp.h"
#include "BLEDevice.h"
+#include "GeneralUtils.h"
static BLEUUID thermo_service_uuid("11111111-2222-3333-4444-000000000000");
static BLEUUID thermo_temp_uuid("11111111-2222-3333-4444-000000000001");
@@ -73,7 +74,14 @@ void read_sensor(float* humidity, float* temperature) {
uint32_t send_data_and_get_time(BLEAddress* pAddress,String* data) {
BLEClient* pClient = BLEDevice::createClient();
show("Sc");
- pClient->connect(*pAddress);
+ esp_err_t err;
+ bool ok = pClient->connect(*pAddress,&err);
+ if (!ok) {
+ String status="";
+ status += GeneralUtils::errorToString(err);
+ show(status);
+ return 10;
+ }
String status = "SC";
status += pClient->getPeerAddress().toString().c_str();
show(status);