1
0
Fork 0

cmd_handler: change mW to W in SetLdPwrLimit cmd

This commit is contained in:
linuswck 2024-04-03 10:52:31 +08:00
parent 489333c43d
commit eaebdb390d
2 changed files with 3 additions and 3 deletions

View File

@ -333,7 +333,7 @@ class Laser:
Set power limit for the power excursion monitor Set power limit for the power excursion monitor
If the calculated power with the params of pd_mon > pwr_limit, If the calculated power with the params of pd_mon > pwr_limit,
overpower protection is triggered. overpower protection is triggered.
- pwr_limit: mW - pwr_limit: W
""" """
return await self._send_cmd(TARGET_LD, "SetLdPwrLimit", pwr_limit) return await self._send_cmd(TARGET_LD, "SetLdPwrLimit", pwr_limit)

View File

@ -5,7 +5,7 @@ use uom::si::{
electric_current::{ampere, ElectricCurrent}, electric_current::{ampere, ElectricCurrent},
electric_potential::{volt, ElectricPotential}, electric_potential::{volt, ElectricPotential},
electrical_resistance::{ohm, ElectricalResistance}, electrical_resistance::{ohm, ElectricalResistance},
power::{milliwatt, Power}, power::{watt, Power},
thermodynamic_temperature::{degree_celsius, ThermodynamicTemperature} thermodynamic_temperature::{degree_celsius, ThermodynamicTemperature}
}; };
use crate::{laser_diode::{laser_diode::{ use crate::{laser_diode::{laser_diode::{
@ -383,7 +383,7 @@ pub fn execute_cmd(buffer: &mut [u8], buffer_size: usize, socket: &mut SocketHan
match cmd.json.data_f32 { match cmd.json.data_f32 {
Some(val) => { Some(val) => {
send_response(buffer, ResponseEnum::Acknowledge, None, socket); send_response(buffer, ResponseEnum::Acknowledge, None, socket);
laser.set_ld_power_limit(Power::new::<milliwatt>(val)) laser.set_ld_power_limit(Power::new::<watt>(val))
} }
None => { None => {
send_response(buffer, ResponseEnum::InvalidDatatype, Some(ERR_MSG_MISSING_DATA_F32), socket); send_response(buffer, ResponseEnum::InvalidDatatype, Some(ERR_MSG_MISSING_DATA_F32), socket);