From f5ebc4c9794adc540e8d72eeb31cf62dd1d9dbba Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 29 Jan 2023 21:27:13 +0100 Subject: Fix variable i unintentionnally reassigned --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index fc35c58..54f7171 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,17 +89,17 @@ impl DDS { let incr = 1.0f32 / TRIG_TABLE_LEN as f32; for i in 0..TRIG_TABLE_LEN { - let i = f32::cos(incr * i as f32 * 2.0 * PI) * 127.0; - let q = f32::sin(incr * i as f32 * 2.0 * PI) * 127.0; + let inphase = f32::cos(incr * i as f32 * 2.0 * PI) * 127.0; + let quadrature = f32::sin(incr * i as f32 * 2.0 * PI) * 127.0; match waveform { Waveform::Sine => { - trig_table_inphase.push(f32::round(i) as i8); - trig_table_quadrature.push(f32::round(q) as i8); + trig_table_inphase.push(f32::round(inphase) as i8); + trig_table_quadrature.push(f32::round(quadrature) as i8); } Waveform::Rect => { - trig_table_inphase.push(if i >= 0.0 { 127 } else { -127 }); - trig_table_quadrature.push(if q >= 0.0 { 127 } else { -127 }); + trig_table_inphase.push(if inphase >= 0.0 { 127 } else { -127 }); + trig_table_quadrature.push(if quadrature >= 0.0 { 127 } else { -127 }); } } } -- cgit v1.2.3