Commit Graph
35 Commits
Author SHA1 Message Date
erik 7ee776ba1a slightly more accurate computation of the time of the last full
revolution by using the average RPM over the last interval instead of
using the last RPM.
2026-06-07 23:24:19 +02:00
erik b8a9abcd2a removed executable 2026-06-06 20:35:26 +02:00
erik de9ab0ca51 Set Cycling Power Feature characteristic to advertise Cumulative Torque and Power Output 2026-06-06 18:35:00 +00:00
erik 13ea215996 more stable computation of lastRevtime
Only computing lastRevtime when we have made a new full rev.
This leads to more consistency in RPMs, especially when accelerating or
decellerating.
2026-06-06 16:58:26 +02:00
erik 7644ab2e4d Now using the original time that the event was received instead of when
it is processed by bluetooth.
2026-06-05 18:35:17 +02:00
erik 87ba3cdba7 Preventing laptop from going to sleep while the hridge is running. 2026-06-05 18:34:56 +02:00
erik 7f52f0ff68 feat: make --device flag optional with 'any' default
When --device is omitted or set to 0, the bridge listens to all
broadcasting ANT+ trainers instead of filtering by a specific device.
The actual transmitting device ID is shown in data logs, allowing
users to discover and then filter specific trainers.

Also fix vendorID/productID not being assigned to config struct
which caused ListenForTrainer to receive 0 for both values.
2026-05-26 23:06:05 +00:00
erik 19e4e78c75 feat: add protocol prefixes to log messages
Prefix log output with 'ant:', 'bt:', or 'usb:' to distinguish
between ANT+, Bluetooth LE, and USB device messages.
2026-05-26 22:45:43 +00:00
erik 6bb59b845c removed obsolete setup.md 2026-05-27 00:38:24 +02:00
erik 85f0925eb5 removed out 2026-05-27 00:36:06 +02:00
erik d0a4c83955 added gitignore. 2026-05-27 00:36:06 +02:00
erik d269174c7b removed openspec files, these were not used anyway. 2026-05-27 00:36:06 +02:00
erik ed18bd8ca9 added testing with other devices (e.g. Garmin) 2026-05-27 00:36:06 +02:00
erik e5ddaa535d mentioned: tested on debian 13 2026-05-27 00:36:06 +02:00
erik cd7c81a37c some minor doc updates. 2026-05-27 00:36:06 +02:00
erik 370b22bb02 improving the docs. 2026-05-27 00:36:06 +02:00
erik 497913b97c removed bridge executable. 2026-05-27 00:36:06 +02:00
erik 72987c5935 refactor: replace magic hex constants with named constants
- Add BLE spec constants for service/characteristic UUIDs and signal flag
- Add ANT+ spec constants for data page mask and cycling power page
- Add descriptive comments explaining each constant's origin and purpose
2026-05-27 00:36:06 +02:00
erik 443a88e0f1 logging when BLE stops. 2026-05-27 00:36:06 +02:00
erik 4949beae3e fix: synchronize logs, buffer events channel, exit on goroutine failure
- Add mutex to prevent interleaved log output from concurrent goroutines
- Make logMsg delegate to logPrintf for consistent synchronization
- Buffer events channel to size 1 with select/drop when full
- Close events channel on ListenForTrainer exit so process terminates
2026-05-27 00:36:06 +02:00
erik 091067593b refactor: remove init() and package-level rootCmd, add error logging
- Move flag registration from init() to main()
- Make rootCmd a local variable in main() instead of a package variable
- Log errors from hciconfig down/up reset commands
- Log errors from BLE power characteristic writes
2026-05-27 00:36:06 +02:00
erik d646243a9c updated README 2026-05-27 00:36:06 +02:00
erik 179f8174e4 removed unnecessary download. 2026-05-27 00:36:06 +02:00
erik e99348c66d no more init() and package level config. 2026-05-27 00:36:06 +02:00
erik ed4f75a93d docs: add README with setup instructions and tested hardware
Add comprehensive README.md covering project purpose, CLI usage,
and troubleshooting. Document the udev rule needed to prevent
usbserial from claiming the ANT+ dongle.

Add Tested hardware section listing the ANT USBStick2 and update
setup.md dmesg output accordingly.

Note: the bridge must be run as root to access the USB dongle.
2026-05-27 00:36:06 +02:00
erik b24513fcc3 feat: add CLI with Cobra and timestamped logging
Introduce structured CLI argument parsing using Cobra with three
configurable flags:
  --vendor: USB vendor ID (default: 0x0fcf)
  --product: USB product ID (default: 0x1008)
  --device: ANT+ device number (default: 3001)

Add timestamped logging for all log statements with format
YYYY-MM-DD HH:MM:SS. Log vendor, product, and device values at
startup in both hex and decimal.

Remove hardcoded USB identifiers from main.go and consolidate all
startup logic into cli.go with a dedicated Config struct.

Update ant.go ListenForTrainer signature to accept uint16 for
vendor and product IDs.
2026-05-27 00:36:06 +02:00
erik 39b5a95eb4 logging with date time format. 2026-05-27 00:36:06 +02:00
erik 29d7dc1632 Fully functional ant+ to bluetooth bridge. 2026-05-27 00:36:06 +02:00
erik eb6fdd6b16 moved bluetooth function over to separate file 2026-05-27 00:36:06 +02:00
erik 10d8f6bb97 improved bluetooth loop 2026-05-27 00:36:06 +02:00
erik b5b3610b70 bluetooth with fake data. 2026-05-27 00:36:06 +02:00
erik 0a48932baa seprating the ant+ code out. 2026-05-27 00:36:06 +02:00
erik e9dd5bbc99 a bit more robust. 2026-05-27 00:36:06 +02:00
erik 2bbca6f082 initial version. 2026-05-27 00:36:06 +02:00
erik c37fde8cf6 Initial commit 2026-05-25 11:00:13 +02:00