Add Freebeat Fit bike support via internal UART - #4825
Merged
Conversation
- New FreebeatUSB QThread: opens /dev/ttyS4 at 9600 baud 8N1 (internal UART), handles binary protocol decoded from APK reverse engineering: - 5-byte commands [startCode, action, data, checksum, 0xA0] - 13-byte telemetry packets with speed, RPM and resistance - LED heartbeat to keep bike awake - New freebeatbike device class extending bike, with virtual bike support - New QZSettings::freebeat_serialport setting - QML accordion "Freebeat Bike Options" with serial port field - Wired into bluetooth.cpp instantiation, destructor and device getter - Added to qdomyos-zwift.pri and settings-catalog.json Fixes #4822 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…OTOCOL.md The Freebeat bike uses an internal UART (/dev/ttyS4), not a USB-CDC/FTDI adapter, so Usbserial.java was wrong. Now FreebeatUSB opens the port with POSIX open() + termios on all platforms (Android included), preceded by chmod 777 on Android (same technique as DCUARTDriver in the original APK). Removed QAndroidJniObject / rxBuffer since they are no longer needed. Also add PROTOCOL.md documenting the full binary protocol reverse-engineered from the APK (packet layout, command table, checksum, power formula). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Try open() first; if EACCES, escalate via 'su -c chmod 666' — same logic as DCUARTDriver in the original APK. Use QProcess instead of system() for proper logging and Qt integration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ike-support # Conflicts: # src/homeform.h # src/settings-catalog.json # src/settings.qml
The array bound was hardcoded at 1000 entries; merging master's new settings (e.g. waterrower_usb) pushed the total past that cap, causing a "too many initializers" build error.
Keeps this branch's own setting addition last, after master's waterrower_usb, matching the convention of appending new settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/dev/ttyS4(9600 baud 8N1), routed through QZ's existingUsbserial.javaUSB serial abstraction on Android and nativetermioson Linux/Mac/dev/ttyS4, baud 9600, binary framing with sync bytes and checksum)Changes
src/devices/freebeatbike/FreebeatUSB.h/.cpp— newQThreadsubclass implementing the binary protocol:[startCode, action, data, (action+data)&0xFF, 0xA0]src/devices/freebeatbike/freebeatbike.h/.cpp— new device class extendingbike, withvirtualbike,QTimerat 200ms, ERG mode viaresistanceFromPowerRequest()src/qzsettings.h/.cpp— newfreebeat_serialportsetting;allSettingsCountincremented to 1000src/settings.qml— newproperty string freebeat_serialport(added last per CLAUDE.md) and "Freebeat Bike Options" accordion with serial port fieldsrc/devices/bluetooth.h/.cpp— readsfreebeatSerialPortsetting, instantiatesfreebeatbikewhen non-empty, destructor cleanup, device gettersrc/qdomyos-zwift.pri— added 4 new source/header filessrc/settings-catalog.json— addedfreebeat_serialportentry,settingCountincremented to 964Test plan
/dev/ttyS4on the bike's Android tablet, or a USB serial path on other platforms)freebeatbikeand startFreebeatUSBthreadCloses #4822
🤖 Generated with Claude Code