Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kesyog/hangman
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: kesyog/hangman
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 14 commits
  • 52 files changed
  • 2 contributors

Commits on Oct 4, 2023

  1. Fix advertised device name

    The advertising data was missing the
    `BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME` flag, leading it to show up as a
    blank device name in the Tindeq app.
    kesyog committed Oct 4, 2023
    Copy the full SHA
    a870b6a View commit details
  2. Allow device parameters to be overridden via environment variables

    Allow the following parameters to be overridden from their default
    values via environment variables:
    * Advertised name (for advertising and GAP device name)
    * Device id (response to `GetProgressorID` control message)
    * Device version number (response to `GetAppVersion` control message)
    
    This allows unique values to be set without committing them to the
    repository.
    kesyog committed Oct 4, 2023
    Copy the full SHA
    b51eb88 View commit details

Commits on Oct 7, 2023

  1. Remove nagging error message at connection time

    * Provide response to get calibration curve control message. The default
      value can be overridden at compile time via the `CALIBRATION_CURVE`
      environment variable.
    * Add support for device ids up to 8 bytes
    kesyog committed Oct 7, 2023
    Copy the full SHA
    bc4b926 View commit details

Commits on Oct 9, 2023

  1. Copy the full SHA
    ac2d2a8 View commit details

Commits on Oct 13, 2023

  1. Use probe-rs as cargo runner

    probe-run is deprecated in favor of probe-rs. See
    https://ferrous-systems.com/blog/probe-run-deprecation
    kesyog committed Oct 13, 2023
    Copy the full SHA
    e751057 View commit details
  2. Update dependencies and fix new warnings

    Notable changes
    * Updating Embassy was, as usual, a minor pain.
      * Embassy requires a more recent of the nightly compiler.
      * There was a breaking API change to a embassy_sync channel API, but
        luckily it was just a name change.
    * The compiler advised against using async functions in public traits.
    Rather than following the recommended syntax workaround, I took the hint
    and reduced the visibility of the SampleProducer traits, which don't
    need to be public.
    * Remove the fix-hidden-lifetime-bug crate, which is no longer needed as
      of Rust 1.69.
    kesyog committed Oct 13, 2023
    Copy the full SHA
    701532d View commit details

Commits on Jan 23, 2024

  1. Pull Embassy crates from crates.io 🎉

    Embassy published their crates to crates.io so we no longer need to add
    them as git dependencies. This should remove the previously-encountered
    pain of breaking API changes suddenly breaking things.
    
    Also remove the `async_fn_in_trait` nightly feature flag now that it's
    on stable.
    kesyog committed Jan 23, 2024
    Copy the full SHA
    ee6f05c View commit details

Commits on Feb 4, 2024

  1. Update to actions/checkout@v4

    Update GitHub action to remove Node deprecation warning
    kesyog committed Feb 4, 2024
    Copy the full SHA
    3339c51 View commit details

Commits on Jun 1, 2024

  1. Split out utility crate for host unit testing

    Split source code into a hangman crate and a hangman_utils crate. This
    allows for easy host unit testing of the utilities.
    kesyog committed Jun 1, 2024
    Copy the full SHA
    462f674 View commit details
  2. Fix clippy lints

    kesyog committed Jun 1, 2024
    Copy the full SHA
    f704058 View commit details
  3. Add CI via GitHub Actions

    kesyog committed Jun 1, 2024
    Copy the full SHA
    48dc2e1 View commit details

Commits on Jul 6, 2024

  1. Copy the full SHA
    e167211 View commit details
  2. Re-implement broken make_static! macro

    static-cell's `make_static!` macro is broken in latest nightly:
    embassy-rs/static-cell#16
    
    Re-implement it by dropping the automatic type deduction magic.
    kesyog committed Jul 6, 2024
    Copy the full SHA
    d28da13 View commit details
  3. Add Rust Analyzer configurations

    Add Rust Analyzer configurations for Neovim and VS Code. This silences
    some annoying false positive diagnostics.
    
    Using the neovim configuration requires
    [folke/neoconf.nvim](https://github.com/folke/neoconf.nvim).
    kesyog committed Jul 6, 2024
    Copy the full SHA
    2497d0a View commit details
Showing with 929 additions and 452 deletions.
  1. +1 −1 .github/workflows/mdbook.yml
  2. +61 −0 .github/workflows/rust.yml
  3. +1 −1 .gitignore
  4. +11 −0 .neoconf.json
  5. +7 −0 .vscode/settings.json
  6. +0 −50 Cargo.toml
  7. +5 −4 README.md
  8. +5 −4 doc/src/README.md
  9. +8 −2 .cargo/config → hangman/.cargo/config.toml
  10. +265 −193 { → hangman}/Cargo.lock
  11. +51 −0 hangman/Cargo.toml
  12. 0 { → hangman}/Embed.toml
  13. +3 −0 { → hangman}/build.rs
  14. 0 { → hangman}/flash.sh
  15. 0 { → hangman}/memory.x
  16. 0 { → hangman}/src/battery_voltage.rs
  17. 0 { → hangman}/src/bin/README.md
  18. +0 −2 { → hangman}/src/bin/blinky_p0.rs
  19. +0 −2 { → hangman}/src/bin/blinky_p1.rs
  20. +5 −5 { → hangman}/src/bin/calibration_p0.rs
  21. +5 −5 { → hangman}/src/bin/calibration_p1.rs
  22. +6 −6 { → hangman}/src/bin/dongle.rs
  23. +6 −6 { → hangman}/src/bin/proto0_0.rs
  24. +5 −6 { → hangman}/src/bin/proto1_0.rs
  25. +2 −1 { → hangman}/src/ble/advertising.rs
  26. +35 −8 { → hangman}/src/ble/gatt_server.rs
  27. +39 −9 { → hangman}/src/ble/gatt_types.rs
  28. +1 −1 { → hangman}/src/ble/mod.rs
  29. 0 { → hangman}/src/ble/task.rs
  30. +7 −0 { → hangman}/src/button.rs
  31. +11 −9 { → hangman}/src/console/board.rs
  32. 0 { → hangman}/src/console/mod.rs
  33. 0 { → hangman}/src/console/task.rs
  34. +12 −1 { → hangman}/src/lib.rs
  35. +0 −11 { → hangman}/src/nonvolatile.rs
  36. 0 { → hangman}/src/sleep.rs
  37. +35 −0 hangman/src/util.rs
  38. +3 −3 { → hangman}/src/weight/ads1230.rs
  39. 0 { → hangman}/src/weight/average.rs
  40. 0 { → hangman}/src/weight/calibrate.rs
  41. +2 −2 { → hangman}/src/weight/hx711.rs
  42. 0 { → hangman}/src/weight/median.rs
  43. +4 −4 { → hangman}/src/weight/mod.rs
  44. 0 { → hangman}/src/weight/random.rs
  45. 0 { → hangman}/src/weight/tare.rs
  46. +16 −18 { → hangman}/src/weight/task.rs
  47. +159 −0 hangman_utils/Cargo.lock
  48. +8 −0 hangman_utils/Cargo.toml
  49. +6 −17 src/util.rs → hangman_utils/src/lib.rs
  50. +58 −0 hangman_utils/src/log.rs
  51. +86 −0 hangman_utils/src/two_point_cal.rs
  52. +0 −81 src/weight/factory_calibration.rs
2 changes: 1 addition & 1 deletion .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install latest mdbook
61 changes: 61 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Rust

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
device:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
targets: "thumbv7em-none-eabihf"
- name: Build nrf52832
run: cargo build --verbose --release --bin proto1_0 --bin calibration_p1 --bin blinky_p1 --features nrf52832
working-directory: hangman
- name: Build nrf52840
run: cargo build --release --bin proto0_0 --bin calibration_p0 --bin blinky_p0 --bin dongle --features nrf52840 --no-default-features
working-directory: hangman
- name: Clippy nrf52832
run: cargo clippy --bin proto1_0 --bin calibration_p1 --bin blinky_p1 --features nrf52832
working-directory: hangman
- name: Clippy nrf52840
run: cargo clippy --bin proto0_0 --bin calibration_p0 --bin blinky_p0 --bin dongle --features nrf52840 --no-default-features
working-directory: hangman
host:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Build hangman_utils
run: cargo build
working-directory: hangman_utils
- name: Clippy hangman_utils
run: cargo clippy
working-directory: hangman_utils
- name: Test
run: cargo test --verbose
working-directory: hangman_utils
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: rustfmt hangman
run: cargo fmt --check
working-directory: hangman
- name: rustfmt hangman_utils
run: cargo fmt --check
working-directory: hangman_utils
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/target
**/target
/private
*.hex
11 changes: 11 additions & 0 deletions .neoconf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"lspconfig": {
"rust_analyzer": {
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.extraArgs": [
"--target",
"thumbv7m-none-eabihf"
]
}
}
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.extraArgs": [
"--target",
"thumbv7m-none-eabihf"
]
}
50 changes: 0 additions & 50 deletions Cargo.toml

This file was deleted.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
<img src ="boards/proto1_0/assembled.jpg" width="600" alt="Assembled prototype P1.0 unit">
</p>

A Bluetooth-enabled crane scale compatible with the custom [Tindeq Progressor Bluetooth service][API],
which allows it to be used with compatible tools like the Tindeq mobile app.
Hangman is a Bluetooth-enabled crane scale. It's intended use is as a climbing training and rehab
tool, but it can be used anywhere that requires measuring force or weight.

The hardware retrofits a cheap (~$23) 150kg crane scale from Amazon with a custom PCB based around a
Nordic nRF52 microcontroller and a differential ADC. The firmware uses [Embassy][Embassy], an
@@ -20,8 +20,9 @@ help my fingers get stronger.

## Status

The scale is feature-complete. Weight measurement works great with the Tindeq mobile app. Battery
life is guesstimated to be in the range of several months to a couple of years depending on usage.
The scale is feature-complete. Weight measurement works great with the [Progressor API][API] and
compatible tools. Battery life is guesstimated to be in the range of several months to a couple of
years depending on usage.

There are still a few more software updates planned. See the Issues section for the major ones.

9 changes: 5 additions & 4 deletions doc/src/README.md
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
<img src ="assets/assembled.jpg" width="600" alt="Assembled prototype P1.0 unit">
</p>

Hangman is a Bluetooth-enabled crane scale compatible with the custom [Tindeq Progressor Bluetooth service][API],
which allows it to be used with compatible tools like the Tindeq mobile app.
Hangman is a Bluetooth-enabled crane scale. It's intended use is as a climbing training and rehab
tool, but it can be used anywhere that requires measuring force or weight.

The hardware retrofits a cheap (~$23) 150kg crane scale from [Amazon][Amazon scale] with a custom
PCB based around a Nordic nRF52 microcontroller and a differential ADC. The firmware uses [Embassy][Embassy],
@@ -20,8 +20,9 @@ help my fingers get stronger.

## Status

The scale is feature-complete. Weight measurement works great with the Tindeq mobile app. Battery
life is guesstimated to be in the range of several months to a couple of years depending on usage.
The scale is feature-complete. Weight measurement works great with the [Progressor API][API] and
compatible tools. Battery life is guesstimated to be in the range of several months to a couple of
years depending on usage.

## Disclaimer

10 changes: 8 additions & 2 deletions .cargo/config → hangman/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -5,15 +5,21 @@ rustflags = [
"-C", "link-arg=-Tdefmt.x",
]
# seems to also work with nRF52840
runner = "probe-run --chip nRF52832_xxAA"
runner = "probe-rs run --chip nRF52832_xxAA"

[target.thumbv7em-none-eabihf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x",
]
# seems to also work with nRF52840
runner = "probe-run --chip nRF52832_xxAA"
runner = "probe-rs run --chip nRF52832_xxAA"

[build]
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

[env]
ADVERTISED_NAME = "Progressor_1234"
DEVICE_ID = "42"
DEVICE_VERSION_NUMBER = "1.2.3.4"
CALIBRATION_CURVE = "FFFFFFFFFFFFFFFF00000000"
Loading