Skip to content

Commit

Permalink
Domyos EL 520 auto resistance #1252
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Feb 8, 2023
1 parent 8ec7608 commit 77ebbe7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/characteristicwriteprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ void CharacteristicWriteProcessor::changeSlope(int16_t iresistance, uint8_t crr,
emit changeInclination(((iresistance / 100.0) * gain) + offset,
((qTan(qDegreesToRadians(iresistance / 100.0)) * 100.0) * gain) + offset);
} else if (dt == bluetoothdevice::ELLIPTICAL) {
bool inclinationAvailableByHardware = ((elliptical *)Bike)->inclinationAvailableByHardware();
qDebug() << "inclinationAvailableByHardware" << inclinationAvailableByHardware << "erg_mode" << erg_mode;
emit changeInclination(((iresistance / 100.0) * gain) + offset,
((qTan(qDegreesToRadians(iresistance / 100.0)) * 100.0) * gain) + offset);

if (!((elliptical *)Bike)->inclinationAvailableByHardware()) {
if (!inclinationAvailableByHardware) {
if (force_resistance && !erg_mode) {
// same on the training program
Bike->changeResistance((resistance_t)(round(resistance * bikeResistanceGain)) + bikeResistanceOffset +
((elliptical *)Bike)->changeResistance((resistance_t)(round(resistance * bikeResistanceGain)) + bikeResistanceOffset +
1 + CRR_offset + CW_offset); // resistance start from 1
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/domyoselliptical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void domyoselliptical::update() {
forceResistance(requestResistance);
}
requestResistance = -1;
} else if (requestInclination != -100) {
} else if (requestInclination != -100 && inclinationAvailableByHardware()) {
if (requestInclination > 15) {
requestInclination = 15;
} else if (requestInclination == 0) {
Expand Down

0 comments on commit 77ebbe7

Please sign in to comment.