Skip to content

Commit

Permalink
bmi accel works, better tps with bmi
Browse files Browse the repository at this point in the history
  • Loading branch information
wigwagwent committed Nov 12, 2023
1 parent 9eff429 commit e7db236
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 70 deletions.
104 changes: 52 additions & 52 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# Contributing

Thanks for being interested in contributing to this project! This document describes
what you need to know to get started with the code.


## Installing the dependencies

First, install the `Rust` programming language by following the instructions at
[rustup.rs](https://rustup.rs).

Next, install `libclang`, which is used by the
[`ovr_overlay`](https://crates.io/crates/ovr_overlay) bindings for OpenVR. For windows,
use [this] link. For Linux, simply `sudo apt-get install -y libclang-dev`.

[this]: https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.5/LLVM-14.0.5-win64.exe

You will also need SteamVR installed.

### Steam Deck

If you are building on the steam deck, be sure that you have all the necessary libraries
for native development installed. To get them, follow [these] instructions.

[these]: https://www.reddit.com/r/SteamDeck/comments/t92ozw/for_compiling_c_code/


## Building

`cargo` is the build tool for rust. You can `cargo run` to run the code, `cargo check`
to check if your code compiles, and `cargo test` to run tests. You can also do
`--release` to generate an optimized release mode version. This will take longer to
compile but will run significantly faster.


## Documentation

Documentation is autogenerated by cargo and can be viewed in a web browser with
`cargo doc --all --open --no-deps --document-private-items`. You can run
`cargo doc --help` to learn more about what those flags do. The documentation is also
automatically published to github pages for every commit on the `main` branch [here].

[here]: https://slimevr.github.io/SlimeVR-Overlay/skeletal_model


## Code Style

All code is autoformatted by `cargo fmt`. We suggest turning on autoformatting on save
in your IDE, otherwise you can just run `cargo fmt` on the command line. Also, all files
should end in a newline and have extra whitespace trimmed.

Its also a good idea to run `cargo clippy` to fix the style lints it generates.
# Contributing

Thanks for being interested in contributing to this project! This document describes
what you need to know to get started with the code.


## Installing the dependencies

First, install the `Rust` programming language by following the instructions at
[rustup.rs](https://rustup.rs).

Next, install `libclang`, which is used by the
[`ovr_overlay`](https://crates.io/crates/ovr_overlay) bindings for OpenVR. For windows,
use [this] link. For Linux, simply `sudo apt-get install -y libclang-dev`.

[this]: https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.5/LLVM-14.0.5-win64.exe

You will also need SteamVR installed.

### Steam Deck

If you are building on the steam deck, be sure that you have all the necessary libraries
for native development installed. To get them, follow [these] instructions.

[these]: https://www.reddit.com/r/SteamDeck/comments/t92ozw/for_compiling_c_code/


## Building

`cargo` is the build tool for rust. You can `cargo run` to run the code, `cargo check`
to check if your code compiles, and `cargo test` to run tests. You can also do
`--release` to generate an optimized release mode version. This will take longer to
compile but will run significantly faster.


## Documentation

Documentation is autogenerated by cargo and can be viewed in a web browser with
`cargo doc --all --open --no-deps --document-private-items`. You can run
`cargo doc --help` to learn more about what those flags do. The documentation is also
automatically published to github pages for every commit on the `main` branch [here].

[here]: https://slimevr.github.io/SlimeVR-Overlay/skeletal_model


## Code Style

All code is autoformatted by `cargo fmt`. We suggest turning on autoformatting on save
in your IDE, otherwise you can just run `cargo fmt` on the command line. Also, all files
should end in a newline and have extra whitespace trimmed.

Its also a good idea to run `cargo clippy` to fix the style lints it generates.
32 changes: 16 additions & 16 deletions autoupdater/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Autoupdater

The SlimeVR autoupdater manages updating all the software for SlimeVR on a user's
computer. It does not handle updates of firmware.

It reads a `version.yaml` file from a github release to determine the versions of the
software to download, then fetches them and installs them.

Long term, we may use this to replace most or all of the business logic of the current
[SlimeVR Web Installer](https://github.com/SlimeVR/SlimeVR-Installer).

## Project Status
This is abandoned due to lack of interested developers.

When being actively developed, the Yaml description and serialization was complete
already.
# Autoupdater

The SlimeVR autoupdater manages updating all the software for SlimeVR on a user's
computer. It does not handle updates of firmware.

It reads a `version.yaml` file from a github release to determine the versions of the
software to download, then fetches them and installs them.

Long term, we may use this to replace most or all of the business logic of the current
[SlimeVR Web Installer](https://github.com/SlimeVR/SlimeVR-Installer).

## Project Status
This is abandoned due to lack of interested developers.

When being actively developed, the Yaml description and serialization was complete
already.
4 changes: 2 additions & 2 deletions firmware/src/imu/drivers/bmi160/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ impl AccelFsr {

/// least significant bits per accel
pub const fn lsb_per_accel(self) -> f32 {
self.lsb_per_g() * ACCEL_PER_G
self.lsb_per_g() * G_PER_ACCEL
}

/// g per least significant bit
pub const fn accel_per_lsb(self) -> f32 {
self.g_per_lsb() * G_PER_ACCEL
self.g_per_lsb() * ACCEL_PER_G
}

/// The bmi160 returns the data from the accel as an `i16`, we must use the Full
Expand Down
2 changes: 2 additions & 0 deletions firmware/src/imu/drivers/bmi160/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ impl<I: I2c> Imu for Bmi160<I> {
async fn next_data(&mut self) -> Result<Self::Data, Self::Error> {
// Avoids permablocking async tasks, since we don't do any actual waiting.
yield_now().await;
yield_now().await; //improves tps more
yield_now().await; //50-60 to 70-80

let data = self.driver.data(SensorSelector::new().gyro().accel())?;
let gyro = data.gyro.unwrap();
Expand Down
1 change: 1 addition & 0 deletions firmware/src/imu/fusion/stubbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::imu::{FusedData, Quat, UnfusedData};
/// A fake fuser that just rotates around the x axis.
pub struct Stubbed(Instant);
impl Stubbed {
#[allow(dead_code)]
pub fn new() -> Self {
Self(Instant::now())
}
Expand Down

0 comments on commit e7db236

Please sign in to comment.