diff --git a/src/satman/src/main.rs b/src/satman/src/main.rs index 1bd6db3..4e4e8da 100644 --- a/src/satman/src/main.rs +++ b/src/satman/src/main.rs @@ -1031,10 +1031,7 @@ fn process_aux_packet( timer ); let mut data_slice = [0; SAT_PAYLOAD_MAX_SIZE]; - let meta = core_manager.log_get_slice(&mut data_slice); - if clear && meta.status.is_first() { - mgmt::clear_log(); - } + let meta = core_manager.log_get_slice(&mut data_slice, clear); drtioaux::send( 0, &drtioaux::Packet::CoreMgmtGetLogReply { diff --git a/src/satman/src/mgmt.rs b/src/satman/src/mgmt.rs index 179d701..80ca733 100644 --- a/src/satman/src/mgmt.rs +++ b/src/satman/src/mgmt.rs @@ -60,10 +60,14 @@ impl<'a> Manager<'_> { } } - pub fn log_get_slice(&mut self, data_slice: &mut [u8; SAT_PAYLOAD_MAX_SIZE]) -> SliceMeta { + pub fn log_get_slice(&mut self, data_slice: &mut [u8; SAT_PAYLOAD_MAX_SIZE], consume: bool) -> SliceMeta { // Populate buffer if depleted if self.last_log.at_end() { - self.last_log.extend(get_logger_buffer().extract().as_bytes()); + let mut buffer = get_logger_buffer(); + self.last_log.extend(buffer.extract().as_bytes()); + if consume { + buffer.clear(); + } } self.last_log.get_slice_satellite(data_slice)