bugfix for ACS module
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2024-02-07 16:18:38 +01:00
parent 66c594b3d2
commit 134acd9961
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -1,6 +1,7 @@
use std::sync::mpsc::{self, TryRecvError};
use log::{info, warn};
use satrs_core::executable::{Executable, OpResult};
use satrs_core::pus::verification::VerificationReporterWithSender;
use satrs_core::pus::{EcssTmSender, PusTmWrapper};
use satrs_core::spacepackets::ecss::hk::Subservice as HkSubservice;
@ -62,14 +63,14 @@ impl AcsTask {
}
// TODO: Verification failure for invalid unique IDs.
}
pub fn periodic_operation(&mut self) {
pub fn try_reading_one_request(&mut self) -> bool {
match self.request_rx.try_recv() {
Ok(request) => {
info!(
"ACS thread: Received HK request {:?}",
request.targeted_request
);
update_time(&mut self.time_provider, &mut self.timestamp);
match request.targeted_request.request {
Request::Hk(hk_req) => match hk_req {
HkRequest::OneShot(unique_id) => self.handle_hk_request(
@ -94,13 +95,24 @@ impl AcsTask {
self.verif_reporter
.completion_success(started_token, Some(&self.timestamp))
.expect("Sending completion success failed");
true
}
Err(e) => match e {
TryRecvError::Empty => {}
TryRecvError::Empty => false,
TryRecvError::Disconnected => {
warn!("ACS thread: Message Queue TX disconnected!")
warn!("ACS thread: Message Queue TX disconnected!");
false
}
},
}
}
pub fn periodic_operation(&mut self) {
update_time(&mut self.time_provider, &mut self.timestamp);
loop {
if !self.try_reading_one_request() {
break;
}
}
}
}