Skip to content

Commit

Permalink
Merge pull request #571 from doudar/App_FTMS_Disconnect_Fix
Browse files Browse the repository at this point in the history
Removed checking for subscriptions before calculating changes.
  • Loading branch information
doudar authored Aug 30, 2024
2 parents 8564998 + 65b649b commit 0044afd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/BLE_Cycling_Power_Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/BLE_Cycling_Speed_Cadence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/BLE_Fitness_Machine_Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(cadRaw * 2);
int watts = rtConfig->watts.getValue();
Expand Down
4 changes: 2 additions & 2 deletions src/BLE_Heart_Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/BLE_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0044afd

Please sign in to comment.