Skip to content

Commit

Permalink
fix: review feedback
Browse files Browse the repository at this point in the history
Co-authored-by: David Walschots <[email protected]>
  • Loading branch information
tracernz and davidwalschots committed Dec 22, 2022
1 parent 22212d6 commit 1e22a04
Showing 1 changed file with 13 additions and 36 deletions.
49 changes: 13 additions & 36 deletions src/systems/systems/src/navigation/adirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1e22a04

Please sign in to comment.