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] #[default]
Reserved, Reserved,
// LD Drive Related // LD Drive Related
SetDefaultPowerOn,
PowerUp, PowerUp,
PowerDown, PowerDown,
LdTermsShort, LdTermsShort,
@ -53,6 +54,7 @@ enum LdCmdEnum {
enum ThermostatCmdEnum { enum ThermostatCmdEnum {
#[default] #[default]
Reserved, Reserved,
SetDefaultPowerOn,
PowerUp, PowerUp,
PowerDown, PowerDown,
// TEC // 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 { 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) => { Some(LdCmdEnum::PowerUp) => {
laser.power_up() 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 { 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) => { Some(ThermostatCmdEnum::PowerUp) => {
tec.power_up() tec.power_up()
} }