Skip to content

Commit

Permalink
orb-ui: app-based self-serve ui (#241)
Browse files Browse the repository at this point in the history
orb-ui: self-serve ui

SignupStartOperator event created for "legacy" flow
where operator presses the button to start signup.
SignupStart now used to start signup/biometric capture:
- button press (v0 of self-serve)
- app button press by user (v1 of self-serve)
  • Loading branch information
fouge authored Oct 2, 2024
1 parent 15ea2fc commit 90c9372
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 310 deletions.
6 changes: 3 additions & 3 deletions orb-ui/cone/examples/cone-simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ async fn simulation_task(cone: &mut Cone) -> eyre::Result<()> {
let state_res = match counter {
SimulationState::Idle => {
for pixel in pixels.iter_mut() {
*pixel = Argb::DIAMOND_USER_IDLE;
*pixel = Argb::DIAMOND_CONE_AMBER;
}
cone.lcd
.tx()
.try_send(LcdCommand::try_from(Argb::DIAMOND_USER_IDLE)?)
.try_send(LcdCommand::try_from(Argb::DIAMOND_CONE_AMBER)?)
.wrap_err("unable to send DIAMOND_USER_IDLE to lcd")
}
SimulationState::Red => {
Expand Down Expand Up @@ -134,7 +134,7 @@ async fn simulation_task(cone: &mut Cone) -> eyre::Result<()> {
}
SimulationState::QrCode => {
for pixel in pixels.iter_mut() {
*pixel = Argb::DIAMOND_USER_AMBER;
*pixel = Argb::DIAMOND_SHROUD_SUMMON_USER_AMBER;
}

let cmd =
Expand Down
23 changes: 14 additions & 9 deletions orb-ui/rgb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,21 @@ 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);
pub const DIAMOND_USER_AMBER: Argb = Argb(Some(Self::DIMMING_MAX_VALUE), 20, 16, 1);
#[allow(dead_code)]
pub const DIAMOND_USER_IDLE: Argb = Argb(Some(Self::DIMMING_MAX_VALUE), 18, 23, 18);
pub const DIAMOND_USER_QR_SCAN: Argb =
Argb(Some(Self::DIMMING_MAX_VALUE), 24, 29, 24);
pub const DIAMOND_USER_SIGNUP: Argb =
Argb(Some(Self::DIMMING_MAX_VALUE), 32, 26, 1);
pub const DIAMOND_USER_FLASH: Argb =
Argb(Some(Self::DIMMING_MAX_VALUE), 255, 255, 255);
/// Outer-ring color during operator QR scans
pub const DIAMOND_RING_OPERATOR_QR_SCAN: Argb = Argb(Some(4), 55, 10, 0);
pub const DIAMOND_RING_OPERATOR_QR_SCAN_SPINNER: Argb = Argb(Some(7), 80, 50, 30);
/// Outer-ring color during user QR scans
pub const DIAMOND_RING_USER_QR_SCAN: Argb = Argb(Some(4), 50, 40, 3);
pub const DIAMOND_RING_USER_QR_SCAN_SPINNER: Argb = Argb(Some(7), 80, 60, 40);
/// Shroud color to invite user to scan / reposition in front of the orb
pub const DIAMOND_SHROUD_SUMMON_USER_AMBER: Argb = Argb(Some(3), 95, 40, 3);
/// Shroud color during user scan/capture (in progress)
pub const DIAMOND_SHROUD_USER_CAPTURE: Argb = Argb(Some(3), 118, 51, 3);
/// Outer-ring color during user scan/capture (in progress)
pub const DIAMOND_RING_USER_CAPTURE: Argb = Argb(Some(10), 100, 80, 3);
pub const DIAMOND_CONE_AMBER: Argb = Argb(Some(Self::DIMMING_MAX_VALUE), 25, 18, 1);
/// Error color for outer ring
pub const DIAMOND_RING_ERROR_SALMON: Argb = Argb(Some(3), 127, 20, 0);

pub const FULL_RED: Argb = Argb(None, 255, 0, 0);
pub const FULL_GREEN: Argb = Argb(None, 0, 255, 0);
Expand Down
2 changes: 1 addition & 1 deletion orb-ui/src/engine/animations/arc_dash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<const N: usize> Animation for ArcDash<N> {
if N == PEARL_RING_LED_COUNT {
current_color = Argb::PEARL_USER_FLASH;
} else {
current_color = Argb::DIAMOND_USER_FLASH;
current_color = Argb::DIAMOND_RING_USER_CAPTURE;
}
*phase += dt;
if *phase >= FLASH_ON_TIME {
Expand Down
1 change: 1 addition & 0 deletions orb-ui/src/engine/animations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub use self::milky_way::MilkyWay;
pub use self::progress::Progress;
pub use self::r#static::Static;
pub use self::simple_spinner::SimpleSpinner;
pub use self::slider::Slider;
pub use self::spinner::Spinner;
pub use self::wave::Wave;
use crate::engine::{RingFrame, DIAMOND_RING_LED_COUNT, GAMMA};
Expand Down
3 changes: 0 additions & 3 deletions orb-ui/src/engine/animations/simple_spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub struct SimpleSpinner<const N: usize> {

impl<const N: usize> SimpleSpinner<N> {
/// Creates a new [`SimpleSpinner`] with one arc.
#[expect(dead_code)]
#[must_use]
pub fn new(color: Argb, background: Option<Argb>) -> Self {
Self {
Expand All @@ -40,7 +39,6 @@ impl<const N: usize> SimpleSpinner<N> {
}

/// Set the speed of the spinner in radians per second.
#[expect(dead_code)]
pub fn speed(self, speed: f64) -> Self {
Self { speed, ..self }
}
Expand All @@ -51,7 +49,6 @@ impl<const N: usize> SimpleSpinner<N> {
self.phase
}

#[expect(dead_code)]
pub fn fade_in(self, duration: f64) -> Self {
Self {
transition: Some(Transition::FadeIn(duration)),
Expand Down
2 changes: 0 additions & 2 deletions orb-ui/src/engine/animations/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub struct Shape<const FRAME_SIZE: usize> {
impl<const N: usize> Slider<N> {
/// Creates a new [`Slider`].
#[must_use]
#[expect(dead_code)]
pub fn new(progress: f64, color: Argb) -> Self {
Self {
color,
Expand All @@ -60,7 +59,6 @@ impl<const N: usize> Slider<N> {

/// Enable pulsing
#[must_use]
#[expect(dead_code)]
pub fn with_pulsing(mut self) -> Self {
self.shape.pulse_phase = Some(0.0);
self
Expand Down
1 change: 0 additions & 1 deletion orb-ui/src/engine/animations/static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ impl<const N: usize> Static<N> {
}
}

#[expect(dead_code)]
pub fn fade_in(self, duration: f64) -> Self {
Self {
transition: Some(Transition::FadeIn(duration)),
Expand Down
1 change: 0 additions & 1 deletion orb-ui/src/engine/animations/wave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl<const N: usize> Wave<N> {
}
}

#[expect(dead_code)]
pub fn with_delay(mut self, delay: f64) -> Self {
self.transition = Some(Transition::StartDelay(delay));
self
Expand Down
Loading

0 comments on commit 90c9372

Please sign in to comment.