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]);
|
c.resources.afes.1.set_gain(settings.afe[1]);
|
||||||
|
|
||||||
// Update the signal generators
|
// Update the signal generators
|
||||||
c.resources.signal_generator.lock(|generator| {
|
for (i, &config) in settings.signal_generator.iter().enumerate() {
|
||||||
for (i, (ref mut generator, &config)) in generator
|
match config.try_into() {
|
||||||
.iter_mut()
|
Ok(config) => {
|
||||||
.zip(settings.signal_generator.iter())
|
c.resources
|
||||||
.enumerate()
|
.signal_generator
|
||||||
{
|
.lock(|generator| generator[i].update_waveform(config));
|
||||||
match config.try_into() {
|
|
||||||
Ok(config) => generator.update_waveform(config),
|
|
||||||
Err(err) => log::error!(
|
|
||||||
"Failed to update signal generation on DAC{}: {:?}",
|
|
||||||
i,
|
|
||||||
err
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
Err(err) => log::error!(
|
||||||
|
"Failed to update signal generation on DAC{}: {:?}",
|
||||||
|
i,
|
||||||
|
err
|
||||||
|
),
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
let target = settings.stream_target.into();
|
let target = settings.stream_target.into();
|
||||||
c.resources.network.direct_stream(target);
|
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 core::convert::{TryFrom, TryInto};
|
||||||
use miniconf::Miniconf;
|
use miniconf::Miniconf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -60,7 +60,8 @@ impl TryFrom<BasicConfig> for Config {
|
||||||
fn try_from(config: BasicConfig) -> Result<Config, Error> {
|
fn try_from(config: BasicConfig) -> Result<Config, Error> {
|
||||||
// Calculate the frequency tuning words
|
// Calculate the frequency tuning words
|
||||||
let frequency_tuning_word: [u32; 2] = {
|
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;
|
let ftw = config.frequency * LSB_PER_HERTZ;
|
||||||
|
|
||||||
if config.symmetry <= 0.0 {
|
if config.symmetry <= 0.0 {
|
||||||
|
|
Loading…
Reference in New Issue