diff --git a/src/scope/analog_output.rs b/src/scope/analog_output.rs index a186b64..472f014 100644 --- a/src/scope/analog_output.rs +++ b/src/scope/analog_output.rs @@ -104,12 +104,14 @@ impl AnalogOutput { }); // Send the command to the backend - self.command_tx.send(command).unwrap(); + if self.command_tx.send(command).is_ok() { - // Wait for the response from the backend - let response_state = rx.recv().unwrap(); - // Write the response state - *self.state.write().unwrap() = response_state; + // Wait for the response from the backend + if let Ok(response_state) = rx.recv() { + // Write the response state + *self.state.write().unwrap() = response_state; + } + } } pub fn is_on(&self) -> bool { diff --git a/src/scope/pulse_output.rs b/src/scope/pulse_output.rs index 7321ffe..66e8733 100644 --- a/src/scope/pulse_output.rs +++ b/src/scope/pulse_output.rs @@ -100,12 +100,14 @@ impl PulseOutput { }); // Send the command to the backend - self.command_tx.send(command).unwrap(); + if self.command_tx.send(command).is_ok() { - // Wait for the response from the backend - let response_state = rx.recv().unwrap(); - // Write the response state - *self.state.write().unwrap() = response_state; + // Wait for the response from the backend + if let Ok(response_state) = rx.recv() { + // Write the response state + *self.state.write().unwrap() = response_state; + } + } } pub fn is_on(&self) -> bool {