@ -41,6 +41,7 @@
@@ -41,6 +41,7 @@
# include <px4_tasks.h>
# include <px4_posix.h>
# include <px4_getopt.h>
# include <lib/rc/dsm.h>
# include <drivers/drv_rc_input.h>
@ -76,7 +77,23 @@ void fill_input_rc(uint16_t raw_rc_count, uint16_t raw_rc_values[input_rc_s::RC_
@@ -76,7 +77,23 @@ void fill_input_rc(uint16_t raw_rc_count, uint16_t raw_rc_values[input_rc_s::RC_
void task_main ( int argc , char * argv [ ] )
{
int uart_fd = dsm_init ( SPEKTRUM_UART_DEVICE_PATH ) ;
const char * device_path = SPEKTRUM_UART_DEVICE_PATH ;
int ch ;
int myoptind = 1 ;
const char * myoptarg = NULL ;
while ( ( ch = px4_getopt ( argc , argv , " d: " , & myoptind , & myoptarg ) ) ! = EOF ) {
switch ( ch ) {
case ' d ' :
device_path = myoptarg ;
break ;
default :
break ;
}
}
int uart_fd = dsm_init ( device_path ) ;
if ( uart_fd < 1 ) {
PX4_ERR ( " dsm init failed " ) ;
@ -190,7 +207,7 @@ void fill_input_rc(uint16_t raw_rc_count, uint16_t raw_rc_values[input_rc_s::RC_
@@ -190,7 +207,7 @@ void fill_input_rc(uint16_t raw_rc_count, uint16_t raw_rc_values[input_rc_s::RC_
input_rc . rc_total_frame_count = 0 ;
}
int start ( )
int start ( int argc , char * argv [ ] )
{
if ( _is_running ) {
PX4_WARN ( " already running " ) ;
@ -206,7 +223,7 @@ int start()
@@ -206,7 +223,7 @@ int start()
SCHED_PRIORITY_DEFAULT ,
2000 ,
( px4_main_t ) & task_main ,
nullptr ) ;
( char * const * ) argv ) ;
if ( _task_handle < 0 ) {
PX4_ERR ( " task start failed " ) ;
@ -263,7 +280,7 @@ int spektrum_rc_main(int argc, char *argv[])
@@ -263,7 +280,7 @@ int spektrum_rc_main(int argc, char *argv[])
if ( ! strcmp ( verb , " start " ) ) {
return spektrum_rc : : start ( ) ;
return spektrum_rc : : start ( argc - 1 , argv + 1 ) ;
}
else if ( ! strcmp ( verb , " stop " ) ) {