1
0
Fork 0

Add Set Default PWR On cmd for ld & tec

This commit is contained in:
linuswck 2024-03-04 16:07:39 +08:00
parent 92c6cf12d4
commit a58b0954ec
1 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,7 @@ enum LdCmdEnum {
#[default]
Reserved,
// LD Drive Related
SetDefaultPowerOn,
PowerUp,
PowerDown,
LdTermsShort,
@ -53,6 +54,7 @@ enum LdCmdEnum {
enum ThermostatCmdEnum {
#[default]
Reserved,
SetDefaultPowerOn,
PowerUp,
PowerDown,
// TEC
@ -211,6 +213,17 @@ pub fn execute_cmd(buffer: &mut [u8], buffer_size: usize, mut laser: LdDrive, mu
}
match cmd.json.laser_diode_cmd {
Some(LdCmdEnum::SetDefaultPowerOn) => {
match cmd.json.data_bool {
Some(val) => {
laser.set_default_pwr_on(val);
}
None => {
info!("Wrong Data type is received")
}
}
}
Some(LdCmdEnum::PowerUp) => {
laser.power_up()
}
@ -283,6 +296,17 @@ pub fn execute_cmd(buffer: &mut [u8], buffer_size: usize, mut laser: LdDrive, mu
}
match cmd.json.thermostat_cmd {
Some(ThermostatCmdEnum::SetDefaultPowerOn) => {
match cmd.json.data_bool {
Some(val) => {
tec.set_default_pwr_on(val);
}
None => {
info!("Wrong Data type is received")
}
}
}
Some(ThermostatCmdEnum::PowerUp) => {
tec.power_up()
}