diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..7cf1bc1 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,8 @@ +{ + "MD033": { + "allowed_elements": [ + "summary", + "details" + ] + } +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1e5ae4..a802e9b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,7 @@ repos: rev: v1.61.0 hooks: - id: golangci-lint + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.14.0 + hooks: + - id: markdownlint-cli2 diff --git a/README.md b/README.md index 6eaf576..ea4abcd 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,38 @@ # FDF Console monitor -Expose a First Degree Fitness water rower as BLE (Bluetooth Low Energy) peripheral providing Fitness Machine Service -(FTMS) rower data. +Expose a First Degree Fitness water rower as BLE (Bluetooth Low Energy) +peripheral providing Fitness Machine Service (FTMS) rower data. -Tested with First Degree Fitness NEON plus water rower which comes with the (basic) FDF Console and a serial interface. +Tested with First Degree Fitness NEON plus water rower which comes with the +(basic) FDF Console and a serial interface. ## Usage -Install dependencies and build: +Run: - go mod download +```bash +go run ./cmd/app --name "FDF Rower" --port /dev/ttyUSB0 +``` -Run: +## Advanced usage: building on Linux for running in non-root context + +Build binary on Linux - e.g. for running on Raspberry Pi: + +```bash +CGO_ENABLED=0 go build -a -o fdf-console-monitor ./cmd/app +``` - go run ./cmd/app --name "FDF Rower" --port /dev/ttyUSB0 +Grant only specific capabilities instead of full root access: -Optional: Build binary for Linux and set capability flags: +```bash +sudo setcap 'cap_net_raw,cap_net_admin+eip' ./fdf-console-monitor +``` - CGO_ENABLED=0 go build -a -o fdf-console-monitor ./cmd/app - sudo setcap 'cap_net_raw,cap_net_admin+eip' fdf-console-monitor - ./fdf-console-monitor --name "FDF Rower" --port /dev/ttyUSB0 +Run as non-root: + +```bash +./fdf-console-monitor --name "FDF Rower" --port /dev/ttyUSB0 +``` ## Contribution @@ -31,6 +44,7 @@ Prerequisites for development: ```bash brew install pre-commit commitizen golangci-lint ``` + Set up pre-commit hooks: