Skip to content

Commit

Permalink
tdf4 change gears without manual workout #1697
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Oct 12, 2023
1 parent 3686b77 commit 7b1044a
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/proformwifibike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,23 +502,25 @@ void proformwifibike::characteristicChanged(const QString &newValue) {
QJsonValue code = key.value("code");
QJsonValue name = key.value("name");
QJsonValue held = key.value("held");
double value = 0;
if (name.toString().contains(QStringLiteral("LEFT EXTERNAL GEAR DOWN"))) {
qDebug() << "LEFT EXTERNAL GEAR DOWN";
value = -0.5;
} else if (name.toString().contains(QStringLiteral("LEFT EXTERNAL GEAR UP"))) {
qDebug() << "LEFT EXTERNAL GEAR UP";
value = 0.5;
} else if (name.toString().contains(QStringLiteral("RIGHT EXTERNAL GEAR UP"))) {
qDebug() << "RIGHT EXTERNAL GEAR UP";
value = 5.0;
} else if (name.toString().contains(QStringLiteral("RIGHT EXTERNAL GEAR DOWN"))) {
qDebug() << "RIGHT EXTERNAL GEAR DOWN";
value = -5.0;
}
if (value != 0.0) {
forceResistance(currentInclination().value() + value); // to force an immediate change
setGears(gears() + value);
if(held.toString().contains(QStirngLiteral("-1"))) {
double value = 0;
if (name.toString().contains(QStringLiteral("LEFT EXTERNAL GEAR DOWN"))) {
qDebug() << "LEFT EXTERNAL GEAR DOWN";
value = -0.5;
} else if (name.toString().contains(QStringLiteral("LEFT EXTERNAL GEAR UP"))) {
qDebug() << "LEFT EXTERNAL GEAR UP";
value = 0.5;
} else if (name.toString().contains(QStringLiteral("RIGHT EXTERNAL GEAR UP"))) {
qDebug() << "RIGHT EXTERNAL GEAR UP";
value = 5.0;
} else if (name.toString().contains(QStringLiteral("RIGHT EXTERNAL GEAR DOWN"))) {
qDebug() << "RIGHT EXTERNAL GEAR DOWN";
value = -5.0;
}
if (value != 0.0) {
forceResistance(currentInclination().value() + value); // to force an immediate change
setGears(gears() + value);
}
}
}
}
Expand Down

0 comments on commit 7b1044a

Please sign in to comment.