Skip to content

Commit

Permalink
DeerRun S500 Bike Integration (Issue #2932)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Dec 26, 2024
1 parent 268be8e commit c156cbf
Show file tree
Hide file tree
Showing 5 changed files with 604 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/devices/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
// SLOT(inclinationChanged(double)));
eslinkerTreadmill->deviceDiscovered(b);
this->signalBluetoothDeviceConnected(eslinkerTreadmill);
} else if (b.name().toUpper().startsWith(QStringLiteral("PITPAT")) && !deerrunTreadmill && filter) {
} else if (b.name().toUpper().startsWith(QStringLiteral("PITPAT-T")) && !deerrunTreadmill && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
deerrunTreadmill = new deerruntreadmill(this->pollDeviceTime, noConsole, noHeartService);
Expand Down Expand Up @@ -2470,6 +2470,28 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(chronoBike);
} else if (b.name().toUpper().startsWith(QStringLiteral("PITPAT-S")) && !pitpatBike && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
pitpatBike = new pitpatbike(noWriteResistance, noHeartService, bikeResistanceOffset,
bikeResistanceGain);
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
stateFileRead();
#endif
emit deviceConnected(b);
connect(pitpatBike, &bluetoothdevice::connectedAndDiscovered, this, &bluetooth::connectedAndDiscovered);
//connect(pitpatBike, &pitpatbike::debug, this, &bluetooth::debug);
// NOTE: Commented due to #358
// connect(chronoBike, SIGNAL(speedChanged(double)), this, SLOT(speedChanged(double)));
// NOTE: Commented due to #358
// connect(chronoBike, SIGNAL(inclinationChanged(double)), this, SLOT(inclinationChanged(double)));
pitpatBike->deviceDiscovered(b);
// NOTE: Commented due to #358
// connect(this, SIGNAL(searchingStop()), chronoBike, SLOT(searchingStop()));
if (this->discoveryAgent && !this->discoveryAgent->isActive()) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(pitpatBike);
}
}
}
Expand Down Expand Up @@ -3369,6 +3391,11 @@ void bluetooth::restart() {
delete chronoBike;
chronoBike = nullptr;
}
if (pitpatBike) {

delete pitpatBike;
pitpatBike = nullptr;
}
if (snodeBike) {

delete snodeBike;
Expand Down Expand Up @@ -3662,6 +3689,8 @@ bluetoothdevice *bluetooth::device() {
return inspireBike;
} else if (chronoBike) {
return chronoBike;
} else if (pitpatBike) {
return pitpatBike;
} else if (m3iBike) {
return m3iBike;
} else if (snodeBike) {
Expand Down
2 changes: 2 additions & 0 deletions src/devices/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
#include "devices/pafersbike/pafersbike.h"
#include "devices/paferstreadmill/paferstreadmill.h"
#include "devices/pelotonbike/pelotonbike.h"
#include "devices/pitpatbike/pitpatbike.h"
#include "devices/proformbike/proformbike.h"
#include "devices/proformelliptical/proformelliptical.h"
#include "devices/proformellipticaltrainer/proformellipticaltrainer.h"
Expand Down Expand Up @@ -260,6 +261,7 @@ class bluetooth : public QObject, public SignalHandler {
pafersbike *pafersBike = nullptr;
paferstreadmill *pafersTreadmill = nullptr;
tacxneo2 *tacxneo2Bike = nullptr;
pitpatbike *pitpatBike = nullptr;
renphobike *renphoBike = nullptr;
shuaa5treadmill *shuaA5Treadmill = nullptr;
heartratebelt *heartRateBelt = nullptr;
Expand Down
Loading

0 comments on commit c156cbf

Please sign in to comment.