Larger update #49

Merged
muellerr merged 41 commits from this-is-complex into main 2023-07-08 15:02:42 +02:00
Showing only changes of commit 4613aaaf2c - Show all commits

View File

@ -1,4 +1,4 @@
use log::info; use log::{info, warn};
use satrs_core::hal::host::udp_server::{ReceiveResult, UdpTcServer}; use satrs_core::hal::host::udp_server::{ReceiveResult, UdpTcServer};
use std::net::SocketAddr; use std::net::SocketAddr;
use std::sync::mpsc::{Receiver, SendError, Sender, TryRecvError}; use std::sync::mpsc::{Receiver, SendError, Sender, TryRecvError};
@ -118,7 +118,7 @@ pub fn core_tmtc_task(
let ccsds_distributor = CcsdsDistributor::new(Box::new(ccsds_receiver)); let ccsds_distributor = CcsdsDistributor::new(Box::new(ccsds_receiver));
let udp_tc_server = UdpTcServer::new(socket_addr, 2048, Box::new(ccsds_distributor)) let udp_tc_server = UdpTcServer::new(socket_addr, 2048, Box::new(ccsds_distributor))
.expect("Creating UDP TMTC server failed"); .expect("creating UDP TMTC server failed");
let mut udp_tmtc_server = UdpTmtcServer { let mut udp_tmtc_server = UdpTmtcServer {
udp_tc_server, udp_tc_server,
@ -163,14 +163,14 @@ fn core_tmtc_loop(
.ok(); .ok();
} }
Err(e) => { Err(e) => {
println!("error creating PUS TC from raw data: {e}"); warn!("error creating PUS TC from raw data: {e}");
println!("raw data: {tc_buf:x?}"); warn!("raw data: {tc_buf:x?}");
} }
} }
} }
Err(e) => { Err(e) => {
if let TryRecvError::Disconnected = e { if let TryRecvError::Disconnected = e {
println!("tmtc thread: sender disconnected") warn!("tmtc thread: sender disconnected")
} }
} }
} }
@ -185,16 +185,16 @@ fn poll_tc_server(udp_tmtc_server: &mut UdpTmtcServer) -> bool {
Err(e) => match e { Err(e) => match e {
ReceiveResult::ReceiverError(e) => match e { ReceiveResult::ReceiverError(e) => match e {
CcsdsError::ByteConversionError(e) => { CcsdsError::ByteConversionError(e) => {
println!("Got packet error: {e:?}"); warn!("packet error: {e:?}");
true true
} }
CcsdsError::CustomError(_) => { CcsdsError::CustomError(e) => {
println!("Unknown receiver error"); warn!("mpsc store and send error {e:?}");
true true
} }
}, },
ReceiveResult::IoError(e) => { ReceiveResult::IoError(e) => {
println!("IO error {e}"); warn!("IO error {e}");
false false
} }
ReceiveResult::NothingReceived => false, ReceiveResult::NothingReceived => false,