From 61593e2b36f932722237a0a5755adc82f40cbdd1 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Wed, 2 Oct 2024 19:24:26 +1000 Subject: [PATCH] SITL: FlightAxis: add option to silence FPS --- libraries/SITL/SIM_FlightAxis.cpp | 7 +++++-- libraries/SITL/SIM_FlightAxis.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/SITL/SIM_FlightAxis.cpp b/libraries/SITL/SIM_FlightAxis.cpp index bd33e5822f..0e1a947449 100644 --- a/libraries/SITL/SIM_FlightAxis.cpp +++ b/libraries/SITL/SIM_FlightAxis.cpp @@ -43,6 +43,7 @@ const AP_Param::GroupInfo FlightAxis::var_info[] = { // @Bitmask: 0: Reset position on startup // @Bitmask: 1: Swap first 4 and last 4 servos (for quadplane testing) // @Bitmask: 2: Demix heli servos and send roll/pitch/collective/yaw + // @Bitmask: 3: Don't print frame rate stats // @User: Advanced AP_GROUPINFO("OPTS", 1, FlightAxis, _options, uint32_t(Option::ResetPosition)), AP_GROUPEND @@ -603,8 +604,10 @@ void FlightAxis::report_FPS(void) uint64_t frames = socket_frame_counter - last_socket_frame_counter; last_socket_frame_counter = socket_frame_counter; double dt = state.m_currentPhysicsTime_SEC - last_frame_count_s; - printf("%.2f/%.2f FPS avg=%.2f glitches=%u\n", - frames / dt, 1000 / dt, 1.0/average_frame_time_s, unsigned(glitch_count)); + if(!option_is_set(Option::SilenceFPS)) { + printf("%.2f/%.2f FPS avg=%.2f glitches=%u\n", + frames / dt, 1000 / dt, 1.0/average_frame_time_s, unsigned(glitch_count)); + } } else { printf("Initial position %f %f %f\n", position.x, position.y, position.z); } diff --git a/libraries/SITL/SIM_FlightAxis.h b/libraries/SITL/SIM_FlightAxis.h index ea987c663b..276a2aa69c 100644 --- a/libraries/SITL/SIM_FlightAxis.h +++ b/libraries/SITL/SIM_FlightAxis.h @@ -180,6 +180,7 @@ private: ResetPosition = (1U<<0), Rev4Servos = (1U<<1), HeliDemix = (1U<<2), + SilenceFPS = (1U<<3), }; // return true if an option is set