Skip to content

Commit

Permalink
SITL: FlightAxis: add option to silence FPS
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 committed Oct 2, 2024
1 parent 029eeac commit a28fd41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libraries/SITL/SIM_FlightAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, uint8_t(Option::ResetPosition)),
AP_GROUPEND
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions libraries/SITL/SIM_FlightAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class FlightAxis : public Aircraft {
ResetPosition = (1U<<0),
Rev4Servos = (1U<<1),
HeliDemix = (1U<<2),
SilenceFPS = (1U<<3),
};

// return true if an option is set
Expand Down

0 comments on commit a28fd41

Please sign in to comment.