From 1e22a0492fa14b771ddf64a7dc7da9407804710f Mon Sep 17 00:00:00 2001 From: Michael Corcoran Date: Thu, 22 Dec 2022 23:02:48 +1300 Subject: [PATCH] fix: review feedback Co-authored-by: David Walschots --- src/systems/systems/src/navigation/adirs.rs | 49 ++++++--------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/src/systems/systems/src/navigation/adirs.rs b/src/systems/systems/src/navigation/adirs.rs index 10cc9b3e8c4..f0891e85009 100644 --- a/src/systems/systems/src/navigation/adirs.rs +++ b/src/systems/systems/src/navigation/adirs.rs @@ -1489,41 +1489,19 @@ impl InertialReference { maint_word |= IrMaintFlags::EXTREME_LATITUDE; } - if self.is_aligning() { - if self - .remaining_align_duration() - .map_or(false, |duration| duration.as_secs() <= 60) - { - maint_word |= IrMaintFlags::ALIGN_1_MINUTES; - } else if self - .remaining_align_duration() - .map_or(false, |duration| duration.as_secs() <= 120) - { - maint_word |= IrMaintFlags::ALIGN_2_MINUTES; - } else if self - .remaining_align_duration() - .map_or(false, |duration| duration.as_secs() <= 180) - { - maint_word |= IrMaintFlags::ALIGN_3_MINUTES; - } else if self - .remaining_align_duration() - .map_or(false, |duration| duration.as_secs() <= 240) - { - maint_word |= IrMaintFlags::ALIGN_4_MINUTES; - } else if self - .remaining_align_duration() - .map_or(false, |duration| duration.as_secs() <= 300) - { - maint_word |= IrMaintFlags::ALIGN_5_MINUTES; - } else if self - .remaining_align_duration() - .map_or(false, |duration| duration.as_secs() <= 360) - { - maint_word |= IrMaintFlags::ALIGN_6_MINUTES; - } else { - maint_word |= IrMaintFlags::ALIGN_7_10_MINUTES; - } - } + maint_word |= match self + .remaining_align_duration() + .map(|duration| duration.as_secs()) + { + Some(1..=60) => IrMaintFlags::ALIGN_1_MINUTES, + Some(61..=120) => IrMaintFlags::ALIGN_2_MINUTES, + Some(121..=180) => IrMaintFlags::ALIGN_3_MINUTES, + Some(181..=240) => IrMaintFlags::ALIGN_4_MINUTES, + Some(241..=300) => IrMaintFlags::ALIGN_5_MINUTES, + Some(301..=360) => IrMaintFlags::ALIGN_6_MINUTES, + Some(361..) => IrMaintFlags::ALIGN_7_10_MINUTES, + Some(0) | None => IrMaintFlags::default(), + }; // TODO sin/cos test discrepancy @@ -2318,7 +2296,6 @@ mod tests { fn assert_ir_heading_data_available(&mut self, available: bool, adiru_number: usize) { assert_eq!(self.heading(adiru_number).is_normal_operation(), available); - // assert_eq!(self.true_heading(adiru_number).is_normal_operation(), available); } fn assert_ir_non_attitude_data_available(&mut self, available: bool, adiru_number: usize) {