diff --git a/cmake/configs/qurt_eagle_legacy_driver_default.cmake b/cmake/configs/qurt_eagle_legacy_driver_default.cmake index 1ff1845c32..46dfbd2df5 100644 --- a/cmake/configs/qurt_eagle_legacy_driver_default.cmake +++ b/cmake/configs/qurt_eagle_legacy_driver_default.cmake @@ -64,7 +64,7 @@ set(config_module_list # PX4 drivers # drivers/gps - drivers/uart_esc + drivers/pwm_out_rc_in drivers/qshell/qurt # diff --git a/cmake/configs/qurt_sdflight_default.cmake b/cmake/configs/qurt_sdflight_default.cmake index c646a6dfb6..03b6a7353c 100644 --- a/cmake/configs/qurt_sdflight_default.cmake +++ b/cmake/configs/qurt_sdflight_default.cmake @@ -61,7 +61,7 @@ set(config_module_list # PX4 drivers # drivers/gps - drivers/uart_esc + drivers/pwm_out_rc_in drivers/qshell/qurt # diff --git a/posix-configs/eagle/flight/px4.config b/posix-configs/eagle/flight/px4.config index 8149cb4d4c..2c92e90ba1 100644 --- a/posix-configs/eagle/flight/px4.config +++ b/posix-configs/eagle/flight/px4.config @@ -15,7 +15,7 @@ ekf2 start land_detector start multicopter mc_pos_control start mc_att_control start -uart_esc start -d /dev/tty-2 +pwm_out_rc_in start -d /dev/tty-2 sleep 1 list_devices list_files diff --git a/src/drivers/uart_esc/CMakeLists.txt b/src/drivers/pwm_out_rc_in/CMakeLists.txt similarity index 92% rename from src/drivers/uart_esc/CMakeLists.txt rename to src/drivers/pwm_out_rc_in/CMakeLists.txt index cb060c82da..08764c7f05 100644 --- a/src/drivers/uart_esc/CMakeLists.txt +++ b/src/drivers/pwm_out_rc_in/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# Copyright (c) 2015-2016 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -31,12 +31,12 @@ # ############################################################################ px4_add_module( - MODULE drivers__uart_esc - MAIN uart_esc + MODULE drivers__pwm_out_rc_in + MAIN pwm_out_rc_in COMPILE_FLAGS -Os SRCS - uart_esc.cpp + pwm_out_rc_in.cpp DEPENDS platforms__common ) diff --git a/src/drivers/uart_esc/uart_esc.cpp b/src/drivers/pwm_out_rc_in/pwm_out_rc_in.cpp similarity index 91% rename from src/drivers/uart_esc/uart_esc.cpp rename to src/drivers/pwm_out_rc_in/pwm_out_rc_in.cpp index 458a8463bb..4b2b68775a 100644 --- a/src/drivers/uart_esc/uart_esc.cpp +++ b/src/drivers/pwm_out_rc_in/pwm_out_rc_in.cpp @@ -56,15 +56,20 @@ #include -namespace uart_esc +/* + * This driver is supposed to run on Snapdragon. It sends actuator_controls (PWM) + * to a Pixhawk/Pixfalcon/Pixracer over UART (mavlink) and receives RC input. + */ + +namespace pwm_out_rc_in { static const uint8_t mavlink_message_lengths[256] = MAVLINK_MESSAGE_LENGTHS; static const uint8_t mavlink_message_crcs[256] = MAVLINK_MESSAGE_CRCS; -volatile bool _task_should_exit = false; // flag indicating if uart_esc task should exit +volatile bool _task_should_exit = false; // flag indicating if pwm_out_rc_in task should exit static char _device[32] = {}; -static bool _is_running = false; // flag indicating if uart_esc app is running +static bool _is_running = false; // flag indicating if pwm_out_rc_in app is running static px4_task_t _task_handle = -1; // handle to the task main thread // subscriptions @@ -473,7 +478,7 @@ void start() _task_should_exit = false; /* start the task */ - _task_handle = px4_task_spawn_cmd("uart_esc_main", + _task_handle = px4_task_spawn_cmd("pwm_out_rc_in_main", SCHED_DEFAULT, SCHED_PRIORITY_MAX, 1500, @@ -501,17 +506,17 @@ void stop() void usage() { - PX4_INFO("usage: uart_esc start -d /dev/tty-3"); - PX4_INFO(" uart_esc stop"); - PX4_INFO(" uart_esc status"); + PX4_INFO("usage: pwm_out_rc_in start -d /dev/tty-3"); + PX4_INFO(" pwm_out_rc_in stop"); + PX4_INFO(" pwm_out_rc_in status"); } -} // namespace uart_esc +} // namespace pwm_out_rc_in /* driver 'main' command */ -extern "C" __EXPORT int uart_esc_main(int argc, char *argv[]); +extern "C" __EXPORT int pwm_out_rc_in_main(int argc, char *argv[]); -int uart_esc_main(int argc, char *argv[]) +int pwm_out_rc_in_main(int argc, char *argv[]) { const char *device = nullptr; int ch; @@ -528,49 +533,49 @@ int uart_esc_main(int argc, char *argv[]) switch (ch) { case 'd': device = myoptarg; - strncpy(uart_esc::_device, device, strlen(device)); + strncpy(pwm_out_rc_in::_device, device, strlen(device)); break; } } // gets the parameters for the esc's pwm - param_get(param_find("PWM_DISARMED"), &uart_esc::_pwm_disarmed); - param_get(param_find("PWM_MIN"), &uart_esc::_pwm_min); - param_get(param_find("PWM_MAX"), &uart_esc::_pwm_max); + param_get(param_find("PWM_DISARMED"), &pwm_out_rc_in::_pwm_disarmed); + param_get(param_find("PWM_MIN"), &pwm_out_rc_in::_pwm_min); + param_get(param_find("PWM_MAX"), &pwm_out_rc_in::_pwm_max); /* * Start/load the driver. */ if (!strcmp(verb, "start")) { - if (uart_esc::_is_running) { - PX4_WARN("uart_esc already running"); + if (pwm_out_rc_in::_is_running) { + PX4_WARN("pwm_out_rc_in already running"); return 1; } // Check on required arguments if (device == nullptr || strlen(device) == 0) { - uart_esc::usage(); + pwm_out_rc_in::usage(); return 1; } - uart_esc::start(); + pwm_out_rc_in::start(); } else if (!strcmp(verb, "stop")) { - if (!uart_esc::_is_running) { - PX4_WARN("uart_esc is not running"); + if (!pwm_out_rc_in::_is_running) { + PX4_WARN("pwm_out_rc_in is not running"); return 1; } - uart_esc::stop(); + pwm_out_rc_in::stop(); } else if (!strcmp(verb, "status")) { - PX4_WARN("uart_esc is %s", uart_esc::_is_running ? "running" : "not running"); + PX4_WARN("pwm_out_rc_in is %s", pwm_out_rc_in::_is_running ? "running" : "not running"); return 0; } else { - uart_esc::usage(); + pwm_out_rc_in::usage(); return 1; }