From ee3b1715cb169e89b88d6755263bf1ab84ebbda4 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 25 Nov 2021 16:38:56 +0800 Subject: [PATCH] rtio_clock: cfg uses default now, info->warn --- src/runtime/src/rtio_clocking.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/runtime/src/rtio_clocking.rs b/src/runtime/src/rtio_clocking.rs index cd279da..a3e2f7b 100644 --- a/src/runtime/src/rtio_clocking.rs +++ b/src/runtime/src/rtio_clocking.rs @@ -24,8 +24,9 @@ pub enum RtioClock { } fn get_rtio_clock_cfg(cfg: &Config) -> RtioClock { + let mut res = RtioClock::Default; if let Ok(clk) = cfg.read_str("rtio_clock") { - match clk.as_ref() { + res = match clk.as_ref() { "int_125" => RtioClock::Int_125, "int_100" => RtioClock::Int_100, "int_150" => RtioClock::Int_150, @@ -37,14 +38,18 @@ fn get_rtio_clock_cfg(cfg: &Config) -> RtioClock { "ext0_synth0_125to125" => RtioClock::Ext0_Synth0_125to125, _ => { warn!("Unrecognised rtio_clock setting. Falling back to default."); - RtioClock::Int_125 + RtioClock::Default } - } + }; } else { - info!("error reading configuration. Falling back to default."); - RtioClock::Default + warn!("error reading configuration. Falling back to default."); } + if res == RtioClock::Default { + warn!("Using default configuration - internal 125MHz RTIO clock."); + return RtioClock::Int_125; + } + res }