Skip to content

Commit

Permalink
fixing renpho bike resistance on zwift
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed May 24, 2022
1 parent d3df427 commit 3cf1c54
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ ApplicationWindow {
}

ItemDelegate {
text: "version 2.10.88"
text: "version 2.10.89"
width: parent.width
}
FileDialog {
Expand Down
2 changes: 1 addition & 1 deletion src/qdomyos-zwift.pro
Original file line number Diff line number Diff line change
Expand Up @@ -691,4 +691,4 @@ win32: QMAKE_CXXFLAGS_RELEASE -= -O2

WINRT_MANIFEST = AppxManifest.xml

VERSION = 2.10.88
VERSION = 2.10.89
35 changes: 20 additions & 15 deletions src/renphobike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,26 @@ void renphobike::update() {
requestPower = -1;
requestResistance = -1;
}
if (requestResistance != -1) {
if (requestResistance > max_resistance)
requestResistance = max_resistance;
else if (requestResistance == 0)
requestResistance = 1;

lastRequestResistance = lastRawRequestedResistanceValue;
debug("writing resistance " + QString::number(requestResistance));
forceResistance(requestResistance);

requestResistance = -1;
} else if (lastRequestResistance != -1) {
int8_t r = lastRequestResistance * m_difficult + gears();
debug("writing resistance for renpho forever " + QString::number(r));
forceResistance(r);
// if zwift is connected we have to avoud to send resistance to the bike
if ((virtualBike && !virtualBike->ftmsDeviceConnected()) || !virtualBike) {
if (requestResistance != -1) {
if (requestResistance > max_resistance)
requestResistance = max_resistance;
else if (requestResistance == 0)
requestResistance = 1;

lastRequestResistance = lastRawRequestedResistanceValue;
debug("writing resistance " + QString::number(requestResistance));
forceResistance(requestResistance);

requestResistance = -1;
} else if (lastRequestResistance != -1) {
int8_t r = lastRequestResistance * m_difficult + gears();
debug("writing resistance for renpho forever " + QString::number(r));
forceResistance(r);
}
} else if (requestResistance != -1 || lastRequestResistance != -1) {
qDebug() << QStringLiteral("ignoring resistance because ftmsDeviceConnected is connected");
}
}
if (requestStart != -1) {
Expand Down

0 comments on commit 3cf1c54

Please sign in to comment.