Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reset method to the log sub system #406

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cflib/crazyflie/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand All @@ -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,)
Expand Down