cleaned up debug messages

This commit is contained in:
lkoester 2023-02-15 14:57:43 +01:00
parent 2c0c7a4655
commit 45569e8fb5
8 changed files with 43 additions and 119 deletions

View File

@ -18,3 +18,20 @@
[2023-02-15][11:11:37][main][INFO] Starting TMTC task
[2023-02-15][11:11:37][main][INFO] Starting power task
[2023-02-15][11:11:37][main][INFO] Starting AOCS task
[2023-02-15][14:42:44][main][INFO] Starting TMTC task
[2023-02-15][14:42:44][main][INFO] Starting power task
[2023-02-15][14:42:44][main][INFO] Starting Payload Handling task
[2023-02-15][14:42:44][main][INFO] Starting TM funnel task
[2023-02-15][14:42:44][main][INFO] Starting AOCS task
[2023-02-15][14:43:13][main][INFO] Running DemoSat OBSW
[2023-02-15][14:43:13][main][INFO] Starting TMTC task
[2023-02-15][14:43:13][main][INFO] Starting power task
[2023-02-15][14:43:13][main][INFO] Starting Payload Handling task
[2023-02-15][14:43:13][main][INFO] Starting TM funnel task
[2023-02-15][14:43:13][main][INFO] Starting AOCS task
[2023-02-15][14:48:12][main][INFO] Running DemoSat OBSW!
[2023-02-15][14:48:12][main][INFO] Starting TMTC task
[2023-02-15][14:48:12][main][INFO] Starting power task
[2023-02-15][14:48:12][main][INFO] Starting Payload Handling task
[2023-02-15][14:48:12][main][INFO] Starting TM funnel task
[2023-02-15][14:48:12][main][INFO] Starting AOCS task

View File

@ -160,9 +160,7 @@ impl MGMHandler {
pub fn handle_hk_request(&mut self, hk_req: HkRequest) {
match hk_req {
HkRequest::OneShot(_) => {
}
HkRequest::OneShot(_) => {}
HkRequest::Enable(_) => {}
HkRequest::Disable(_) => {}
HkRequest::ModifyCollectionInterval(_, _) => {}

View File

@ -3,7 +3,7 @@ use crate::can_ids::{
PackageModel, SenderReceiverThread, ThreadId,
};
use embedded_can::{self, Frame};
use log::{info, warn};
use log::{debug, warn};
use socketcan::{errors, frame, socket, CanFrame, Socket};
use std::collections::HashMap;
use std::io;
@ -55,13 +55,13 @@ impl CanRxHandler {
pub fn rx_socket(&self) -> Option<CanFrame> {
let frame = self.socket.read_frame().ok()?;
info!("Can Frame read: {:?}.", frame);
debug!("Can Frame read: {:?}.", frame);
return Some(frame);
}
pub fn forward_frame(&self, frame: CanFrame) {
let frame_id = can_id_to_package_id(frame.id());
info!("Frame forwarding with id: {:?}", frame_id);
debug!("Frame forwarding with id: {:?}", frame_id);
if let Some(frame_id) = frame_id {
if self.package_map.contains_key(&frame_id) {
let value = self.package_map.get(&frame_id).unwrap();

View File

@ -1,3 +1,4 @@
use log::warn;
use crate::tmtc::{MpscStoreAndSendError, PusTcSource, PUS_APID};
use satrs_core::spacepackets::{CcsdsPacket, SpHeader};
use satrs_core::tmtc::{CcsdsPacketHandler, ReceivesCcsdsTc};
@ -29,7 +30,7 @@ impl CcsdsPacketHandler for CcsdsReceiver {
sp_header: &SpHeader,
_tc_raw: &[u8],
) -> Result<(), Self::Error> {
println!("Unknown APID 0x{:x?} detected", sp_header.apid());
warn!("Unknown APID 0x{:x?} detected", sp_header.apid());
Ok(())
}
}

View File

@ -84,9 +84,8 @@ impl EcssTmSenderCore for EventTmSender {
}
fn main() {
println!("Running SESPSat OBSW");
logger::setup_logger().unwrap();
info!("Running DemoSat OBSW!");
let tm_pool = LocalPool::new(PoolCfg::new(vec![
(30, 32),
@ -244,98 +243,6 @@ fn main() {
);
});
/*
// AOCS Thread
let socket1 =
can::CanTxHandler::new_socket("can0", ThreadId::AOCSThread, package_map_aocs_tx).unwrap();
info!("Starting AOCS receiving thread");
let builder2 = thread::Builder::new().name("AOCSThread".into());
let jh2 = builder2.spawn(move || {
let mut time_stamp_buf: [u8; 7] = [0; 7];
let mut huge_buf: [u8; 8192] = [0; 8192];
let data: [u8; 3] = [1, 2, 3];
let current_mgm_data = MgmData::default();
//let current_mgt_data = MgtData::default();
//let current_
loop {
// device handling
//info!("Sending {:?}", PackageId::AOCSControlMGT1);
//socket1.tx_socket(PackageId::AOCSControlMGT1, &data);
//info!("Waiting for {:?}", PackageId::AOCSDataMGM1);
let msg = aocs_can_rx.try_recv();
//current_mgm_data.x = new_data
match aocs_can_rx.try_recv() {
Ok(package) => match package.package_id() {
_ => warn!("Incorrect Id"),
},
Err(_) => {}
}
// telecommand handling
match acs_thread_rx.try_recv() {
Ok(request_with_token) => {
match request_with_token.0 {
Request::HkRequest(hk_req) => {
match hk_req {
HkRequest::OneShot(id) => {
assert_eq!(id.target_id, RequestTargetId::AcsSubsystem as u32);
if id.unique_id == 0 {
let mut sp_header = SpHeader::tm_unseg(
0x02,
aocs_seq_count_provider.get_and_increment(),
0,
)
.unwrap();
let cds_stamp =
TimeProvider::from_now_with_u16_days().unwrap();
cds_stamp.write_to_bytes(&mut time_stamp_buf);
let mut len = id.write_to_be_bytes(&mut huge_buf).unwrap();
let json_string = "asdf";
huge_buf[8..json_string.len() + 8]
.copy_from_slice(json_string.as_bytes());
len += json_string.len();
let tm_sec_header = PusTmSecondaryHeader::new_simple(
3,
Subservice::TmHkPacket as u8,
&time_stamp_buf,
);
let hk_tm = PusTm::new(
&mut sp_header,
tm_sec_header,
Some(&huge_buf[0..len]),
true,
);
let addr = aocs_tm_store.add_pus_tm(&hk_tm);
aocs_tm_funnel_tx.send(addr).expect("sending failed");
/* let start_token = self //implement this for verification
.verif_reporter
.start_success(token, &self.time_stamp)
.expect("Error sending start success");
self.tm_tx
.send(addr)
.expect("Sending TM to TM funnel failed");
self.verif_reporter
.completion_success(start_token, &self.time_stamp)
.expect("Error sending completion success");
*/
}
}
HkRequest::Enable(_) => {}
HkRequest::Disable(_) => {}
HkRequest::ModifyCollectionInterval(_, _) => {}
}
}
_ => {}
}
}
Err(_) => {}
}
}
});
*/
let package_map_pld_tx = load_package_ids();
let pld_tm_funnel_tx = tm_funnel_tx.clone();
let pld_tm_store = tm_store.clone();
@ -344,7 +251,7 @@ fn main() {
can_tx_sender.clone();
//let mut pcdu_tx_clone = pcdu_tx.clone();
println!("Starting Payload Handling task");
info!("Starting Payload Handling task");
let builder3 = thread::Builder::new().name("PLDThread".into());
let jh3 = builder3.spawn(move || {
core_pld_task(
@ -356,7 +263,7 @@ fn main() {
);
});
println!("Starting TM funnel task");
info!("Starting TM funnel task");
let builder4 = thread::Builder::new().name("TMFunnelThread".into());
let jh4 = builder4.spawn(move || {
let tm_funnel = TmFunnel {

View File

@ -3,7 +3,7 @@ use crate::can_ids::{DeviceId, PackageId, PackageModel};
use crate::power_handler::{DeviceState, PowerSwitcher};
use crate::requests::{Request, RequestWithToken};
use eurosim_obsw::RequestTargetId;
use log::info;
use log::{debug};
use satrs_core::power::{PowerSwitchInfo, PowerSwitcherCommandSender, SwitchId};
use satrs_core::pus::verification::{StdVerifSenderError, VerificationReporterWithSender};
use satrs_core::spacepackets::time::cds::TimeProvider;
@ -93,7 +93,7 @@ impl CameraHandler {
.start_success(request_with_token.1, Some(&time_stamp_buf))
.expect("Error sending start success.");
info!("{:?}", camera_handler.get_mode());
debug!("{:?}", camera_handler.get_mode());
while camera_handler.get_mode() != CameraMode::Idle {
camera_handler.periodic_op();
}
@ -134,7 +134,7 @@ impl CameraHandler {
.send_switch_on_cmd(self.camera_switch_id)
.expect("sending switch cmd failed");
self.device_state = DeviceState::SwitchingPower;
info!("switching power");
debug!("switching power");
}
if self.device_state == DeviceState::SwitchingPower {
if self
@ -143,18 +143,18 @@ impl CameraHandler {
.expect("reading switch state failed")
{
self.device_state = DeviceState::On;
info!("device on");
debug!("device on");
}
}
if self.device_state == DeviceState::On {
self.can_tx.send(PackageModel::new(PackageId::CameraImageRequest, &[1]).unwrap()).unwrap();
info!("sent camera request");
debug!("sent camera request");
self.mode = CameraMode::Verification;
}
}
CameraMode::Verification => {
if self.device_state == DeviceState::On {
info!("waiting for image request confirmation");
debug!("waiting for image request confirmation");
if let Ok(msg) = self.can_rx.recv() {
if msg.package_id() == PackageId::CameraImageRequestConfirmation {
self.mode = CameraMode::Start;
@ -164,7 +164,7 @@ impl CameraHandler {
}
CameraMode::Start => {
if self.device_state == DeviceState::On {
info!("waiting for image start confirmation");
debug!("waiting for image start confirmation");
if let Ok(msg) = self.can_rx.recv() {
if msg.package_id() == PackageId::CameraImageExecutionStart {
self.mode = CameraMode::End;
@ -174,14 +174,14 @@ impl CameraHandler {
}
CameraMode::End => {
if self.device_state == DeviceState::On {
info!("waiting for image end confirmation");
debug!("waiting for image end confirmation");
if let Ok(msg) = self.can_rx.recv() {
if msg.package_id() == PackageId::CameraImageExectutionEnd {
self.power_switcher
.send_switch_off_cmd(self.camera_switch_id)
.expect("sending switch command failed");
self.device_state = DeviceState::SwitchingPower;
info!("switching power");
debug!("switching power");
}
}
}
@ -192,7 +192,7 @@ impl CameraHandler {
.expect("reading switch state failed")
{
self.device_state = DeviceState::Off;
info!("device off");
debug!("device off");
}
}
if self.device_state == DeviceState::Off {
@ -240,7 +240,7 @@ pub fn core_pld_task(
.start_success(request_with_token.1, Some(&time_stamp_buf))
.expect("Error sending start success.");
info!("{:?}", camera_handler.get_mode());
debug!("{:?}", camera_handler.get_mode());
while camera_handler.get_mode() != CameraMode::Idle {
camera_handler.periodic_op();
}

View File

@ -1,5 +1,5 @@
use crate::can_ids::{DeviceId, PackageId, PackageModel};
use log::info;
use log::{debug};
use satrs_core::power::{
PowerSwitchInfo, PowerSwitchProvider, PowerSwitcherCommandSender, SwitchId, SwitchState,
};
@ -145,7 +145,7 @@ impl PCDU {
if msg.package_id() == PackageId::DevicePowerStatusResponse
&& msg.data()[0] == dev_id_bytes
{
info!("received power status response");
debug!("received power status response");
let mut map_lock = self.device_state_map.lock().unwrap();
let state: SwitchState;
match msg.data()[1] {
@ -157,7 +157,7 @@ impl PCDU {
}
}
*map_lock.get_mut(&dev_id).unwrap() = state;
info!("{:?}", map_lock);
debug!("{:?}", map_lock);
Ok(())
} else {
Err(())

View File

@ -26,6 +26,7 @@ use satrs_core::pus::scheduling::PusScheduler;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use log::{debug};
pub struct PusReceiver {
pub tm_helper: PusTmWithCdsShortHelper,
@ -108,8 +109,8 @@ impl PusServiceProvider for PusReceiver {
impl PusReceiver {
fn handle_test_service(&mut self, pus_tc: &PusTc, token: VerificationToken<TcStateAccepted>) {
if PusPacket::subservice(pus_tc) == 1 {
println!("Received PUS ping command TC[17,1]");
println!("Sending ping reply PUS TM[17,2]");
debug!("Received PUS ping command TC[17,1]");
debug!("Sending ping reply PUS TM[17,2]");
let ping_reply = self.tm_helper.create_pus_tm_timestamp_now(17, 2, None);
let addr = self.tm_store.add_pus_tm(&ping_reply);
let start_token = self