Skip to content

Commit

Permalink
Fix velocity/orientation update in units stream
Browse files Browse the repository at this point in the history
  • Loading branch information
rkusa authored and rurounijones committed Jan 8, 2023
1 parent 3aa7f9b commit 9d36dbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fixed velocity and orientation not getting updated in units stream

## [0.7.0] - 2023-01-02

### Fixed
Expand Down
22 changes: 9 additions & 13 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ async fn handle_event(
async fn update_units(state: &mut State) -> Result<(), Error> {
let mut units = std::mem::take(&mut state.units);
// Update all units in parallel (will queue a request for each unit, but the execution will
// still be thottled by the throughputLimit setting).
// still be throttled by the throughputLimit setting).
futures_util::future::try_join_all(
units
.values_mut()
Expand Down Expand Up @@ -316,20 +316,16 @@ impl UnitState {
changed = true;
}
}
if !changed {
if let Some((before, after)) = self.unit.orientation.as_mut().zip(orientation) {
if !orientation_equalish(before, &after) {
*before = after;
changed = true;
}
if let Some((before, after)) = self.unit.orientation.as_mut().zip(orientation) {
if !orientation_equalish(before, &after) {
*before = after;
changed = true;
}
}
if !changed {
if let Some((before, after)) = self.unit.velocity.as_mut().zip(velocity) {
if !velocity_equalish(before, &after) {
*before = after;
changed = true;
}
if let Some((before, after)) = self.unit.velocity.as_mut().zip(velocity) {
if !velocity_equalish(before, &after) {
*before = after;
changed = true;
}
}

Expand Down

0 comments on commit 9d36dbc

Please sign in to comment.