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 // Update the signal generators
c.resources.signal_generator.lock(|generator| { c.resources.signal_generator.lock(|generator| {
for i in 0..2 { for (i, (ref mut generator, &config)) in generator
match settings.signal_generator[i].try_into() { .iter_mut()
Ok(config) => generator[i].update_waveform(config), .zip(settings.signal_generator.iter())
.enumerate()
{
match config.try_into() {
Ok(config) => generator.update_waveform(config),
Err(err) => log::error!( Err(err) => log::error!(
"Failed to update signal generation on DAC{}: {:?}", "Failed to update signal generation on DAC{}: {:?}",
i, 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. // V with 16-bit resolution. The anti-aliasing filter has an additional gain of 2.5.
let dac_range = 4.096 * 2.5; let dac_range = 4.096 * 2.5;
if voltage > dac_range { if voltage > dac_range || voltage < -1. * dac_range {
Err(())
} else if voltage < -1. * dac_range {
Err(()) Err(())
} else { } else {
Ok(DacCode::from( Ok(DacCode::from(