Skip to content

Commit eb0edae

Browse files
authored
Send steering as a single button/state pair (fixes right paddle) (#4871)
1 parent ca1b403 commit eb0edae

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/mywhooshlink.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,13 @@ void MyWhooshLink::sendAction(Action action, bool keyDown) {
444444
}
445445
}
446446

447-
void MyWhooshLink::sendSteering(int value) {
448-
QList<QPair<quint8, quint8>> actions;
449-
actions.append(qMakePair(ButtonSteerLeft, static_cast<quint8>(value < 0 ? 0x01 : 0x00)));
450-
actions.append(qMakePair(ButtonSteerRight, static_cast<quint8>(value > 0 ? 0x01 : 0x00)));
451-
sendButtonStateMessage(actions);
447+
void MyWhooshLink::sendSteering(Action direction, bool keyDown) {
448+
// Send a single button/state pair, exactly like the regular button-mapped
449+
// path does. Packing both steer buttons into one message (SteerLeft first,
450+
// SteerRight second) made right-paddle steering silently do nothing,
451+
// because a right press was encoded as "SteerLeft released, SteerRight
452+
// pressed" and only the leading pair took effect. See qdomyos-zwift#4717.
453+
sendAction(direction, keyDown);
452454
}
453455

454456
void MyWhooshLink::cycleCameraAngle() {
@@ -552,10 +554,10 @@ void MyWhooshLink::handleLeftPower(bool pressed) {
552554
void MyWhooshLink::handleLeftPaddle(int value) {
553555
if (value < 0 && !leftPaddlePressed) {
554556
leftPaddlePressed = true;
555-
sendSteering(-1);
557+
sendSteering(SteerLeft, true);
556558
} else if (value >= 0 && leftPaddlePressed) {
557559
leftPaddlePressed = false;
558-
sendSteering(0);
560+
sendSteering(SteerLeft, false);
559561
}
560562
}
561563

@@ -586,10 +588,10 @@ void MyWhooshLink::handleRightPower(bool pressed) {
586588
void MyWhooshLink::handleRightPaddle(int value) {
587589
if (value > 0 && !rightPaddlePressed) {
588590
rightPaddlePressed = true;
589-
sendSteering(1);
591+
sendSteering(SteerRight, true);
590592
} else if (value <= 0 && rightPaddlePressed) {
591593
rightPaddlePressed = false;
592-
sendSteering(0);
594+
sendSteering(SteerRight, false);
593595
}
594596
}
595597

src/mywhooshlink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private slots:
8686
static MyWhooshLink *s_instance;
8787

8888
void sendAction(Action action, bool keyDown = true);
89-
void sendSteering(int value);
89+
void sendSteering(Action direction, bool keyDown);
9090
void sendButtonStateMessage(const QList<QPair<quint8, quint8>> &actions);
9191
quint8 actionToButtonId(Action action) const;
9292
quint8 actionToButtonState(Action action, bool keyDown) const;

0 commit comments

Comments
 (0)