Prevent crash when failing to send ddc command
This commit is contained in:
parent
1fccc92bce
commit
7aab7f726c
|
@ -51,10 +51,12 @@ fn run_i2c(idx: usize, mut dev: I2cDeviceDdc, command_channel: Receiver<MonitorC
|
|||
}
|
||||
}
|
||||
event!(Level::INFO, monitor_index = idx, ?cmd, "Sending DDC comand");
|
||||
match cmd {
|
||||
MonitorCommand::Brightness(b) => dev.set_vcp_feature(cmd.vcp(), b.into()).unwrap(),
|
||||
if let Err(e) = match cmd {
|
||||
MonitorCommand::Brightness(b) => dev.set_vcp_feature(cmd.vcp(), b.into()),
|
||||
// Hack - add 15 to align with DELL monitors
|
||||
MonitorCommand::Input(i) => dev.set_vcp_feature(cmd.vcp(), (i + 15).into()).unwrap(),
|
||||
MonitorCommand::Input(i) => dev.set_vcp_feature(cmd.vcp(), (i + 15).into()),
|
||||
} {
|
||||
event!(Level::WARN, err = %e, "Error sending DDC command");
|
||||
}
|
||||
last_sent_command.insert(cmd.cmd_str(), Some(Instant::now()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue