Skip to content

Commit

Permalink
astyle shift module documentation to bottom of files
Browse files Browse the repository at this point in the history
 - Astyle chokes on the module description strings, so for now we can keep them near the bottom of each file.
  • Loading branch information
dagar authored Nov 2, 2019
1 parent f0ac270 commit a475d71
Show file tree
Hide file tree
Showing 16 changed files with 413 additions and 422 deletions.
122 changes: 60 additions & 62 deletions src/drivers/dshot/dshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,65 @@ int DShotOutput::custom_command(int argc, char *argv[])
return print_usage("unknown command");
}

int DShotOutput::print_status()
{
const char *mode_str = nullptr;

switch (_mode) {

case MODE_NONE: mode_str = "no outputs"; break;

case MODE_1PWM: mode_str = "outputs1"; break;

case MODE_2PWM: mode_str = "outputs2"; break;

case MODE_2PWM2CAP: mode_str = "outputs2cap2"; break;

case MODE_3PWM: mode_str = "outputs3"; break;

case MODE_3PWM1CAP: mode_str = "outputs3cap1"; break;

case MODE_4PWM: mode_str = "outputs4"; break;

case MODE_4PWM1CAP: mode_str = "outputs4cap1"; break;

case MODE_4PWM2CAP: mode_str = "outputs4cap2"; break;

case MODE_5PWM: mode_str = "outputs5"; break;

case MODE_5PWM1CAP: mode_str = "outputs5cap1"; break;

case MODE_6PWM: mode_str = "outputs6"; break;

case MODE_8PWM: mode_str = "outputs8"; break;

case MODE_4CAP: mode_str = "cap4"; break;

case MODE_5CAP: mode_str = "cap5"; break;

case MODE_6CAP: mode_str = "cap6"; break;

default:
break;
}

if (mode_str) {
PX4_INFO("Mode: %s", mode_str);
}

PX4_INFO("Outputs initialized: %s", _outputs_initialized ? "yes" : "no");
PX4_INFO("Outputs on: %s", _outputs_on ? "yes" : "no");
perf_print_counter(_cycle_perf);
_mixing_output.printStatus();

if (_telemetry) {
PX4_INFO("telemetry on: %s", _telemetry_device);
_telemetry->handler.printStatus();
}

return 0;
}

int DShotOutput::print_usage(const char *reason)
{
if (reason) {
Expand Down Expand Up @@ -1614,68 +1673,7 @@ After saving, the reversed direction will be regarded as the normal one. So to r
return 0;
}

int DShotOutput::print_status()
{
const char *mode_str = nullptr;

switch (_mode) {

case MODE_NONE: mode_str = "no outputs"; break;

case MODE_1PWM: mode_str = "outputs1"; break;

case MODE_2PWM: mode_str = "outputs2"; break;

case MODE_2PWM2CAP: mode_str = "outputs2cap2"; break;

case MODE_3PWM: mode_str = "outputs3"; break;

case MODE_3PWM1CAP: mode_str = "outputs3cap1"; break;

case MODE_4PWM: mode_str = "outputs4"; break;

case MODE_4PWM1CAP: mode_str = "outputs4cap1"; break;

case MODE_4PWM2CAP: mode_str = "outputs4cap2"; break;

case MODE_5PWM: mode_str = "outputs5"; break;

case MODE_5PWM1CAP: mode_str = "outputs5cap1"; break;

case MODE_6PWM: mode_str = "outputs6"; break;

case MODE_8PWM: mode_str = "outputs8"; break;

case MODE_4CAP: mode_str = "cap4"; break;

case MODE_5CAP: mode_str = "cap5"; break;

case MODE_6CAP: mode_str = "cap6"; break;

default:
break;
}

if (mode_str) {
PX4_INFO("Mode: %s", mode_str);
}

PX4_INFO("Outputs initialized: %s", _outputs_initialized ? "yes" : "no");
PX4_INFO("Outputs on: %s", _outputs_on ? "yes" : "no");
perf_print_counter(_cycle_perf);
_mixing_output.printStatus();
if (_telemetry) {
PX4_INFO("telemetry on: %s", _telemetry_device);
_telemetry->handler.printStatus();
}

return 0;
}

extern "C" __EXPORT int dshot_main(int argc, char *argv[]);

int
dshot_main(int argc, char *argv[])
extern "C" __EXPORT int dshot_main(int argc, char *argv[])
{
return DShotOutput::main(argc, argv);
}
17 changes: 7 additions & 10 deletions src/drivers/pwm_out_sim/PWMSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#include <uORB/Subscription.hpp>
#include <uORB/topics/parameter_update.h>

extern "C" __EXPORT int pwm_out_sim_main(int argc, char *argv[]);

PWMSim::PWMSim(bool hil_mode_enabled) :
CDev(PWM_OUTPUT0_DEVICE_PATH),
OutputModuleInterface(MODULE_NAME, px4::wq_configurations::hp_default)
Expand Down Expand Up @@ -273,6 +271,12 @@ int PWMSim::custom_command(int argc, char *argv[])
return print_usage("unknown command");
}

int PWMSim::print_status()
{
_mixing_output.printStatus();
return 0;
}

int PWMSim::print_usage(const char *reason)
{
if (reason) {
Expand Down Expand Up @@ -300,14 +304,7 @@ It is used in SITL and HITL.
return 0;
}

int PWMSim::print_status()
{
_mixing_output.printStatus();
return 0;
}

int
pwm_out_sim_main(int argc, char *argv[])
extern "C" __EXPORT int pwm_out_sim_main(int argc, char *argv[])
{
return PWMSim::main(argc, argv);
}
112 changes: 54 additions & 58 deletions src/drivers/px4fmu/fmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,59 @@ int PX4FMU::custom_command(int argc, char *argv[])
return print_usage("unknown command");
}

int PX4FMU::print_status()
{
PX4_INFO("Max update rate: %i Hz", _current_update_rate);

const char *mode_str = nullptr;

switch (_mode) {
case MODE_NONE: mode_str = "no pwm"; break;

case MODE_1PWM: mode_str = "pwm1"; break;

case MODE_2PWM: mode_str = "pwm2"; break;

case MODE_2PWM2CAP: mode_str = "pwm2cap2"; break;

case MODE_3PWM: mode_str = "pwm3"; break;

case MODE_3PWM1CAP: mode_str = "pwm3cap1"; break;

case MODE_4PWM: mode_str = "pwm4"; break;

case MODE_4PWM1CAP: mode_str = "pwm4cap1"; break;

case MODE_4PWM2CAP: mode_str = "pwm4cap2"; break;

case MODE_5PWM: mode_str = "pwm5"; break;

case MODE_5PWM1CAP: mode_str = "pwm5cap1"; break;

case MODE_6PWM: mode_str = "pwm6"; break;

case MODE_8PWM: mode_str = "pwm8"; break;

case MODE_4CAP: mode_str = "cap4"; break;

case MODE_5CAP: mode_str = "cap5"; break;

case MODE_6CAP: mode_str = "cap6"; break;

default:
break;
}

if (mode_str) {
PX4_INFO("PWM Mode: %s", mode_str);
}

perf_print_counter(_cycle_perf);
_mixing_output.printStatus();

return 0;
}

int PX4FMU::print_usage(const char *reason)
{
if (reason) {
Expand Down Expand Up @@ -2252,64 +2305,7 @@ mixer files.
return 0;
}

int PX4FMU::print_status()
{
PX4_INFO("Max update rate: %i Hz", _current_update_rate);

const char *mode_str = nullptr;

switch (_mode) {

case MODE_NONE: mode_str = "no pwm"; break;

case MODE_1PWM: mode_str = "pwm1"; break;

case MODE_2PWM: mode_str = "pwm2"; break;

case MODE_2PWM2CAP: mode_str = "pwm2cap2"; break;

case MODE_3PWM: mode_str = "pwm3"; break;

case MODE_3PWM1CAP: mode_str = "pwm3cap1"; break;

case MODE_4PWM: mode_str = "pwm4"; break;

case MODE_4PWM1CAP: mode_str = "pwm4cap1"; break;

case MODE_4PWM2CAP: mode_str = "pwm4cap2"; break;

case MODE_5PWM: mode_str = "pwm5"; break;

case MODE_5PWM1CAP: mode_str = "pwm5cap1"; break;

case MODE_6PWM: mode_str = "pwm6"; break;

case MODE_8PWM: mode_str = "pwm8"; break;

case MODE_4CAP: mode_str = "cap4"; break;

case MODE_5CAP: mode_str = "cap5"; break;

case MODE_6CAP: mode_str = "cap6"; break;

default:
break;
}

if (mode_str) {
PX4_INFO("PWM Mode: %s", mode_str);
}

perf_print_counter(_cycle_perf);
_mixing_output.printStatus();

return 0;
}

extern "C" __EXPORT int fmu_main(int argc, char *argv[]);

int
fmu_main(int argc, char *argv[])
extern "C" __EXPORT int fmu_main(int argc, char *argv[])
{
return PX4FMU::main(argc, argv);
}
67 changes: 33 additions & 34 deletions src/drivers/rc_input/RCInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,38 @@ int RCInput::custom_command(int argc, char *argv[])
return print_usage("unknown command");
}

int RCInput::print_usage(const char *reason)
int RCInput::print_status()
{
PX4_INFO("Running %s", (_run_as_task ? "as task" : "on work queue"));

if (!_run_as_task) {
PX4_INFO("Max update rate: %i Hz", 1000000 / _current_update_interval);
}

if (_device[0] != '\0') {
PX4_INFO("Serial device: %s", _device);
}

PX4_INFO("RC scan state: %s, locked: %s", RC_SCAN_STRING[_rc_scan_state], _rc_scan_locked ? "yes" : "no");
PX4_INFO("CRSF Telemetry: %s", _crsf_telemetry ? "yes" : "no");
PX4_INFO("SBUS frame drops: %u", sbus_dropped_frames());

#if ADC_RC_RSSI_CHANNEL
PX4_INFO("vrssi: %dmV", (int)(_analog_rc_rssi_volt * 1000.0f));
#endif

perf_print_counter(_cycle_perf);
perf_print_counter(_publish_interval_perf);

if (hrt_elapsed_time(&_rc_in.timestamp) < 1_s) {
print_message(_rc_in);
}

return 0;
}

int
RCInput::print_usage(const char *reason)
{
if (reason) {
PX4_WARN("%s\n", reason);
Expand Down Expand Up @@ -805,39 +836,7 @@ When running on the work queue, it schedules at a fixed frequency.
return 0;
}

int RCInput::print_status()
{
PX4_INFO("Running %s", (_run_as_task ? "as task" : "on work queue"));

if (!_run_as_task) {
PX4_INFO("Max update rate: %i Hz", 1000000 / _current_update_interval);
}
if (_device[0] != '\0') {
PX4_INFO("Serial device: %s", _device);
}

PX4_INFO("RC scan state: %s, locked: %s", RC_SCAN_STRING[_rc_scan_state], _rc_scan_locked ? "yes" : "no");
PX4_INFO("CRSF Telemetry: %s", _crsf_telemetry ? "yes" : "no");
PX4_INFO("SBUS frame drops: %u", sbus_dropped_frames());

#if ADC_RC_RSSI_CHANNEL
PX4_INFO("vrssi: %dmV", (int)(_analog_rc_rssi_volt * 1000.0f));
#endif

perf_print_counter(_cycle_perf);
perf_print_counter(_publish_interval_perf);

if (hrt_elapsed_time(&_rc_in.timestamp) < 1_s) {
print_message(_rc_in);
}

return 0;
}

extern "C" __EXPORT int rc_input_main(int argc, char *argv[]);

int
rc_input_main(int argc, char *argv[])
extern "C" __EXPORT int rc_input_main(int argc, char *argv[])
{
return RCInput::main(argc, argv);
}
Loading

0 comments on commit a475d71

Please sign in to comment.