Skip to content

Commit

Permalink
Revert back to num::Complex for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed May 23, 2023
1 parent 897bc7a commit 1095e2a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rust/oxide-decoders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ log = "0.4.17"
custom_error = "1.9.2"
num = "0.4.0"
tokio = { version = "1.28.1", features = ["full", "tracing"] }
num-complex = "0.4.3"
# num-complex = "0.4.3"
7 changes: 4 additions & 3 deletions rust/oxide-decoders/src/decoders/acars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

use crate::Decoder;
use custom_error::custom_error;
use num_complex::Complex;
// use num_complex::Complex;
use num::Complex;
use std::fmt::Display;
use std::fmt::Formatter;
use std::ops::Add;
Expand Down Expand Up @@ -482,7 +483,7 @@ impl ACARSDecoder {

for in_ in &mut self.dm_buffer.into_iter().take(len) {
let s: f32 = 1800.0 / INTRATE as f32 * 2.0 * std::f32::consts::PI + self.msk_df;
let mut v: Complex<f32> = num::Complex::new(0.0, 0.0);
let mut v: Complex<f32> = Complex::new(0.0, 0.0);
let mut o: f32;

/* VCO */
Expand All @@ -493,7 +494,7 @@ impl ACARSDecoder {

/* mixer */

self.inb[self.idx as usize] = in_ * Complex::exp(-self.msk_phi * num::Complex::i());
self.inb[self.idx as usize] = in_ * Complex::exp(-self.msk_phi * Complex::i());
self.idx = (self.idx + 1) % (FLEN as u32);

/* bit clock */
Expand Down
3 changes: 2 additions & 1 deletion rust/oxide-decoders/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

use decoders::acars::AssembledACARSMessage;
use num_complex::Complex;
//use num_complex::Complex;
use num::Complex;
use tokio::sync::mpsc::UnboundedSender;

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion rust/oxide-rtlsdr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ custom_error = "1.9.2"
oxide-decoders = { path = "../oxide-decoders" }
tokio = { version = "1.28.1", features = ["full", "tracing"] }
array-init = "2.1.0"
num-complex = "0.4.3"
# num-complex = "0.4.3"
7 changes: 4 additions & 3 deletions rust/oxide-rtlsdr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

#[macro_use]
extern crate log;
use num_complex::Complex;
// use num_complex::Complex;
use num::Complex;
use oxide_decoders::decoders::acars::ACARSDecoder;
use oxide_decoders::decoders::acars::{self, AssembledACARSMessage};
use oxide_decoders::{Decoder, ValidDecoderType};
Expand Down Expand Up @@ -246,7 +247,7 @@ impl RtlSdr {
let mut window: Vec<Complex<f32>> = vec![];
for i in 0..self.rtl_mult {
// ch->wf[ind]=cexpf(AMFreq*ind*-I)/rtlMult/127.5;
let window_value = (am_freq * i as f32 * -num::complex::Complex::i()).exp()
let window_value = (am_freq * i as f32 * -Complex::i()).exp()
/ self.rtl_mult as f32
/ 127.5;
window.push(window_value);
Expand Down Expand Up @@ -294,7 +295,7 @@ impl RtlSdr {
pub async fn read_samples(mut self) {
let rtloutbufz = self.get_rtloutbufsz();
let buffer_len: u32 = rtloutbufz as u32 * self.rtl_mult as u32 * 2;
let mut vb: [Complex<f32>; 320] = [num::complex::Complex::new(0.0, 0.0); 320];
let mut vb: [Complex<f32>; 320] = [Complex::new(0.0, 0.0); 320];

match self.reader {
None => {
Expand Down

0 comments on commit 1095e2a

Please sign in to comment.