From 57038713892c39b899368732c15fc88da14cceb1 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Mon, 26 Jun 2023 15:09:58 +0200 Subject: [PATCH] Add reset method to the log sub system --- cflib/crazyflie/log.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cflib/crazyflie/log.py b/cflib/crazyflie/log.py index 47e146a7a..728bb0086 100644 --- a/cflib/crazyflie/log.py +++ b/cflib/crazyflie/log.py @@ -508,6 +508,13 @@ def add_config(self, logconf): 'The log configuration is too large or has an invalid ' 'parameter') + def reset(self): + """ + Reset the log system and remove all log blocks + """ + self.log_blocks = [] + self._send_reset_packet() + def refresh_toc(self, refresh_done_callback, toc_cache): """Start refreshing the table of loggale variables""" @@ -517,6 +524,9 @@ def refresh_toc(self, refresh_done_callback, toc_cache): self._refresh_callback = refresh_done_callback self.toc = None + self._send_reset_packet() + + def _send_reset_packet(self): pk = CRTPPacket() pk.set_header(CRTPPort.LOGGING, CHAN_SETTINGS) pk.data = (CMD_RESET_LOGGING,)