From e963ee7bc476f0fc5e2737665a5cc49540ac14f3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 20 Dec 2022 17:41:07 +0100 Subject: [PATCH] finish collection interval request --- satrs-example/src/pus.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/satrs-example/src/pus.rs b/satrs-example/src/pus.rs index 9167935..9b6c6dc 100644 --- a/satrs-example/src/pus.rs +++ b/satrs-example/src/pus.rs @@ -1,4 +1,4 @@ -use crate::hk::HkRequest; +use crate::hk::{CollectionIntervalFactor, HkRequest}; use crate::requests::Request; use crate::tmtc::TmStore; use satrs_core::events::EventU32; @@ -174,7 +174,23 @@ impl PusReceiver { send_request(HkRequest::OneShot(addressable_id.unique_id)); } else if PusPacket::subservice(pus_tc) == hk::Subservice::TcModifyCollectionInterval as u8 { - if user_data.len() < 12 {} + if user_data.len() < 12 { + self.update_time_stamp(); + self.verif_reporter + .start_failure( + token, + FailParams::new( + &self.time_stamp, + &hk_err::COLLECTION_INTERVAL_MISSING, + None, + ), + ) + .expect("Sending start failure TM failed"); + return; + } + send_request(HkRequest::ModifyCollectionInterval( + CollectionIntervalFactor::from_be_bytes(user_data[8..12].try_into().unwrap()), + )); } } fn handle_event_request(&mut self, pus_tc: &PusTc, token: VerificationToken) {