Skip to content

Commit

Permalink
option: Implement an option to not write telemetry logs or other state
Browse files Browse the repository at this point in the history
  • Loading branch information
nbertram authored and tridge committed Nov 17, 2023
1 parent a9f9eb9 commit b8b8472
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions MAVProxy/mavproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ def set_mav_version(mav10, mav20, autoProtocol, mavversionArg):
parser.add_option("--non-interactive", action='store_true', help="do not start interactive shell")
parser.add_option("--profile", action='store_true', help="run the Yappi python profiler")
parser.add_option("--state-basedir", default=None, help="base directory for logs and aircraft directories")
parser.add_option("--no-state", action='store_true', default=False, help="Don't save logs and other state to disk. Useful for read-only filesystems or long-running systems.")
parser.add_option("--version", action='store_true', help="version information")
parser.add_option("--default-modules", default="log,signing,wp,rally,fence,ftp,param,relay,tuneopt,arm,mode,calibration,rc,auxopt,misc,cmdlong,battery,terrain,output,adsb,layout", help='default module list')
parser.add_option("--udp-timeout",dest="udp_timeout", default=0.0, type='float', help="Timeout for udp clients in seconds")
Expand Down Expand Up @@ -1335,9 +1336,13 @@ def set_mav_version(mav10, mav20, autoProtocol, mavversionArg):
mpstate.command_map = command_map
mpstate.continue_mode = opts.continue_mode
# queues for logging
mpstate.logqueue = multiproc.Queue()
mpstate.logqueue_raw = multiproc.Queue()

if not opts.no_state:
mpstate.logqueue = multiproc.Queue()
mpstate.logqueue_raw = multiproc.Queue()
else:
mpstate.logqueue = None
mpstate.logqueue_raw = None

if opts.speech:
# start the speech-dispatcher early, so it doesn't inherit any ports from
Expand Down Expand Up @@ -1441,7 +1446,8 @@ def quit_handler(signum = None, frame = None):
mpstate.rl.set_prompt("")

# call this early so that logdir is setup based on --aircraft
(mpstate.status.logdir, logpath_telem, logpath_telem_raw) = log_paths()
if not opts.no_state:
(mpstate.status.logdir, logpath_telem, logpath_telem_raw) = log_paths()

for module in opts.load_module:
modlist = module.split(',')
Expand Down Expand Up @@ -1505,7 +1511,10 @@ def quit_handler(signum = None, frame = None):
yappi.start()

# log all packets from the master, for later replay
open_telemetry_logs(logpath_telem, logpath_telem_raw)
if not opts.no_state:
open_telemetry_logs(logpath_telem, logpath_telem_raw)
else:
print("Note: Not saving telemetry logs")

# run main loop as a thread
mpstate.status.thread = threading.Thread(target=main_loop, name='main_loop')
Expand Down

0 comments on commit b8b8472

Please sign in to comment.