use crate::messages::utils::short;
use crate::traits::ThorlabsDevice;
const STOP: [u8; 2] = [0x65, 0x04];
const STOPPED: [u8; 2] = [0x66, 0x04];
#[doc = include_str!("../documentation/stop.md")]
pub(crate) async fn stop<A, const CH: usize>(device: &A, channel: usize)
where
A: ThorlabsDevice<CH>,
{
log::info!("{device} CHANNEL {channel} STOP (requested)");
let rx = device.inner().receiver(&STOPPED, channel).await;
if rx.is_new() {
log::info!("{device} CHANNEL {channel} STOP (is new)");
let command = short(STOP, channel as u8, 0x02);
device.inner().send(command).await;
}
let _ = rx.receive().await; log::info!("{device} CHANNEL {channel} STOP (success)");
}
#[doc = include_str!("../documentation/estop.md")]
pub(crate) async fn estop<A, const CH: usize>(device: &A, channel: usize)
where
A: ThorlabsDevice<CH>,
{
log::info!("{device} CHANNEL {channel} ESTOP (requested)");
let rx = device.inner().receiver(&STOPPED, channel).await;
if rx.is_new() {
log::info!("{device} CHANNEL {channel} ESTOP (is new)");
let command = short(STOP, channel as u8, 0x01);
device.inner().send(command).await;
}
let _ = rx.receive().await; log::info!("{device} CHANNEL {channel} ESTOP (success)");
}