From 65b649b6baeadff8fe6f8e9371bbfbe3226bf13b Mon Sep 17 00:00:00 2001 From: Anthony Doud Date: Thu, 29 Aug 2024 19:13:36 -0500 Subject: [PATCH] Removed checking for subscriptions before calculating changes. --- CHANGELOG.md | 1 + src/BLE_Cycling_Power_Service.cpp | 4 ++-- src/BLE_Cycling_Speed_Cadence.cpp | 4 ++-- src/BLE_Fitness_Machine_Service.cpp | 4 ++-- src/BLE_Heart_Service.cpp | 4 ++-- src/BLE_Server.cpp | 1 + 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f230894..de79e8e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed bug with stepper speed not updating. - Removed driver temp checking. It's not accurate on the ESP32. - Peloton resistance limit enhancements. +- Continue updating power metrics to other clients if one client disconnects. ### Hardware diff --git a/src/BLE_Cycling_Power_Service.cpp b/src/BLE_Cycling_Power_Service.cpp index ed11451e..63058113 100644 --- a/src/BLE_Cycling_Power_Service.cpp +++ b/src/BLE_Cycling_Power_Service.cpp @@ -24,9 +24,9 @@ void BLE_Cycling_Power_Service::setupService(NimBLEServer *pServer, MyCallbacks } void BLE_Cycling_Power_Service::update() { - if (!spinBLEServer.clientSubscribed.CyclingPowerMeasurement) { + /*if (!spinBLEServer.clientSubscribed.CyclingPowerMeasurement) { return; - } + }*/ int power = rtConfig->watts.getValue(); float cadence = rtConfig->cad.getValue(); diff --git a/src/BLE_Cycling_Speed_Cadence.cpp b/src/BLE_Cycling_Speed_Cadence.cpp index 987d471c..da333ede 100644 --- a/src/BLE_Cycling_Speed_Cadence.cpp +++ b/src/BLE_Cycling_Speed_Cadence.cpp @@ -21,9 +21,9 @@ void BLE_Cycling_Speed_Cadence::setupService(NimBLEServer *pServer, MyCallbacks } void BLE_Cycling_Speed_Cadence::update() { - if (!spinBLEServer.clientSubscribed.CyclingSpeedCadence) { + /*if (!spinBLEServer.clientSubscribed.CyclingSpeedCadence) { return; - } + }*/ CscMeasurement csc; diff --git a/src/BLE_Fitness_Machine_Service.cpp b/src/BLE_Fitness_Machine_Service.cpp index 53daa2dd..687eaf09 100644 --- a/src/BLE_Fitness_Machine_Service.cpp +++ b/src/BLE_Fitness_Machine_Service.cpp @@ -64,9 +64,9 @@ void BLE_Fitness_Machine_Service::setupService(NimBLEServer *pServer, MyCallback void BLE_Fitness_Machine_Service::update() { this->processFTMSWrite(); - if (!spinBLEServer.clientSubscribed.IndoorBikeData) { + /*if (!spinBLEServer.clientSubscribed.IndoorBikeData) { return; - } + }*/ float cadRaw = rtConfig->cad.getValue(); int cad = static_cast(cadRaw * 2); int watts = rtConfig->watts.getValue(); diff --git a/src/BLE_Heart_Service.cpp b/src/BLE_Heart_Service.cpp index ffa2cede..9a7b7372 100644 --- a/src/BLE_Heart_Service.cpp +++ b/src/BLE_Heart_Service.cpp @@ -21,9 +21,9 @@ void BLE_Heart_Service::setupService(NimBLEServer *pServer, MyCallbacks *chrCall } void BLE_Heart_Service::update() { - if (!spinBLEServer.clientSubscribed.Heartrate) { + /*if (!spinBLEServer.clientSubscribed.Heartrate) { return; - } + }*/ byte heartRateMeasurement[2] = {0x00, (byte)rtConfig->hr.getValue()}; heartRateMeasurementCharacteristic->setValue(heartRateMeasurement, 2); heartRateMeasurementCharacteristic->notify(); diff --git a/src/BLE_Server.cpp b/src/BLE_Server.cpp index e83d1d59..8c1d983c 100644 --- a/src/BLE_Server.cpp +++ b/src/BLE_Server.cpp @@ -182,6 +182,7 @@ void MyCallbacks::onSubscribe(NimBLECharacteristic *pCharacteristic, ble_gap_con SS2K_LOG(BLE_SERVER_LOG_TAG, "%s", str.c_str()); } +//This might be worth depreciating. With multiple clients connected (SS2k App, + Training App), it at least needs to be an int, not a bool. void SpinBLEServer::setClientSubscribed(NimBLEUUID pUUID, bool subscribe) { if (pUUID == HEARTCHARACTERISTIC_UUID) { spinBLEServer.clientSubscribed.Heartrate = subscribe;