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