fixing clippy

This commit is contained in:
Ryan Summers 2021-07-19 13:30:12 +02:00
parent 19bcc87c7f
commit 1c605623c2
2 changed files with 8 additions and 6 deletions

View File

@ -346,9 +346,13 @@ const APP: () = {
// Update the signal generators
c.resources.signal_generator.lock(|generator| {
for i in 0..2 {
match settings.signal_generator[i].try_into() {
Ok(config) => generator[i].update_waveform(config),
for (i, (ref mut generator, &config)) in generator
.iter_mut()
.zip(settings.signal_generator.iter())
.enumerate()
{
match config.try_into() {
Ok(config) => generator.update_waveform(config),
Err(err) => log::error!(
"Failed to update signal generation on DAC{}: {:?}",
i,

View File

@ -85,9 +85,7 @@ impl TryFrom<f32> for DacCode {
// V with 16-bit resolution. The anti-aliasing filter has an additional gain of 2.5.
let dac_range = 4.096 * 2.5;
if voltage > dac_range {
Err(())
} else if voltage < -1. * dac_range {
if voltage > dac_range || voltage < -1. * dac_range {
Err(())
} else {
Ok(DacCode::from(