diff --git a/satrs-core/src/lib.rs b/satrs-core/src/lib.rs index 87f07f4..d1b25d2 100644 --- a/satrs-core/src/lib.rs +++ b/satrs-core/src/lib.rs @@ -25,6 +25,7 @@ pub mod events; #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] pub mod executable; pub mod hal; +pub mod hk; pub mod objects; pub mod params; #[cfg(feature = "alloc")] @@ -32,10 +33,9 @@ pub mod params; pub mod pool; pub mod power; pub mod pus; +pub mod request; pub mod res_code; pub mod seq_count; pub mod tmtc; -pub mod request; -pub mod hk; pub use spacepackets; diff --git a/satrs-core/src/power.rs b/satrs-core/src/power.rs index 9d0e7ad..82063a3 100644 --- a/satrs-core/src/power.rs +++ b/satrs-core/src/power.rs @@ -45,7 +45,6 @@ pub trait PowerSwitcherCommandSender { ) -> Result<(), ::Error> { switch.switch_off() } - } pub trait PowerSwitchInfo { @@ -72,22 +71,21 @@ pub trait PowerSwitchProvider: PowerSwitcherCommandSender + PowerSwitchInfo { #[cfg(test)] mod tests { use super::*; - use std::boxed::Box; use crate::power::PowerSwitcherCommandSender; - + use std::boxed::Box; struct Pcdu { - switch_rx: std::sync::mpsc::Receiver<(SwitchId, u16)> + switch_rx: std::sync::mpsc::Receiver<(SwitchId, u16)>, } enum DeviceState { OFF, SwitchingPower, ON, SETUP, - IDLE + IDLE, } struct MyComplexDevice { - power_switcher: Box>, + power_switcher: Box>, switch_id: SwitchId, some_state: u16, dev_state: DeviceState, @@ -101,7 +99,9 @@ mod tests { let mode = 1; if mode == 1 { if self.dev_state == DeviceState::OFF { - self.power_switcher.send_switch_on_cmd(self.switch_id).expect("sending siwthc cmd failed"); + self.power_switcher + .send_switch_on_cmd(self.switch_id) + .expect("sending siwthc cmd failed"); self.dev_state = DeviceState::SwitchingPower; } if self.dev_state == DeviceState::SwitchingPower { @@ -113,4 +113,4 @@ mod tests { } } } -} \ No newline at end of file +} diff --git a/satrs-core/src/request.rs b/satrs-core/src/request.rs index e69de29..8b13789 100644 --- a/satrs-core/src/request.rs +++ b/satrs-core/src/request.rs @@ -0,0 +1 @@ + diff --git a/satrs-example/src/hk.rs b/satrs-example/src/hk.rs index 0ee26cd..2e4727a 100644 --- a/satrs-example/src/hk.rs +++ b/satrs-example/src/hk.rs @@ -1,9 +1,4 @@ -use satrs_core::tmtc::AddressableId; - - - #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum AcsHkIds { TestMgmSet = 1, } - diff --git a/satrs-example/src/lib.rs b/satrs-example/src/lib.rs index bdee90a..e28ece5 100644 --- a/satrs-example/src/lib.rs +++ b/satrs-example/src/lib.rs @@ -1,5 +1,5 @@ +use satrs_core::events::{EventU32TypedSev, SeverityInfo}; use std::net::Ipv4Addr; -use satrs_core::events::{EventU32, EventU32TypedSev, Severity, SeverityInfo}; use satrs_mib::res_code::{ResultU16, ResultU16Info}; use satrs_mib::resultcode; @@ -51,5 +51,3 @@ pub mod hk_err { #[resultcode] pub const COLLECTION_INTERVAL_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 3); } - - diff --git a/satrs-example/src/main.rs b/satrs-example/src/main.rs index 9eb737c..a070109 100644 --- a/satrs-example/src/main.rs +++ b/satrs-example/src/main.rs @@ -4,7 +4,7 @@ mod pus; mod requests; mod tmtc; -use crate::hk::{AcsHkIds}; +use crate::hk::AcsHkIds; use crate::requests::{Request, RequestWithToken}; use crate::tmtc::{ core_tmtc_task, OtherArgs, PusTcSource, TcArgs, TcStore, TmArgs, TmFunnel, TmStore, PUS_APID, @@ -13,6 +13,7 @@ use satrs_core::event_man::{ EventManagerWithMpscQueue, MpscEventReceiver, MpscEventU32SendProvider, SendEventProvider, }; use satrs_core::events::EventU32; +use satrs_core::hk::HkRequest; use satrs_core::pool::{LocalPool, PoolCfg, StoreAddr}; use satrs_core::pus::event_man::{ DefaultPusMgmtBackendProvider, EventReporter, EventRequest, EventRequestWithToken, @@ -37,7 +38,6 @@ use std::sync::mpsc::{channel, TryRecvError}; use std::sync::{mpsc, Arc, RwLock}; use std::thread; use std::time::Duration; -use satrs_core::hk::HkRequest; #[derive(Clone)] struct EventTmSender { @@ -245,7 +245,6 @@ fn main() { HkRequest::Disable(_) => {} HkRequest::ModifyCollectionInterval(_, _) => {} }, - _ => {} } let started_token = reporter_aocs .start_success(request.1, Some(×tamp)) diff --git a/satrs-example/src/pus.rs b/satrs-example/src/pus.rs index caee377..fb228bb 100644 --- a/satrs-example/src/pus.rs +++ b/satrs-example/src/pus.rs @@ -1,6 +1,8 @@ use crate::requests::{Request, RequestWithToken}; use crate::tmtc::{PusTcSource, TmStore}; use satrs_core::events::EventU32; +use satrs_core::hk::{CollectionIntervalFactor, HkRequest}; +use satrs_core::params::Params; use satrs_core::pool::StoreAddr; use satrs_core::pus::event; use satrs_core::pus::event_man::{EventRequest, EventRequestWithToken}; @@ -21,8 +23,6 @@ use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use std::sync::mpsc::Sender; -use satrs_core::hk::{CollectionIntervalFactor, HkRequest}; -use satrs_core::params::Params; pub struct PusReceiver { pub tm_helper: PusTmWithCdsShortHelper, @@ -133,7 +133,9 @@ impl PusReceiver { } 128 => { self.update_time_stamp(); - self.event_sender.send((TEST_EVENT.into(), None)).expect("Sending test event failed"); + self.event_sender + .send((TEST_EVENT.into(), None)) + .expect("Sending test event failed"); let start_token = self .verif_reporter .start_success(token, Some(&self.time_stamp)) diff --git a/satrs-example/src/requests.rs b/satrs-example/src/requests.rs index 42ae51c..efb5732 100644 --- a/satrs-example/src/requests.rs +++ b/satrs-example/src/requests.rs @@ -4,7 +4,6 @@ use satrs_core::pus::verification::{TcStateAccepted, VerificationToken}; #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum Request { HkRequest(HkRequest), - ModeRequest } #[derive(Copy, Clone, Eq, PartialEq, Debug)]