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

orb-ui: wifi qr animation #267

Draft
wants to merge 1 commit into
base: fouge/wifi-volume
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions orb-ui/rgb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ impl Argb {
Argb(Some(Self::DIMMING_MAX_VALUE), 128, 128, 0);
pub const DIAMOND_OPERATOR_VERSIONS_OUTDATED: Argb =
Argb(Some(Self::DIMMING_MAX_VALUE), 255, 0, 0);

/// Outer-ring color during wifi QR scans
pub const DIAMOND_RING_WIFI_QR_SCAN: Argb = Argb(Some(5), 0, 10, 80);
pub const DIAMOND_RING_WIFI_QR_SCAN_SPINNER: Argb = Argb(Some(10), 50, 50, 40);

/// Outer-ring color during operator QR scans
pub const DIAMOND_RING_OPERATOR_QR_SCAN: Argb = Argb(Some(5), 77, 14, 0);
pub const DIAMOND_RING_OPERATOR_QR_SCAN_SPINNER: Argb = Argb(Some(10), 80, 50, 30);
Expand Down
15 changes: 14 additions & 1 deletion orb-ui/src/engine/diamond.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ impl EventHandler for Runner<DIAMOND_RING_LED_COUNT, DIAMOND_CENTER_LED_COUNT> {
sound::Type::Melody(sound::Melody::InternetConnectionSuccessful),
Duration::ZERO,
)?;
self.stop_ring(LEVEL_FOREGROUND, Transition::FadeOut(0.5));
self.set_ring(
LEVEL_BACKGROUND,
animations::Static::<DIAMOND_RING_LED_COUNT>::new(Argb::OFF, None),
);
}
Event::BootComplete { api_mode } => {
self.sound.queue(
Expand Down Expand Up @@ -345,7 +350,14 @@ impl EventHandler for Runner<DIAMOND_RING_LED_COUNT, DIAMOND_CENTER_LED_COUNT> {
}
QrScanSchema::Wifi => {
self.operator_idle.no_wlan();

self.set_ring(
LEVEL_FOREGROUND,
animations::SimpleSpinner::new(
Argb::DIAMOND_RING_WIFI_QR_SCAN_SPINNER,
Some(Argb::DIAMOND_RING_WIFI_QR_SCAN),
)
.fade_in(1.5),
);
// temporarily increase the volume to ask wifi qr code
let master_volume = self.sound.volume();
self.sound.set_master_volume(40);
Expand Down Expand Up @@ -488,6 +500,7 @@ impl EventHandler for Runner<DIAMOND_RING_LED_COUNT, DIAMOND_CENTER_LED_COUNT> {
);
}
QrScanSchema::Wifi => {
self.stop_ring(LEVEL_FOREGROUND, Transition::FadeOut(0.5));
self.sound.queue(
sound::Type::Melody(sound::Melody::QrLoadSuccess),
Duration::ZERO,
Expand Down
9 changes: 9 additions & 0 deletions orb-ui/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ pub async fn bootup_simulation(ui: &dyn Engine) -> Result<()> {
Ok(())
}

#[expect(dead_code)]
pub async fn wifi_qr_code_simulation(ui: &dyn Engine) {
ui.qr_scan_start(QrScanSchema::Wifi);
time::sleep(Duration::from_secs(6)).await;
ui.qr_scan_capture();
time::sleep(Duration::from_secs(2)).await;
ui.network_connection_success();
}

pub async fn signup_simulation(
ui: &dyn Engine,
hardware: Hardware,
Expand Down
Loading