cleanup print_status, rename perf counters

This commit is contained in:
Jacob Dahl 2026-02-10 14:06:27 -09:00
parent f78ce5b227
commit e5068e1f1d
4 changed files with 21 additions and 30 deletions

View File

@ -1038,24 +1038,15 @@ void up_bdshot_status(void)
if (_bdshot_channel_mask) {
PX4_INFO("BDShot channel mask: 0x%2x", (unsigned)_bdshot_channel_mask);
// Show timer configuration
for (int i = 0; i < MAX_IO_TIMERS; i++) {
if (timer_configs[i].enabled) {
PX4_INFO("Timer %d: enabled=%d init=%d bidir=%d cap_ch=%d",
i, timer_configs[i].enabled, timer_configs[i].initialized,
timer_configs[i].bidirectional, timer_configs[i].capture_channel);
}
}
// Always show read counters for BDShot
for (int i = 0; i < MAX_TIMER_IO_CHANNELS; i++) {
if (_bdshot_channel_mask & (1 << i)) {
if (_bdshot_capture_supported[i]) {
PX4_INFO("Output %u: read_ok %lu, fail_crc %lu",
PX4_INFO("Ch%u: read_ok %lu, fail_crc %lu",
i, read_ok[i], read_fail_crc[i]);
} else {
PX4_INFO("Output %u: no DMA for capture", i);
PX4_INFO("Ch%u: no DMA for capture", i);
}
}
}

View File

@ -61,10 +61,10 @@ DShot::~DShot()
perf_free(_cycle_perf);
perf_free(_bdshot_success_perf);
perf_free(_bdshot_error_perf);
perf_free(_telem_success_perf);
perf_free(_telem_error_perf);
perf_free(_telem_timeout_perf);
perf_free(_telem_allsampled_perf);
perf_free(_serial_telem_success_perf);
perf_free(_serial_telem_error_perf);
perf_free(_serial_telem_timeout_perf);
perf_free(_serial_telem_allsampled_perf);
}
int DShot::init()
@ -480,7 +480,7 @@ bool DShot::process_serial_telemetry()
if (_serial_telem_online_mask & (1 << motor_index)) {
consume_esc_data(esc, TelemetrySource::Serial);
all_telem_sampled = set_next_telemetry_index();
perf_count(_telem_success_perf);
perf_count(_serial_telem_success_perf);
} else {
hrt_abstime now = hrt_absolute_time();
@ -507,7 +507,7 @@ bool DShot::process_serial_telemetry()
// Consume an empty EscData to zero the data
consume_esc_data(esc, TelemetrySource::Serial);
all_telem_sampled = set_next_telemetry_index();
perf_count(_telem_timeout_perf);
perf_count(_serial_telem_timeout_perf);
break;
case TelemetryStatus::ParseError:
@ -520,7 +520,7 @@ bool DShot::process_serial_telemetry()
consume_esc_data(esc, TelemetrySource::Serial);
all_telem_sampled = set_next_telemetry_index();
_serial_telem_delay_until = hrt_absolute_time() + 1_s;
perf_count(_telem_error_perf);
perf_count(_serial_telem_error_perf);
break;
}
}
@ -549,7 +549,7 @@ bool DShot::set_next_telemetry_index()
// Check if all motors have been sampled
if (count_set_bits(_telemetry_requested_mask) >= count_set_bits(_output_mask)) {
_telemetry_requested_mask = 0;
perf_count(_telem_allsampled_perf);
perf_count(_serial_telem_allsampled_perf);
return true;
}
@ -1131,10 +1131,10 @@ int DShot::print_status()
}
if (_serial_telemetry_enabled) {
perf_print_counter(_telem_success_perf);
perf_print_counter(_telem_error_perf);
perf_print_counter(_telem_timeout_perf);
perf_print_counter(_telem_allsampled_perf);
perf_print_counter(_serial_telem_success_perf);
perf_print_counter(_serial_telem_error_perf);
perf_print_counter(_serial_telem_timeout_perf);
perf_print_counter(_serial_telem_allsampled_perf);
}
print_spacer();

View File

@ -179,10 +179,10 @@ private:
perf_counter_t _cycle_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")};
perf_counter_t _bdshot_success_perf{perf_alloc(PC_COUNT, MODULE_NAME": bdshot success")};
perf_counter_t _bdshot_error_perf{perf_alloc(PC_COUNT, MODULE_NAME": bdshot error")};
perf_counter_t _telem_success_perf{perf_alloc(PC_COUNT, MODULE_NAME": telem success")};
perf_counter_t _telem_error_perf{perf_alloc(PC_COUNT, MODULE_NAME": telem error")};
perf_counter_t _telem_timeout_perf{perf_alloc(PC_COUNT, MODULE_NAME": telem timeout")};
perf_counter_t _telem_allsampled_perf{perf_alloc(PC_COUNT, MODULE_NAME": telem all sampled")};
perf_counter_t _serial_telem_success_perf{perf_alloc(PC_COUNT, MODULE_NAME": serial telem success")};
perf_counter_t _serial_telem_error_perf{perf_alloc(PC_COUNT, MODULE_NAME": serial telem error")};
perf_counter_t _serial_telem_timeout_perf{perf_alloc(PC_COUNT, MODULE_NAME": serial telem timeout")};
perf_counter_t _serial_telem_allsampled_perf{perf_alloc(PC_COUNT, MODULE_NAME": serial telem all sampled")};
// Commands
struct DShotCommand {

View File

@ -299,7 +299,7 @@ bool DShotTelemetry::telemetryResponseFinished()
void DShotTelemetry::printStatus() const
{
PX4_INFO("Number of successful ESC frames: %i", _num_successful_responses);
PX4_INFO("Number of timeouts: %i", _num_timeouts);
PX4_INFO("Number of CRC errors: %i", _num_checksum_errors);
PX4_INFO("Successful ESC frames: %i", _num_successful_responses);
PX4_INFO("Timeouts: %i", _num_timeouts);
PX4_INFO("CRC errors: %i", _num_checksum_errors);
}