From de4e261835501c6f9733b0d722f46ae332d55349 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 7 Feb 2024 15:23:56 +0100 Subject: [PATCH] that should do the job --- satrs-example/Cargo.toml | 4 ++++ satrs-example/src/main.rs | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/satrs-example/Cargo.toml b/satrs-example/Cargo.toml index c668cc5..e479656 100644 --- a/satrs-example/Cargo.toml +++ b/satrs-example/Cargo.toml @@ -26,3 +26,7 @@ path = "../satrs-core" [dependencies.satrs-mib] # version = "0.1.0-alpha.1" path = "../satrs-mib" + +[features] +dyn_tmtc = [] +default = ["dyn_tmtc"] diff --git a/satrs-example/src/main.rs b/satrs-example/src/main.rs index 861152e..2eedea6 100644 --- a/satrs-example/src/main.rs +++ b/satrs-example/src/main.rs @@ -53,8 +53,6 @@ use std::sync::{Arc, RwLock}; use std::thread; use std::time::Duration; -const USE_STATIC_POOLS: bool = true; - fn create_static_pools() -> (StaticMemoryPool, StaticMemoryPool) { ( StaticMemoryPool::new(StaticPoolConfig::new(vec![ @@ -94,6 +92,7 @@ fn create_verification_reporter(verif_sender: impl EcssTmSender) -> Verification VerificationReporterWithSender::new(&verif_cfg, Box::new(verif_sender)) } +#[allow(dead_code)] fn static_tmtc_pool_main() { let (tm_pool, tc_pool) = create_static_pools(); let shared_tm_store = SharedTmStore::new(tm_pool); @@ -532,11 +531,10 @@ fn dyn_tmtc_pool_main() { fn main() { setup_logger().expect("setting up logging with fern failed"); println!("Running OBSW example"); - if USE_STATIC_POOLS { - static_tmtc_pool_main(); - } else { - dyn_tmtc_pool_main(); - } + #[cfg(not(feature = "dyn_tmtc"))] + static_tmtc_pool_main(); + #[cfg(feature = "dyn_tmtc")] + dyn_tmtc_pool_main(); } pub fn update_time(time_provider: &mut TimeProvider, timestamp: &mut [u8]) {