Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qnh override #92

Merged
merged 29 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e7b0f5e
Merge pull request #2 from talbotmcinnis/InformationOverride
talbotmcinnis Oct 28, 2020
fbccaf7
Added ACTIVE runway override
talbotmcinnis Dec 17, 2020
e980582
Moved rwy_override into a better location
talbotmcinnis Dec 17, 2020
4bcfdcc
Readme updates for ACTIVE RUWNAY OVERRIDE
talbotmcinnis Dec 17, 2020
21571eb
Style fixes
talbotmcinnis Dec 17, 2020
873c75e
First kinda working refactoring, but need to support TRAFFIC frequenc…
talbotmcinnis Dec 21, 2020
bc61ae7
Added back in support for traffic on separate line; Passes unit tests
talbotmcinnis Dec 21, 2020
7b92637
Fix type in unit test test_complete_garbge
talbotmcinnis Dec 21, 2020
19a87ee
Formatting
talbotmcinnis Dec 21, 2020
6fce318
Added a unit test for advanced options in the briefing
talbotmcinnis Dec 21, 2020
b8a0569
Fix funciton name and a build error
talbotmcinnis Jan 2, 2021
7e23b52
Ensure properties from the breifing text are passed to ATIS stations
talbotmcinnis Jan 2, 2021
6925762
Fix type in a comment
talbotmcinnis Jan 2, 2021
f63136a
Merge branch 'AllowParametersInAnyOrder'
talbotmcinnis Jan 7, 2021
dea5136
Merge pull request #3 from talbotmcinnis/AllowOptionsInBriefingTxt
talbotmcinnis Jan 16, 2021
2e30664
Merge remote-tracking branch 'upstream/master'
talbotmcinnis Jan 16, 2021
d82a073
Merge remote-tracking branch 'upstream/master'
talbotmcinnis Feb 10, 2021
1efdb39
Merge remote-tracking branch 'upstream/master'
talbotmcinnis Apr 22, 2021
0f351a7
First buildable with qnh override
talbotmcinnis Apr 22, 2021
25477a3
Added NO HPA and NO QFE options
talbotmcinnis Apr 24, 2021
6bf5243
Included example of NO QFE
talbotmcinnis Apr 24, 2021
9430e41
Removed QNH Override
talbotmcinnis May 4, 2021
80519d3
Make option key and some values case-insensitive
talbotmcinnis May 4, 2021
ed6cd7f
Fix change I didn't mean to make. Auto fmt?
talbotmcinnis May 4, 2021
71300aa
Fix old QNH ref in readme
talbotmcinnis May 4, 2021
0f0a0e8
Merge branch 'master' of https://github.com/rkusa/DATIS
talbotmcinnis May 4, 2021
79e38d6
Merge branch 'master' into QnhOverride
talbotmcinnis May 4, 2021
28267a5
Fix automerge gone-wrong
talbotmcinnis May 4, 2021
4ae700b
Fix unit tests broken during merge
talbotmcinnis May 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ Available settings:
- Google Gloud (`GC:{VOICE NAME}`): For available voices see https://cloud.google.com/text-to-speech/docs/voices. Use the name from the `Voice name` column. All voices starting with `en-` are supported. Keep in mind that `en-US-Wavenet-*` voices come with a smaller free quota, see [Gcloud TTS pricing](https://cloud.google.com/text-to-speech/pricing).
- AWS (`AWS:{VOICE NAME}`): For available voices see https://docs.aws.amazon.com/polly/latest/dg/voicelist.html. Use the name from the `Name/ID` column (without `*` prefixes). All English voices are supported.
- Azure (`AZURE:{VOICE NAME}`): For available voices see https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#standard-voices. Use the name from the `Voice name` column. All `en-US` voices are supported.
- `TRAFFIC {FREQUENCY}`: An optional traffic frequency that, if provided, is mentioned as part of the ATIS report.
- `OVERRIDE {INFO LETTER}`: Allows you to override the dynamic rotating selection of the ATIS information letter if your mission requires a specific and constant value.
- `ACTIVE {RUNWAY OVERRIDE}`: Can be used if the SPINS for the airfield differ from the prevailing winds and you want to override the calculated active runway.
- `TRAFFIC {FREQUENCY}`: An optional traffic frequency that, if provided, is mentioned as part of the ATIS report.
- `OVERRIDE {INFO LETTER}`: Allows you to override the dynamic rotating selection of the ATIS information letter if your mission requires a specific and constant value.
- `ACTIVE {RUNWAY OVERRIDE}`: Can be used if the SPINS for the airfield differ from the prevailing winds and you want to override the calculated active runway.
- `NO HPA`: Disable adding pressures in hectopascals to the remarks section..
- `NO QFE`: Disable inclusion of QFE in the remarks section.


Examples:

Expand All @@ -81,7 +84,7 @@ ATIS Kutaisi 251.000, TRAFFIC 252.000, VOICE en-US-Standard-E
ATIS Kutaisi 251.000, TRAFFIC 252.000, VOICE GC:en-US-Wavenet-B
ATIS Kutaisi 251.000, TRAFFIC 252.000, VOICE AWS:Nicole
ATIS Kutaisi 251.000, TRAFFIC 252.000, VOICE WIN
ATIS Kutaisi 251.000, TRAFFIC 252.000, INFO Q, ACTIVE 21L
ATIS Kutaisi 251.000, TRAFFIC 252.000, INFO Q, ACTIVE 21L, NO QFE, NO HPA
```

![Example](./docs/static.jpg)
Expand Down
2 changes: 2 additions & 0 deletions crates/datis-cmd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
info_ltr_offset: 0,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
}),
ipc: MissionInterface::Static,
};
Expand Down
122 changes: 121 additions & 1 deletion crates/datis-core/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub struct StationConfig {
pub tts: Option<TextToSpeechProvider>,
pub info_ltr_override: Option<char>,
pub active_rwy_override: Option<String>,
pub no_hpa: bool,
pub no_qfe: bool,
}

pub fn extract_station_config_from_mission_description(
Expand Down Expand Up @@ -61,14 +63,16 @@ pub fn extract_atis_station_config(config: &str) -> Option<StationConfig> {
let mut tts: Option<TextToSpeechProvider> = None;
let mut info_ltr_override = None;
let mut active_rwy_override = None;
let mut no_hpa = false;
let mut no_qfe = false;

for (option_key, option_value) in options.split(',').filter_map(|t| {
let t = t.trim();
t.find(' ')
.map(|p| t.split_at(p))
.map(|(k, v)| (k, &v[1..]))
}) {
match option_key {
match option_key.to_uppercase().as_str() {
"TRAFFIC" => {
if let Ok(traffic_freq_hz) = option_value.parse::<f64>() {
traffic_freq = Some((traffic_freq_hz * 1_000_000.0) as u64);
Expand All @@ -92,6 +96,17 @@ pub fn extract_atis_station_config(config: &str) -> Option<StationConfig> {
"ACTIVE" => {
active_rwy_override = Some(option_value.to_string());
}
"NO" => match option_value.to_uppercase().as_str() {
"HPA" => {
no_hpa = true;
}
"QFE" => {
no_qfe = true;
}
_ => {
log::warn!("Unsupported ATIS NO option {}", option_value);
}
}
_ => {
log::warn!("Unsupported ATIS station option {}", option_key);
}
Expand All @@ -105,6 +120,8 @@ pub fn extract_atis_station_config(config: &str) -> Option<StationConfig> {
tts,
info_ltr_override,
active_rwy_override,
no_hpa,
no_qfe,
};

Some(result)
Expand Down Expand Up @@ -155,6 +172,8 @@ pub fn extract_carrier_station_config(config: &str) -> Option<StationConfig> {
tts,
info_ltr_override,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
};

Some(result)
Expand Down Expand Up @@ -287,6 +306,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
}
),
(
Expand All @@ -298,6 +319,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
}
),
(
Expand All @@ -309,6 +332,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
}
)
]
Expand Down Expand Up @@ -339,6 +364,8 @@ mod test {
tts: None,
info_ltr_override: Some('T'),
active_rwy_override: Some("12".to_string()),
no_hpa: false,
no_qfe: false,
}
)]
.into_iter()
Expand All @@ -357,6 +384,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -369,6 +398,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -381,6 +412,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -393,6 +426,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -409,6 +444,8 @@ mod test {
}),
info_ltr_override: Some('Q'),
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -425,6 +462,8 @@ mod test {
}),
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -439,6 +478,8 @@ mod test {
}),
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -451,6 +492,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -464,6 +507,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -477,6 +522,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);
}
Expand All @@ -492,6 +539,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -504,6 +553,8 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -518,6 +569,8 @@ mod test {
}),
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);
}
Expand All @@ -535,6 +588,8 @@ mod test {
}),
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);

Expand All @@ -549,6 +604,8 @@ mod test {
}),
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);
}
Expand All @@ -569,6 +626,8 @@ mod test {
}),
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: false,
})
);
}
Expand Down Expand Up @@ -607,6 +666,67 @@ mod test {
tts: None,
info_ltr_override: None,
active_rwy_override: Some("21L".to_string()),
no_hpa: false,
no_qfe: false,
})
);
}

#[test]
fn test_supression_flags() {
assert_eq!(
extract_atis_station_config("ATIS Kutaisi 131.400, NO HPA, NO QFE"),
Some(StationConfig {
name: "Kutaisi".to_string(),
atis: 131_400_000,
traffic: None,
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: true,
no_qfe: true,
})
);

assert_eq!(
extract_atis_station_config("ATIS Kutaisi 131.400, no hpa, no qfe"),
Some(StationConfig {
name: "Kutaisi".to_string(),
atis: 131_400_000,
traffic: None,
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: true,
no_qfe: true,
})
);

assert_eq!(
extract_atis_station_config("ATIS Kutaisi 131.400, NO HPA"),
Some(StationConfig {
name: "Kutaisi".to_string(),
atis: 131_400_000,
traffic: None,
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: true,
no_qfe: false,
})
);

assert_eq!(
extract_atis_station_config("ATIS Kutaisi 131.400, NO QFE"),
Some(StationConfig {
name: "Kutaisi".to_string(),
atis: 131_400_000,
traffic: None,
tts: None,
info_ltr_override: None,
active_rwy_override: None,
no_hpa: false,
no_qfe: true,
})
);
}
Expand Down
Loading