diff --git a/bin/src/daemon.rs b/bin/src/daemon.rs index 3ec26e3..26edbc1 100644 --- a/bin/src/daemon.rs +++ b/bin/src/daemon.rs @@ -59,6 +59,7 @@ async fn run_server( debug_mode: config.debug_mode, analysis_status_lock, analysis_sender, + colorblind_mode: config.colorblind_mode, }); let app = Router::new() diff --git a/bin/src/diag.rs b/bin/src/diag.rs index 68e2f90..2827b1d 100644 --- a/bin/src/diag.rs +++ b/bin/src/diag.rs @@ -129,8 +129,16 @@ pub async fn start_recording(State(state): State>) -> Result<(S let qmdl_writer = QmdlWriter::new(qmdl_file); state.diag_device_ctrl_sender.send(DiagDeviceCtrlMessage::StartRecording((qmdl_writer, analysis_file))).await .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send stop recording message: {}", e)))?; - state.ui_update_sender.send(framebuffer::DisplayState::Recording).await + + let display_state: framebuffer::DisplayState; + if state.colorblind_mode { + display_state = framebuffer::DisplayState::RecordingCBM; + } else { + display_state = framebuffer::DisplayState::Recording; + } + state.ui_update_sender.send(display_state).await .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send ui update message: {}", e)))?; + Ok((StatusCode::ACCEPTED, "ok".to_string())) } diff --git a/bin/src/framebuffer.rs b/bin/src/framebuffer.rs index 2477613..6e1ecd1 100644 --- a/bin/src/framebuffer.rs +++ b/bin/src/framebuffer.rs @@ -27,6 +27,7 @@ pub enum DisplayState { Recording, Paused, WarningDetected, + RecordingCBM, } impl From for Color565 { @@ -34,6 +35,7 @@ impl From for Color565 { match state { DisplayState::Paused => Color565::White, DisplayState::Recording => Color565::Green, + DisplayState::RecordingCBM => Color565::Blue, DisplayState::WarningDetected => Color565::Red, } } diff --git a/bin/src/server.rs b/bin/src/server.rs index 3f9f481..c90a6a1 100644 --- a/bin/src/server.rs +++ b/bin/src/server.rs @@ -22,7 +22,8 @@ pub struct ServerState { pub ui_update_sender: Sender, pub analysis_status_lock: Arc>, pub analysis_sender: Sender, - pub debug_mode: bool + pub debug_mode: bool, + pub colorblind_mode: bool, } pub async fn get_qmdl(State(state): State>, Path(qmdl_name): Path) -> Result {