voice no longer hard-coded, bogeydope ordering fix, tripwire ignoring on-ground units

This commit is contained in:
AviiNL
2023-12-27 15:51:15 +01:00
parent e6596f27ad
commit a11402e763
7 changed files with 18 additions and 25 deletions

View File

@@ -162,7 +162,7 @@ fn listen_srs(
let frequency = radio.frequency;
let id = *id;
let voice = radio.voice;
let voice = radio.voice.clone();
let stt_url = stt_url.as_str().to_string();
radio.handle = Some(tokio.0.spawn(async move {
loop {
@@ -520,19 +520,18 @@ fn handle_voice_command(
}
}
#[derive(Default, Clone, Copy, Debug, Deserialize, Serialize)]
pub enum Voice {
#[default]
David,
Zira,
#[derive(Default, Clone, Debug, Deserialize, Serialize)]
pub struct Voice(String);
impl Voice {
pub fn new(voice: impl Into<String>) -> Self {
Self(voice.into())
}
}
impl std::fmt::Display for Voice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::David => write!(f, "David"),
Self::Zira => write!(f, "Zira"),
}
write!(f, "{}", self.0)
}
}