Fixing math
This commit is contained in:
parent
e2d2ce0752
commit
1c32695a49
@ -345,22 +345,20 @@ const APP: () = {
|
||||
c.resources.afes.1.set_gain(settings.afe[1]);
|
||||
|
||||
// Update the signal generators
|
||||
c.resources.signal_generator.lock(|generator| {
|
||||
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,
|
||||
err
|
||||
),
|
||||
for (i, &config) in settings.signal_generator.iter().enumerate() {
|
||||
match config.try_into() {
|
||||
Ok(config) => {
|
||||
c.resources
|
||||
.signal_generator
|
||||
.lock(|generator| generator[i].update_waveform(config));
|
||||
}
|
||||
Err(err) => log::error!(
|
||||
"Failed to update signal generation on DAC{}: {:?}",
|
||||
i,
|
||||
err
|
||||
),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let target = settings.stream_target.into();
|
||||
c.resources.network.direct_stream(target);
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::hardware::{dac::DacCode, design_parameters::ADC_SAMPLE_TICKS};
|
||||
use crate::{configuration::ADC_SAMPLE_TICKS_LOG2, hardware::dac::DacCode};
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
use miniconf::Miniconf;
|
||||
use serde::Deserialize;
|
||||
@ -60,7 +60,8 @@ impl TryFrom<BasicConfig> for Config {
|
||||
fn try_from(config: BasicConfig) -> Result<Config, Error> {
|
||||
// Calculate the frequency tuning words
|
||||
let frequency_tuning_word: [u32; 2] = {
|
||||
const LSB_PER_HERTZ: f32 = ((1u64 + ADC_SAMPLE_TICKS_LOG2) << 32) as f32 / 100.0e6;
|
||||
const LSB_PER_HERTZ: f32 =
|
||||
(1u64 << (31 + ADC_SAMPLE_TICKS_LOG2)) as f32 / 100.0e6;
|
||||
let ftw = config.frequency * LSB_PER_HERTZ;
|
||||
|
||||
if config.symmetry <= 0.0 {
|
||||
|
Loading…
Reference in New Issue
Block a user