Skip to content

Commit

Permalink
peloton resistance update #1877
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Dec 29, 2023
1 parent 76dc3b3 commit 7f6e6e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/nordictrackifitadbbike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ void nordictrackifitadbbike::processPendingDatagrams() {
QHostAddress sender;
QSettings settings;
uint16_t port;
bool freemotion_coachbike_b22_7 = settings.value(QZSettings::freemotion_coachbike_b22_7, QZSettings::default_freemotion_coachbike_b22_7).toBool();
while (socket->hasPendingDatagrams()) {
QByteArray datagram;
datagram.resize(socket->pendingDatagramSize());
Expand Down Expand Up @@ -247,7 +248,10 @@ void nordictrackifitadbbike::processPendingDatagrams() {
QStringList aValues = line.split(" ");
if (aValues.length()) {
resistance = getDouble(aValues.last());
m_pelotonResistance = (100 / 32) * resistance;
if(freemotion_coachbike_b22_7)
m_pelotonResistance = (100 / 24) * resistance;
else
m_pelotonResistance = (100 / 32) * resistance;
qDebug() << QStringLiteral("Current Peloton Resistance: ") << m_pelotonResistance.value()
<< resistance;
if(!gearsAvailable)
Expand Down Expand Up @@ -322,8 +326,7 @@ void nordictrackifitadbbike::processPendingDatagrams() {
if (requestInclination != -100) {
double inc = qRound(requestInclination / 0.5) * 0.5;
if (inc != currentInclination().value()) {
bool proform_studio = settings.value(QZSettings::proform_studio, QZSettings::default_proform_studio).toBool();
bool freemotion_coachbike_b22_7 = settings.value(QZSettings::freemotion_coachbike_b22_7, QZSettings::default_freemotion_coachbike_b22_7).toBool();
bool proform_studio = settings.value(QZSettings::proform_studio, QZSettings::default_proform_studio).toBool();
int x1 = 75;
int y2 = (int)(616.18 - (17.223 * (inc + gears())));
int y1Resistance = (int)(616.18 - (17.223 * currentInclination().value()));
Expand Down Expand Up @@ -351,6 +354,8 @@ void nordictrackifitadbbike::processPendingDatagrams() {
#endif
#endif
// this bike has both inclination and resistance, let's try to handle both
// the Original Poster doesn't want anymore, but maybe it will be useful in the future
/*
if(freemotion_coachbike_b22_7) {
int x1 = 75;
int y2 = (int)(616.18 - (17.223 * (inc + gears())));
Expand All @@ -373,6 +378,7 @@ void nordictrackifitadbbike::processPendingDatagrams() {
#endif
#endif
}
*/
}
}

Expand Down

0 comments on commit 7f6e6e2

Please sign in to comment.