Skip to content

Commit 4eafd18

Browse files
knahgalister
authored andcommitted
Fix motoc continue being non-idempotent for non-continuous calibration
1 parent 298d7ba commit 4eafd18

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,19 @@ fn xr_loop(args: Args, monado: mnd::Monado, mut status: MultiProgress) -> anyhow
354354

355355
match last.offset_type {
356356
OffsetType::TrackingOrigin => {
357+
let src_transform = if let Some(src_origin) = data.tracking_origins.iter().find(|x| x.name == last.src) {
358+
src_origin.get_offset()?.into()
359+
} else {
360+
log::warn!("Source origin \"{}\" not found, applying calibration with identity source", last.src);
361+
TransformD::default()
362+
};
363+
357364
for o in data.tracking_origins.iter() {
358365
if o.name != last.dst {
359366
continue;
360367
}
361368

362-
let offset =
363-
last.offset * TransformD::from(o.get_offset()?);
369+
let offset = last.offset * src_transform;
364370
o.set_offset(offset.into())?;
365371
log::info!(
366372
"Offset successfully applied to: {}",

0 commit comments

Comments
 (0)