Skip to content

Commit

Permalink
feat(fws): add instinctive AP disconnect signals
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Jan 9, 2022
1 parent fce8a2f commit 5c69dc6
Show file tree
Hide file tree
Showing 3 changed files with 436 additions and 7 deletions.
98 changes: 94 additions & 4 deletions src/systems/a320_systems/src/flight_warning/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,31 @@ pub(super) trait AltSelectChg {
}

pub(super) trait Ap1Engd {
fn ap1_engd_com(&self) -> DiscreteParameter;
fn ap1_engd_mon(&self) -> DiscreteParameter;
fn ap1_engd_com(&self) -> &DiscreteParameter;
fn ap1_engd_mon(&self) -> &DiscreteParameter;
}

pub(super) trait Ap2Engd {
fn ap2_engd_com(&self) -> DiscreteParameter;
fn ap2_engd_mon(&self) -> DiscreteParameter;
fn ap2_engd_com(&self) -> &DiscreteParameter;
fn ap2_engd_mon(&self) -> &DiscreteParameter;
}

pub(super) trait InstincDiscnct1ApEngd {
/// This signal indicates when the A/P Disconnect button on the Captain's side is pressed
fn instinc_discnct_1ap_engd(&self) -> &DiscreteParameter;
}

pub(super) trait InstincDiscnct2ApEngd {
/// This signal indicates when the A/P Disconnect button on the F/Os side is pressed
fn instinc_discnct_2ap_engd(&self) -> &DiscreteParameter;
}

pub(super) trait CaptMwCancelOn {
fn capt_mw_cancel_on(&self) -> &DiscreteParameter;
}

pub(super) trait FoMwCancelOn {
fn fo_mw_cancel_on(&self) -> &DiscreteParameter;
}

pub(super) trait FakeSignalApTcasEngaged {
Expand Down Expand Up @@ -229,6 +247,14 @@ pub struct A320FWCParameterTable {
eng_1_limit_mode_soft_ga_b: Arinc429Parameter<bool>,
eng_2_limit_mode_soft_ga_a: Arinc429Parameter<bool>,
eng_2_limit_mode_soft_ga_b: Arinc429Parameter<bool>,
ap1_engd_com: DiscreteParameter,
ap1_engd_mon: DiscreteParameter,
ap2_engd_com: DiscreteParameter,
ap2_engd_mon: DiscreteParameter,
instinc_discnct_1ap_engd: DiscreteParameter,
instinc_discnct_2ap_engd: DiscreteParameter,
capt_mw_cancel_on: DiscreteParameter,
fo_mw_cancel_on: DiscreteParameter,
}
impl A320FWCParameterTable {
pub fn new() -> Self {
Expand Down Expand Up @@ -286,6 +312,14 @@ impl A320FWCParameterTable {
eng_1_limit_mode_soft_ga_b: Arinc429Parameter::new_inv(false),
eng_2_limit_mode_soft_ga_a: Arinc429Parameter::new_inv(false),
eng_2_limit_mode_soft_ga_b: Arinc429Parameter::new_inv(false),
ap1_engd_com: DiscreteParameter::new_inv(false),
ap1_engd_mon: DiscreteParameter::new_inv(false),
ap2_engd_com: DiscreteParameter::new_inv(false),
ap2_engd_mon: DiscreteParameter::new_inv(false),
instinc_discnct_1ap_engd: DiscreteParameter::new_inv(false),
instinc_discnct_2ap_engd: DiscreteParameter::new_inv(false),
capt_mw_cancel_on: DiscreteParameter::new_inv(false),
fo_mw_cancel_on: DiscreteParameter::new_inv(false),
}
}

Expand Down Expand Up @@ -399,6 +433,24 @@ impl A320FWCParameterTable {
pub(super) fn set_eng2_channel_b_in_control(&mut self, in_control: Arinc429Parameter<bool>) {
self.eng2_channel_b_in_control = in_control;
}

pub(super) fn set_ap1_engd(&mut self, com: DiscreteParameter, mon: DiscreteParameter) {
self.ap1_engd_com = com;
self.ap1_engd_mon = mon;
}

pub(super) fn set_ap2_engd(&mut self, com: DiscreteParameter, mon: DiscreteParameter) {
self.ap2_engd_com = com;
self.ap2_engd_mon = mon;
}

pub(super) fn set_instinc_discnct_1ap_engd(&mut self, engd: DiscreteParameter) {
self.instinc_discnct_1ap_engd = engd;
}

pub(super) fn set_instinc_discnct_2ap_engd(&mut self, engd: DiscreteParameter) {
self.instinc_discnct_2ap_engd = engd;
}
}
impl FwcIdentSide1 for A320FWCParameterTable {
fn fwc_ident_side1(&self) -> &DiscreteParameter {
Expand Down Expand Up @@ -649,3 +701,41 @@ impl Eng2LimitModeSoftGa for A320FWCParameterTable {
}
}
}
impl Ap1Engd for A320FWCParameterTable {
fn ap1_engd_com(&self) -> &DiscreteParameter {
&self.ap1_engd_com
}

fn ap1_engd_mon(&self) -> &DiscreteParameter {
&self.ap1_engd_mon
}
}
impl Ap2Engd for A320FWCParameterTable {
fn ap2_engd_com(&self) -> &DiscreteParameter {
&self.ap2_engd_com
}

fn ap2_engd_mon(&self) -> &DiscreteParameter {
&self.ap2_engd_mon
}
}
impl InstincDiscnct1ApEngd for A320FWCParameterTable {
fn instinc_discnct_1ap_engd(&self) -> &DiscreteParameter {
&self.instinc_discnct_1ap_engd
}
}
impl InstincDiscnct2ApEngd for A320FWCParameterTable {
fn instinc_discnct_2ap_engd(&self) -> &DiscreteParameter {
&self.instinc_discnct_2ap_engd
}
}
impl CaptMwCancelOn for A320FWCParameterTable {
fn capt_mw_cancel_on(&self) -> &DiscreteParameter {
&self.capt_mw_cancel_on
}
}
impl FoMwCancelOn for A320FWCParameterTable {
fn fo_mw_cancel_on(&self) -> &DiscreteParameter {
&self.fo_mw_cancel_on
}
}
28 changes: 28 additions & 0 deletions src/systems/a320_systems/src/flight_warning/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,34 @@ impl A320FWCParameterTestBed {
self.parameters.set_eng2_tla_b(Arinc429Parameter::new(tla));
self
}

pub fn ap1_engaged(mut self, engaged: bool) -> Self {
self.parameters.set_ap1_engd(
DiscreteParameter::new(engaged),
DiscreteParameter::new(engaged),
);
self
}

pub fn ap2_engaged(mut self, engaged: bool) -> Self {
self.parameters.set_ap2_engd(
DiscreteParameter::new(engaged),
DiscreteParameter::new(engaged),
);
self
}

pub fn instinc_disconnect_1ap_engd(mut self, engaged: bool) -> Self {
self.parameters
.set_instinc_discnct_1ap_engd(DiscreteParameter::new(engaged));
self
}

pub fn instinc_disconnect_2ap_engd(mut self, engaged: bool) -> Self {
self.parameters
.set_instinc_discnct_1ap_engd(DiscreteParameter::new(engaged));
self
}
}

pub fn test_bed() -> A320FWCParameterTestBed {
Expand Down
Loading

0 comments on commit 5c69dc6

Please sign in to comment.