diff --git a/ui/src/engine/diamond.rs b/ui/src/engine/diamond.rs index d605dde..a6b4e39 100644 --- a/ui/src/engine/diamond.rs +++ b/ui/src/engine/diamond.rs @@ -345,10 +345,15 @@ impl EventHandler for Runner { } QrScanSchema::Wifi => { self.operator_idle.no_wlan(); + + // temporarily increase the volume to ask wifi qr code + let master_volume = self.sound.volume(); + self.sound.set_master_volume(40); self.sound.queue( sound::Type::Voice(sound::Voice::ShowWifiHotspotQrCode), Duration::ZERO, )?; + self.sound.set_master_volume(master_volume); } QrScanSchema::User => { self.operator_signup_phase.user_qr_code_ok(); diff --git a/ui/src/engine/pearl.rs b/ui/src/engine/pearl.rs index afe4223..3d2de06 100644 --- a/ui/src/engine/pearl.rs +++ b/ui/src/engine/pearl.rs @@ -291,10 +291,15 @@ impl EventHandler for Runner { } QrScanSchema::Wifi => { self.operator_idle.no_wlan(); + + // temporarily increase the volume to ask wifi qr code + let master_volume = self.sound.volume(); + self.sound.set_master_volume(30); self.sound.queue( sound::Type::Voice(sound::Voice::ShowWifiHotspotQrCode), Duration::ZERO, )?; + self.sound.set_master_volume(master_volume); } QrScanSchema::User => { self.operator_signup_phase.user_qr_code_ok(); diff --git a/ui/src/sound/mod.rs b/ui/src/sound/mod.rs index 764cf38..5ae4273 100644 --- a/ui/src/sound/mod.rs +++ b/ui/src/sound/mod.rs @@ -33,6 +33,9 @@ pub trait Player: fmt::Debug + Send { /// Returns a new handler to the shared queue. fn clone(&self) -> Box; + /// Returns the master volume [0, 100]. + fn volume(&self) -> u64; + /// Sets the master volume. fn set_master_volume(&mut self, level: u64); @@ -262,6 +265,10 @@ impl Player for Jetson { }) } + fn volume(&self) -> u64 { + (self.volume * 100.0) as u64 + } + fn set_master_volume(&mut self, level: u64) { self.volume = level as f64 / 100.0; }