Skip to content

Commit

Permalink
Treadmill and Power Sensor Speed Forcing (Issue #3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Feb 12, 2025
1 parent 47d78f4 commit 219c4e2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/devices/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,8 @@ void bluetooth::connectedAndDiscovered() {
&bluetoothdevice::cadenceSensor);
connect(powerSensorRun, &bluetoothdevice::speedChanged, this->device(),
&bluetoothdevice::speedSensor);
connect(powerSensorRun, &bluetoothdevice::inclinationChanged, this->device(),
&bluetoothdevice::inclinationSensor);
connect(powerSensorRun, &bluetoothdevice::instantaneousStrideLengthChanged, this->device(),
&bluetoothdevice::instantaneousStrideLengthSensor);
connect(powerSensorRun, &bluetoothdevice::groundContactChanged, this->device(),
Expand Down
1 change: 1 addition & 0 deletions src/devices/bluetoothdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ double bluetoothdevice::inclinationDifficultOffset() { return m_inclination_diff
void bluetoothdevice::cadenceSensor(uint8_t cadence) { Q_UNUSED(cadence) }
void bluetoothdevice::powerSensor(uint16_t power) { Q_UNUSED(power) }
void bluetoothdevice::speedSensor(double speed) { Q_UNUSED(speed) }
void bluetoothdevice::inclinationSensor(double grade, double inclination) { Q_UNUSED(grade); Q_UNUSED(inclination) }
void bluetoothdevice::instantaneousStrideLengthSensor(double length) { Q_UNUSED(length); }
void bluetoothdevice::groundContactSensor(double groundContact) { Q_UNUSED(groundContact); }
void bluetoothdevice::verticalOscillationSensor(double verticalOscillation) { Q_UNUSED(verticalOscillation); }
Expand Down
1 change: 1 addition & 0 deletions src/devices/bluetoothdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ class bluetoothdevice : public QObject {
virtual void cadenceSensor(uint8_t cadence);
virtual void powerSensor(uint16_t power);
virtual void speedSensor(double speed);
virtual void inclinationSensor(double grade, double inclination);
virtual void changeResistance(resistance_t res);
virtual void changePower(int32_t power);
virtual void changeInclination(double grade, double percentage);
Expand Down
3 changes: 3 additions & 0 deletions src/devices/strydrunpowersensor/strydrunpowersensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ void strydrunpowersensor::characteristicChanged(const QLowEnergyCharacteristic &
Inclination = treadmillInclinationOverride(inc);
index += 4; // the ramo value is useless
emit debug(QStringLiteral("Current Inclination: ") + QString::number(Inclination.value()));
bool stryd_inclination_instead_treadmill = settings.value(QZSettings::stryd_inclination_instead_treadmill, QZSettings::default_stryd_inclination_instead_treadmill).toBool();
if(stryd_inclination_instead_treadmill)
emit inclinationChanged(Inclination.value(), Inclination.value());
}

if (Flags.elevation) {
Expand Down
5 changes: 5 additions & 0 deletions src/devices/treadmill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ void treadmill::speedSensor(double speed) {
qDebug() << "Current speed: " << speed;
}

void treadmill::inclinationSensor(double grade, double inclination) {
Inclination.setValue(inclination);
qDebug() << "Current Inclination: " << inclination;
}

void treadmill::instantaneousStrideLengthSensor(double length) { InstantaneousStrideLengthCM.setValue(length); }
void treadmill::groundContactSensor(double groundContact) { GroundContactMS.setValue(groundContact); }
void treadmill::verticalOscillationSensor(double verticalOscillation) {
Expand Down
1 change: 1 addition & 0 deletions src/devices/treadmill.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class treadmill : public bluetoothdevice {
void cadenceSensor(uint8_t cadence) override;
void powerSensor(uint16_t power) override;
void speedSensor(double speed) override;
void inclinationSensor(double grade, double inclination) override;
void instantaneousStrideLengthSensor(double length) override;
void groundContactSensor(double groundContact) override;
void verticalOscillationSensor(double verticalOscillation) override;
Expand Down

0 comments on commit 219c4e2

Please sign in to comment.