px4_work_queue: command line status output and shutdown empty queues

* adds a work_queue systemcmd that will bring a tree view of all active work queues and work items
 * WorkQueues now track attached WorkItems and will shutdown when the last WorkItem is detached
This commit is contained in:
Daniel Agar
2019-10-02 12:23:17 -04:00
committed by GitHub
parent cc1d86bc0b
commit 26364d44c9
167 changed files with 582 additions and 274 deletions

View File

@@ -291,6 +291,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "top once"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "top once"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param set LED_RGB_MAXBRT 0"' // disable rgbled sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param set LED_RGB_MAXBRT 0"' // disable rgbled
@@ -351,6 +352,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// run tests // run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
@@ -420,6 +422,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// run tests // run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
@@ -490,6 +493,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// run tests // run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
@@ -561,6 +565,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// run tests // run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
@@ -632,6 +637,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// critmon // critmon
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "critmon_start; sleep 5; critmon_stop"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "critmon_start; sleep 5; critmon_stop"'
// run tests // run tests
@@ -709,6 +715,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// irqinfo // irqinfo
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "irqinfo"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "irqinfo"'
// run tests // run tests
@@ -771,6 +778,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "top once"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "top once"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// run tests // run tests
// sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' // TODO: currently unusably slow // sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' // TODO: currently unusably slow
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
@@ -847,6 +855,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-SEGGER_*` --cmd "work_queue status"'
// run tests // run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-SEGGER_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-SEGGER_*`'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test
@@ -916,6 +925,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "uorb top -1"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ver all"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "work_queue status"'
// run tests // run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`'
// ensure buzzer is disabled for the next test // ensure buzzer is disabled for the next test

View File

@@ -148,8 +148,8 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
# add user to dialout group (serial port access) # add user to dialout group (serial port access)
sudo usermod -a -G dialout $USER sudo usermod -a -G dialout $USER
# Remove modem manager (interferes with PX4 serial port/USB serial usage). # Remove modem manager (interferes with PX4 serial port/USB serial usage).
sudo apt-get remove modemmanager -y sudo apt-get remove modemmanager -y
# arm-none-eabi-gcc # arm-none-eabi-gcc

View File

@@ -70,6 +70,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -97,6 +97,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -111,6 +111,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -111,6 +111,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -55,5 +55,6 @@ px4_add_board(
param param
top top
ver ver
work_queue
) )

View File

@@ -102,6 +102,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -102,6 +102,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -67,6 +67,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -65,6 +65,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -66,5 +66,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -74,6 +74,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -72,6 +72,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -69,5 +69,6 @@ px4_add_board(
topic_listener topic_listener
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -81,6 +81,7 @@ px4_add_board(
#topic_listener #topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -85,6 +85,7 @@ px4_add_board(
#topic_listener #topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -106,6 +106,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -101,6 +101,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -93,6 +93,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -59,4 +59,6 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
) )

View File

@@ -52,5 +52,6 @@ px4_add_board(
reboot reboot
top top
ver ver
work_queue
) )

View File

@@ -55,5 +55,6 @@ px4_add_board(
param param
top top
ver ver
work_queue
) )

View File

@@ -109,6 +109,7 @@ px4_add_board(
tune_control tune_control
#usb_connected #usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -81,4 +81,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -104,6 +104,7 @@ px4_add_board(
#topic_listener #topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -80,4 +80,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -72,4 +72,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -104,6 +104,7 @@ px4_add_board(
#topic_listener #topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -110,6 +110,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -110,6 +110,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -109,6 +109,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -96,6 +96,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -99,6 +99,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -96,6 +96,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -108,6 +108,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -108,6 +108,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -110,6 +110,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -110,6 +110,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -84,4 +84,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -110,6 +110,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -92,4 +92,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -85,4 +85,6 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
) )

View File

@@ -108,6 +108,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -109,6 +109,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -110,6 +110,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -66,6 +66,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -65,6 +65,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -69,6 +69,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -70,6 +70,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -69,6 +69,7 @@ px4_add_board(
topic_listener topic_listener
tune_control tune_control
ver ver
work_queue
EXAMPLES EXAMPLES
bottle_drop # OBC challenge bottle_drop # OBC challenge

View File

@@ -45,5 +45,6 @@ px4_add_board(
reboot reboot
top top
ver ver
work_queue
) )

View File

@@ -103,6 +103,7 @@ px4_add_board(
tune_control tune_control
usb_connected usb_connected
ver ver
work_queue
EXAMPLES EXAMPLES
#bottle_drop # OBC challenge #bottle_drop # OBC challenge

View File

@@ -44,9 +44,6 @@ class ScheduledWorkItem : public WorkItem
{ {
public: public:
ScheduledWorkItem(const wq_config_t &config) : WorkItem(config) {}
virtual ~ScheduledWorkItem() override;
/** /**
* Schedule next run with a delay in microseconds. * Schedule next run with a delay in microseconds.
* *
@@ -58,7 +55,7 @@ public:
* Schedule repeating run with optional delay. * Schedule repeating run with optional delay.
* *
* @param interval_us The interval in microseconds. * @param interval_us The interval in microseconds.
* @param delay_us The delay (optional) in microseconds. * @param delay_us The delay (optional) in microseconds.
*/ */
void ScheduleOnInterval(uint32_t interval_us, uint32_t delay_us = 0); void ScheduleOnInterval(uint32_t interval_us, uint32_t delay_us = 0);
@@ -67,14 +64,20 @@ public:
*/ */
void ScheduleClear(); void ScheduleClear();
virtual void Run() override = 0; protected:
ScheduledWorkItem(const char *name, const wq_config_t &config) : WorkItem(name, config) {}
virtual ~ScheduledWorkItem() override;
virtual void print_run_status() const override;
private: private:
virtual void Run() override = 0;
static void schedule_trampoline(void *arg); static void schedule_trampoline(void *arg);
hrt_call _call{}; hrt_call _call{};
}; };
} // namespace px4 } // namespace px4

View File

@@ -33,7 +33,6 @@
#pragma once #pragma once
#include "WorkQueueManager.hpp" #include "WorkQueueManager.hpp"
#include "WorkQueue.hpp" #include "WorkQueue.hpp"
@@ -41,21 +40,18 @@
#include <px4_defines.h> #include <px4_defines.h>
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <lib/perf/perf_counter.h>
namespace px4 namespace px4
{ {
class WorkItem : public IntrusiveQueueNode<WorkItem *> class WorkItem : public ListNode<WorkItem *>, public IntrusiveQueueNode<WorkItem *>
{ {
public: public:
explicit WorkItem(const wq_config_t &config);
WorkItem() = delete;
virtual ~WorkItem();
inline void ScheduleNow() { if (_wq != nullptr) _wq->Add(this); } inline void ScheduleNow() { if (_wq != nullptr) _wq->Add(this); }
virtual void Run() = 0; virtual void print_run_status() const;
/** /**
* Switch to a different WorkQueue. * Switch to a different WorkQueue.
@@ -68,6 +64,18 @@ public:
protected: protected:
explicit WorkItem(const char *name, const wq_config_t &config);
WorkItem() = delete;
virtual ~WorkItem();
protected:
void RunPreamble() { _run_count++; }
friend void WorkQueue::Run();
virtual void Run() = 0;
/** /**
* Initialize WorkItem given a WorkQueue config. This call * Initialize WorkItem given a WorkQueue config. This call
* can also be used to switch to a different WorkQueue. * can also be used to switch to a different WorkQueue.
@@ -79,9 +87,18 @@ protected:
bool Init(const wq_config_t &config); bool Init(const wq_config_t &config);
void Deinit(); void Deinit();
float elapsed_time() const;
float average_rate() const;
float average_interval() const;
hrt_abstime _start_time{0};
unsigned _run_count{0};
const char *_item_name;
private: private:
WorkQueue *_wq{nullptr}; WorkQueue *_wq{nullptr};
}; };

View File

@@ -35,6 +35,7 @@
#include "WorkQueueManager.hpp" #include "WorkQueueManager.hpp"
#include <containers/BlockingList.hpp>
#include <containers/List.hpp> #include <containers/List.hpp>
#include <containers/IntrusiveQueue.hpp> #include <containers/IntrusiveQueue.hpp>
#include <px4_atomic.h> #include <px4_atomic.h>
@@ -57,6 +58,9 @@ public:
const char *get_name() { return _config.name; } const char *get_name() { return _config.name; }
bool Attach(WorkItem *item);
void Detach(WorkItem *item);
void Add(WorkItem *item); void Add(WorkItem *item);
void Remove(WorkItem *item); void Remove(WorkItem *item);
@@ -66,7 +70,7 @@ public:
void request_stop() { _should_exit.store(true); } void request_stop() { _should_exit.store(true); }
void print_status(); void print_status(bool last = false);
private: private:
@@ -84,10 +88,10 @@ private:
#endif #endif
IntrusiveQueue<WorkItem *> _q; IntrusiveQueue<WorkItem *> _q;
px4_sem_t _process_lock; px4_sem_t _process_lock;
const wq_config_t &_config;
px4::atomic_bool _should_exit{false}; BlockingList<WorkItem *> _work_items;
const wq_config_t &_config; px4::atomic_bool _should_exit{false};
}; };

View File

@@ -82,6 +82,11 @@ int WorkQueueManagerStart();
*/ */
int WorkQueueManagerStop(); int WorkQueueManagerStop();
/**
* Work queue manager status.
*/
int WorkQueueManagerStatus();
/** /**
* Create (or find) a work queue with a particular configuration. * Create (or find) a work queue with a particular configuration.
* *

View File

@@ -41,25 +41,44 @@ ScheduledWorkItem::~ScheduledWorkItem()
ScheduleClear(); ScheduleClear();
} }
void ScheduledWorkItem::schedule_trampoline(void *arg) void
ScheduledWorkItem::schedule_trampoline(void *arg)
{ {
ScheduledWorkItem *dev = reinterpret_cast<ScheduledWorkItem *>(arg); ScheduledWorkItem *dev = reinterpret_cast<ScheduledWorkItem *>(arg);
dev->ScheduleNow(); dev->ScheduleNow();
} }
void ScheduledWorkItem::ScheduleDelayed(uint32_t delay_us) void
ScheduledWorkItem::ScheduleDelayed(uint32_t delay_us)
{ {
hrt_call_after(&_call, delay_us, (hrt_callout)&ScheduledWorkItem::schedule_trampoline, this); hrt_call_after(&_call, delay_us, (hrt_callout)&ScheduledWorkItem::schedule_trampoline, this);
} }
void ScheduledWorkItem::ScheduleOnInterval(uint32_t interval_us, uint32_t delay_us) void
ScheduledWorkItem::ScheduleOnInterval(uint32_t interval_us, uint32_t delay_us)
{ {
// reset start time to first deadline (approximately)
_start_time = hrt_absolute_time() + interval_us + delay_us;
hrt_call_every(&_call, delay_us, interval_us, (hrt_callout)&ScheduledWorkItem::schedule_trampoline, this); hrt_call_every(&_call, delay_us, interval_us, (hrt_callout)&ScheduledWorkItem::schedule_trampoline, this);
} }
void ScheduledWorkItem::ScheduleClear() void
ScheduledWorkItem::ScheduleClear()
{ {
hrt_cancel(&_call); hrt_cancel(&_call);
} }
void
ScheduledWorkItem::print_run_status() const
{
if (_call.period > 0) {
PX4_INFO_RAW("%-24s %8.1f Hz %12.1f us (%" PRId64 " us)\n", _item_name, (double)average_rate(),
(double)average_interval(), _call.period);
} else {
WorkItem::print_run_status();
}
}
} // namespace px4 } // namespace px4

View File

@@ -42,7 +42,8 @@
namespace px4 namespace px4
{ {
WorkItem::WorkItem(const wq_config_t &config) WorkItem::WorkItem(const char *name, const wq_config_t &config) :
_item_name(name)
{ {
if (!Init(config)) { if (!Init(config)) {
PX4_ERR("init failed"); PX4_ERR("init failed");
@@ -54,25 +55,26 @@ WorkItem::~WorkItem()
Deinit(); Deinit();
} }
bool WorkItem::Init(const wq_config_t &config) bool
WorkItem::Init(const wq_config_t &config)
{ {
// clear any existing first // clear any existing first
Deinit(); Deinit();
px4::WorkQueue *wq = WorkQueueFindOrCreate(config); px4::WorkQueue *wq = WorkQueueFindOrCreate(config);
if (wq == nullptr) { if ((wq != nullptr) && wq->Attach(this)) {
PX4_ERR("%s not available", config.name);
} else {
_wq = wq; _wq = wq;
_start_time = hrt_absolute_time();
return true; return true;
} }
PX4_ERR("%s not available", config.name);
return false; return false;
} }
void WorkItem::Deinit() void
WorkItem::Deinit()
{ {
// remove any currently queued work // remove any currently queued work
if (_wq != nullptr) { if (_wq != nullptr) {
@@ -80,8 +82,47 @@ void WorkItem::Deinit()
px4::WorkQueue *wq_temp = _wq; px4::WorkQueue *wq_temp = _wq;
_wq = nullptr; _wq = nullptr;
// remove any queued work
wq_temp->Remove(this); wq_temp->Remove(this);
wq_temp->Detach(this);
} }
} }
float
WorkItem::elapsed_time() const
{
return hrt_elapsed_time(&_start_time) / 1e6f;
}
float
WorkItem::average_rate() const
{
const float rate = _run_count / elapsed_time();
if (PX4_ISFINITE(rate)) {
return rate;
}
return 0.0f;
}
float
WorkItem::average_interval() const
{
const float interval = 1000000.0f / average_rate();
if (PX4_ISFINITE(interval)) {
return interval;
}
return 0.0f;
}
void
WorkItem::print_run_status() const
{
PX4_INFO_RAW("%-24s %8.1f Hz %12.1f us\n", _item_name, (double)average_rate(), (double)average_interval());
}
} // namespace px4 } // namespace px4

View File

@@ -72,10 +72,44 @@ WorkQueue::~WorkQueue()
#endif /* __PX4_NUTTX */ #endif /* __PX4_NUTTX */
} }
void WorkQueue::Add(WorkItem *item) bool
WorkQueue::Attach(WorkItem *item)
{ {
// TODO: prevent additions when shutting down work_lock();
if (!should_exit()) {
_work_items.add(item);
work_unlock();
return true;
}
work_unlock();
return false;
}
void
WorkQueue::Detach(WorkItem *item)
{
work_lock();
_work_items.remove(item);
if (_work_items.size() == 0) {
// shutdown, no active WorkItems
PX4_DEBUG("stopping: %s, last active WorkItem closing", _config.name);
request_stop();
// Wake up the worker thread
px4_sem_post(&_process_lock);
}
work_unlock();
}
void
WorkQueue::Add(WorkItem *item)
{
work_lock(); work_lock();
_q.push(item); _q.push(item);
work_unlock(); work_unlock();
@@ -84,14 +118,16 @@ void WorkQueue::Add(WorkItem *item)
px4_sem_post(&_process_lock); px4_sem_post(&_process_lock);
} }
void WorkQueue::Remove(WorkItem *item) void
WorkQueue::Remove(WorkItem *item)
{ {
work_lock(); work_lock();
_q.remove(item); _q.remove(item);
work_unlock(); work_unlock();
} }
void WorkQueue::Clear() void
WorkQueue::Clear()
{ {
work_lock(); work_lock();
@@ -102,7 +138,8 @@ void WorkQueue::Clear()
work_unlock(); work_unlock();
} }
void WorkQueue::Run() void
WorkQueue::Run()
{ {
while (!should_exit()) { while (!should_exit()) {
px4_sem_wait(&_process_lock); px4_sem_wait(&_process_lock);
@@ -114,17 +151,43 @@ void WorkQueue::Run()
WorkItem *work = _q.pop(); WorkItem *work = _q.pop();
work_unlock(); // unlock work queue to run (item may requeue itself) work_unlock(); // unlock work queue to run (item may requeue itself)
work->RunPreamble();
work->Run(); work->Run();
work_lock(); // re-lock work_lock(); // re-lock
} }
work_unlock(); work_unlock();
} }
PX4_DEBUG("%s: exiting", _config.name);
} }
void WorkQueue::print_status() void
WorkQueue::print_status(bool last)
{ {
PX4_INFO("WorkQueue: %s running", get_name()); const size_t num_items = _work_items.size();
PX4_INFO_RAW("%-16s\n", get_name());
size_t i = 0;
for (WorkItem *item : _work_items) {
i++;
if (last) {
PX4_INFO_RAW(" ");
} else {
PX4_INFO_RAW("| ");
}
if (i < num_items) {
PX4_INFO_RAW("|__ %zu) ", i);
} else {
PX4_INFO_RAW("\\__ %zu) ", i);
}
item->print_run_status();
}
} }
} // namespace px4 } // namespace px4

View File

@@ -59,10 +59,11 @@ static BlockingList<WorkQueue *> *_wq_manager_wqs_list{nullptr};
// queue of WorkQueues to be created (as threads in the wq manager task) // queue of WorkQueues to be created (as threads in the wq manager task)
static BlockingQueue<const wq_config_t *, 1> *_wq_manager_create_queue{nullptr}; static BlockingQueue<const wq_config_t *, 1> *_wq_manager_create_queue{nullptr};
static px4::atomic_bool _wq_manager_should_exit{false}; static px4::atomic_bool _wq_manager_should_exit{true};
static WorkQueue *FindWorkQueueByName(const char *name) static WorkQueue *
FindWorkQueueByName(const char *name)
{ {
if (_wq_manager_wqs_list == nullptr) { if (_wq_manager_wqs_list == nullptr) {
PX4_ERR("not running"); PX4_ERR("not running");
@@ -81,7 +82,8 @@ static WorkQueue *FindWorkQueueByName(const char *name)
return nullptr; return nullptr;
} }
WorkQueue *WorkQueueFindOrCreate(const wq_config_t &new_wq) WorkQueue *
WorkQueueFindOrCreate(const wq_config_t &new_wq)
{ {
if (_wq_manager_create_queue == nullptr) { if (_wq_manager_create_queue == nullptr) {
PX4_ERR("not running"); PX4_ERR("not running");
@@ -116,7 +118,8 @@ WorkQueue *WorkQueueFindOrCreate(const wq_config_t &new_wq)
return wq; return wq;
} }
const wq_config_t &device_bus_to_wq(uint32_t device_id_int) const wq_config_t &
device_bus_to_wq(uint32_t device_id_int)
{ {
union device::Device::DeviceId device_id; union device::Device::DeviceId device_id;
device_id.devid = device_id_int; device_id.devid = device_id_int;
@@ -155,7 +158,8 @@ const wq_config_t &device_bus_to_wq(uint32_t device_id_int)
return wq_configurations::hp_default; return wq_configurations::hp_default;
}; };
static void *WorkQueueRunner(void *context) static void *
WorkQueueRunner(void *context)
{ {
wq_config_t *config = static_cast<wq_config_t *>(context); wq_config_t *config = static_cast<wq_config_t *>(context);
WorkQueue wq(*config); WorkQueue wq(*config);
@@ -171,7 +175,8 @@ static void *WorkQueueRunner(void *context)
return nullptr; return nullptr;
} }
static int WorkQueueManagerRun(int, char **) static int
WorkQueueManagerRun(int, char **)
{ {
_wq_manager_wqs_list = new BlockingList<WorkQueue *>(); _wq_manager_wqs_list = new BlockingList<WorkQueue *>();
_wq_manager_create_queue = new BlockingQueue<const wq_config_t *, 1>(); _wq_manager_create_queue = new BlockingQueue<const wq_config_t *, 1>();
@@ -232,7 +237,7 @@ static int WorkQueueManagerRun(int, char **)
int ret_create = pthread_create(&thread, &attr, WorkQueueRunner, (void *)wq); int ret_create = pthread_create(&thread, &attr, WorkQueueRunner, (void *)wq);
if (ret_create == 0) { if (ret_create == 0) {
PX4_INFO("creating: %s, priority: %d, stack: %zu bytes", wq->name, param.sched_priority, stacksize); PX4_DEBUG("starting: %s, priority: %d, stack: %zu bytes", wq->name, param.sched_priority, stacksize);
} else { } else {
PX4_ERR("failed to create thread for %s (%i): %s", wq->name, ret_create, strerror(ret_create)); PX4_ERR("failed to create thread for %s (%i): %s", wq->name, ret_create, strerror(ret_create));
@@ -250,46 +255,113 @@ static int WorkQueueManagerRun(int, char **)
return 0; return 0;
} }
int WorkQueueManagerStart() int
WorkQueueManagerStart()
{ {
int task_id = px4_task_spawn_cmd("wq:manager", if (_wq_manager_should_exit.load() && (_wq_manager_create_queue == nullptr)) {
SCHED_DEFAULT,
PX4_WQ_HP_BASE,
1200,
(px4_main_t)&WorkQueueManagerRun,
nullptr);
if (task_id < 0) { _wq_manager_should_exit.store(false);
PX4_ERR("task start failed (%i)", task_id);
return -errno;
}
return 0; int task_id = px4_task_spawn_cmd("wq:manager",
} SCHED_DEFAULT,
PX4_WQ_HP_BASE,
1280,
(px4_main_t)&WorkQueueManagerRun,
nullptr);
int WorkQueueManagerStop() if (task_id < 0) {
{ _wq_manager_should_exit.store(true);
if (_wq_manager_wqs_list != nullptr) { PX4_ERR("task start failed (%i)", task_id);
auto lg = _wq_manager_wqs_list->getLockGuard(); return -errno;
// ask all work queues (threads) to stop
// NOTE: not currently safe without all WorkItems stopping first
for (WorkQueue *wq : *_wq_manager_wqs_list) {
wq->request_stop();
} }
delete _wq_manager_wqs_list; } else {
PX4_WARN("already running");
return PX4_ERROR;
} }
_wq_manager_should_exit.store(true); return PX4_OK;
}
if (_wq_manager_create_queue != nullptr) { int
// push nullptr to wake the wq manager task WorkQueueManagerStop()
_wq_manager_create_queue->push(nullptr); {
if (!_wq_manager_should_exit.load()) {
px4_usleep(1000); // error can't shutdown until all WorkItems are removed/stopped
if ((_wq_manager_wqs_list != nullptr) && (_wq_manager_wqs_list->size() > 0)) {
PX4_ERR("can't shutdown with active WQs");
WorkQueueManagerStatus();
return PX4_ERROR;
}
delete _wq_manager_create_queue; // first ask all WQs to stop
if (_wq_manager_wqs_list != nullptr) {
{
auto lg = _wq_manager_wqs_list->getLockGuard();
// ask all work queues (threads) to stop
// NOTE: not currently safe without all WorkItems stopping first
for (WorkQueue *wq : *_wq_manager_wqs_list) {
wq->request_stop();
}
}
// wait until they're all stopped (empty list)
while (_wq_manager_wqs_list->size() > 0) {
px4_usleep(1000);
}
delete _wq_manager_wqs_list;
}
_wq_manager_should_exit.store(true);
if (_wq_manager_create_queue != nullptr) {
// push nullptr to wake the wq manager task
_wq_manager_create_queue->push(nullptr);
px4_usleep(10000);
delete _wq_manager_create_queue;
}
} else {
PX4_WARN("not running");
return PX4_ERROR;
}
return PX4_OK;
}
int
WorkQueueManagerStatus()
{
if (!_wq_manager_should_exit.load() && (_wq_manager_wqs_list != nullptr)) {
const size_t num_wqs = _wq_manager_wqs_list->size();
PX4_INFO_RAW("\nWork Queue: %-1zu threads RATE INTERVAL\n", num_wqs);
auto lg = _wq_manager_wqs_list->getLockGuard();
size_t i = 0;
for (WorkQueue *wq : *_wq_manager_wqs_list) {
i++;
const bool last_wq = !(i < num_wqs);
if (!last_wq) {
PX4_INFO_RAW("|__ %zu) ", i);
} else {
PX4_INFO_RAW("\\__ %zu) ", i);
}
wq->print_status(last_wq);
}
} else {
PX4_INFO("not running");
} }
return PX4_OK; return PX4_OK;

View File

@@ -42,7 +42,7 @@ using namespace px4;
class WQueueScheduledTest : public px4::ScheduledWorkItem class WQueueScheduledTest : public px4::ScheduledWorkItem
{ {
public: public:
WQueueScheduledTest() : px4::ScheduledWorkItem(px4::wq_configurations::test2) {} WQueueScheduledTest() : px4::ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::test2) {}
~WQueueScheduledTest() = default; ~WQueueScheduledTest() = default;
int main(); int main();

View File

@@ -42,7 +42,7 @@ using namespace px4;
class WQueueTest : public px4::WorkItem class WQueueTest : public px4::WorkItem
{ {
public: public:
WQueueTest() : px4::WorkItem(px4::wq_configurations::test1) {} WQueueTest() : px4::WorkItem("WQueueTest", px4::wq_configurations::test1) {}
~WQueueTest() = default; ~WQueueTest() = default;
int main(); int main();

View File

@@ -75,6 +75,8 @@ perf
sleep 1 sleep 1
perf latency perf latency
sleep 1 sleep 1
work_queue status
sleep 1
uorb top -1 uorb top -1
sleep 1 sleep 1

View File

@@ -104,7 +104,7 @@ private:
ADC::ADC(uint32_t base_address, uint32_t channels) : ADC::ADC(uint32_t base_address, uint32_t channels) :
CDev(ADC0_DEVICE_PATH), CDev(ADC0_DEVICE_PATH),
ScheduledWorkItem(px4::wq_configurations::hp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_sample_perf(perf_alloc(PC_ELAPSED, "adc_samples")), _sample_perf(perf_alloc(PC_ELAPSED, "adc_samples")),
_base_address(base_address) _base_address(base_address)
{ {

View File

@@ -112,7 +112,7 @@ extern "C" __EXPORT int bmp280_main(int argc, char *argv[]);
BMP280::BMP280(bmp280::IBMP280 *interface, const char *path) : BMP280::BMP280(bmp280::IBMP280 *interface, const char *path) :
CDev(path), CDev(path),
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
_interface(interface), _interface(interface),
_running(false), _running(false),
_report_interval(0), _report_interval(0),

View File

@@ -44,7 +44,7 @@
LPS22HB::LPS22HB(device::Device *interface, const char *path) : LPS22HB::LPS22HB(device::Device *interface, const char *path) :
CDev(path), CDev(path),
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
_interface(interface), _interface(interface),
_sample_perf(perf_alloc(PC_ELAPSED, "lps22hb_read")), _sample_perf(perf_alloc(PC_ELAPSED, "lps22hb_read")),
_comms_errors(perf_alloc(PC_COUNT, "lps22hb_comms_errors")) _comms_errors(perf_alloc(PC_COUNT, "lps22hb_comms_errors"))

View File

@@ -261,7 +261,7 @@ extern "C" __EXPORT int lps25h_main(int argc, char *argv[]);
LPS25H::LPS25H(device::Device *interface, const char *path) : LPS25H::LPS25H(device::Device *interface, const char *path) :
CDev(path), CDev(path),
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
_interface(interface), _interface(interface),
_sample_perf(perf_alloc(PC_ELAPSED, "lps25h_read")), _sample_perf(perf_alloc(PC_ELAPSED, "lps25h_read")),
_comms_errors(perf_alloc(PC_COUNT, "lps25h_comms_errors")) _comms_errors(perf_alloc(PC_COUNT, "lps25h_comms_errors"))

View File

@@ -148,7 +148,7 @@ extern "C" __EXPORT int mpl3115a2_main(int argc, char *argv[]);
MPL3115A2::MPL3115A2(device::Device *interface, const char *path) : MPL3115A2::MPL3115A2(device::Device *interface, const char *path) :
CDev(path), CDev(path),
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
_interface(interface), _interface(interface),
_measure_interval(0), _measure_interval(0),
_reports(nullptr), _reports(nullptr),

View File

@@ -183,7 +183,7 @@ extern "C" __EXPORT int ms5611_main(int argc, char *argv[]);
MS5611::MS5611(device::Device *interface, ms5611::prom_u &prom_buf, const char *path, MS5611::MS5611(device::Device *interface, ms5611::prom_u &prom_buf, const char *path,
enum MS56XX_DEVICE_TYPES device_type) : enum MS56XX_DEVICE_TYPES device_type) :
CDev(path), CDev(path),
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
_interface(interface), _interface(interface),
_prom(prom_buf.s), _prom(prom_buf.s),
_reports(nullptr), _reports(nullptr),

View File

@@ -46,7 +46,7 @@
extern "C" __EXPORT int batt_smbus_main(int argc, char *argv[]); extern "C" __EXPORT int batt_smbus_main(int argc, char *argv[]);
BATT_SMBUS::BATT_SMBUS(SMBus *interface, const char *path) : BATT_SMBUS::BATT_SMBUS(SMBus *interface, const char *path) :
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
_interface(interface), _interface(interface),
_cycle(perf_alloc(PC_ELAPSED, "batt_smbus_cycle")), _cycle(perf_alloc(PC_ELAPSED, "batt_smbus_cycle")),
_batt_topic(nullptr), _batt_topic(nullptr),

View File

@@ -49,7 +49,7 @@ CameraCapture *g_camera_capture{nullptr};
} }
CameraCapture::CameraCapture() : CameraCapture::CameraCapture() :
ScheduledWorkItem(px4::wq_configurations::lp_default) ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default)
{ {
memset(&_work_publisher, 0, sizeof(_work_publisher)); memset(&_work_publisher, 0, sizeof(_work_publisher));

View File

@@ -233,7 +233,7 @@ CameraTrigger *g_camera_trigger;
} }
CameraTrigger::CameraTrigger() : CameraTrigger::CameraTrigger() :
ScheduledWorkItem(px4::wq_configurations::lp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default),
_engagecall {}, _engagecall {},
_disengagecall {}, _disengagecall {},
_engage_turn_on_off_call {}, _engage_turn_on_off_call {},

View File

@@ -84,7 +84,7 @@ static constexpr unsigned char crc_lsb_vector[] = {
}; };
CM8JL65::CM8JL65(const char *port, uint8_t rotation) : CM8JL65::CM8JL65(const char *port, uint8_t rotation) :
ScheduledWorkItem(px4::wq_configurations::hp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_px4_rangefinder(0 /* TODO: device ids */, ORB_PRIO_DEFAULT, rotation) _px4_rangefinder(0 /* TODO: device ids */, ORB_PRIO_DEFAULT, rotation)
{ {
// Store the port name. // Store the port name.

View File

@@ -174,7 +174,7 @@ private:
LeddarOne::LeddarOne(const char *device_path, const char *serial_port, uint8_t device_orientation): LeddarOne::LeddarOne(const char *device_path, const char *serial_port, uint8_t device_orientation):
CDev(device_path), CDev(device_path),
ScheduledWorkItem(px4::wq_configurations::hp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_px4_rangefinder(0 /* device id not yet used */, ORB_PRIO_DEFAULT, device_orientation) _px4_rangefinder(0 /* device id not yet used */, ORB_PRIO_DEFAULT, device_orientation)
{ {
_serial_port = strdup(serial_port); _serial_port = strdup(serial_port);

View File

@@ -52,7 +52,6 @@ LidarLite::LidarLite(const uint8_t rotation) :
LidarLite::~LidarLite() LidarLite::~LidarLite()
{ {
perf_free(_sample_perf); perf_free(_sample_perf);
perf_free(_sample_interval_perf);
perf_free(_comms_errors); perf_free(_comms_errors);
perf_free(_sensor_resets); perf_free(_sensor_resets);
perf_free(_sensor_zero_resets); perf_free(_sensor_zero_resets);
@@ -62,7 +61,6 @@ void
LidarLite::print_info() LidarLite::print_info()
{ {
perf_print_counter(_sample_perf); perf_print_counter(_sample_perf);
perf_print_counter(_sample_interval_perf);
perf_print_counter(_comms_errors); perf_print_counter(_comms_errors);
perf_print_counter(_sensor_resets); perf_print_counter(_sensor_resets);
perf_print_counter(_sensor_zero_resets); perf_print_counter(_sensor_zero_resets);

View File

@@ -90,7 +90,6 @@ protected:
PX4Rangefinder _px4_rangefinder; PX4Rangefinder _px4_rangefinder;
perf_counter_t _comms_errors{perf_alloc(PC_COUNT, "ll40ls: comms errors")}; perf_counter_t _comms_errors{perf_alloc(PC_COUNT, "ll40ls: comms errors")};
perf_counter_t _sample_interval_perf{perf_alloc(PC_ELAPSED, "ll40ls: interval")};
perf_counter_t _sample_perf{perf_alloc(PC_ELAPSED, "ll40ls: read")}; perf_counter_t _sample_perf{perf_alloc(PC_ELAPSED, "ll40ls: read")};
perf_counter_t _sensor_resets{perf_alloc(PC_COUNT, "ll40ls: resets")}; perf_counter_t _sensor_resets{perf_alloc(PC_COUNT, "ll40ls: resets")};
perf_counter_t _sensor_zero_resets{perf_alloc(PC_COUNT, "ll40ls: zero resets")}; perf_counter_t _sensor_zero_resets{perf_alloc(PC_COUNT, "ll40ls: zero resets")};

View File

@@ -44,7 +44,7 @@
LidarLiteI2C::LidarLiteI2C(const int bus, const uint8_t rotation, const int address) : LidarLiteI2C::LidarLiteI2C(const int bus, const uint8_t rotation, const int address) :
LidarLite(rotation), LidarLite(rotation),
I2C("LL40LS", nullptr, bus, address, 100000), I2C("LL40LS", nullptr, bus, address, 100000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())) ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id()))
{ {
// up the retries since the device misses the first measure attempts // up the retries since the device misses the first measure attempts
_retries = 3; _retries = 3;

View File

@@ -46,7 +46,7 @@
LidarLitePWM::LidarLitePWM(const uint8_t rotation) : LidarLitePWM::LidarLitePWM(const uint8_t rotation) :
LidarLite(rotation), LidarLite(rotation),
ScheduledWorkItem(px4::wq_configurations::hp_default) ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default)
{ {
} }

View File

@@ -225,7 +225,7 @@ private:
MappyDot::MappyDot(const int bus) : MappyDot::MappyDot(const int bus) :
I2C("MappyDot", MAPPYDOT_DEVICE_PATH, bus, MAPPYDOT_BASE_ADDR, MAPPYDOT_BUS_CLOCK), I2C("MappyDot", MAPPYDOT_DEVICE_PATH, bus, MAPPYDOT_BASE_ADDR, MAPPYDOT_BUS_CLOCK),
ModuleParams(nullptr), ModuleParams(nullptr),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())) ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id()))
{} {}
MappyDot::~MappyDot() MappyDot::~MappyDot()

View File

@@ -181,7 +181,7 @@ private:
MB12XX::MB12XX(const int bus) : MB12XX::MB12XX(const int bus) :
I2C("MB12xx", MB12XX_DEVICE_PATH, bus, MB12XX_BASE_ADDR, MB12XX_BUS_SPEED), I2C("MB12xx", MB12XX_DEVICE_PATH, bus, MB12XX_BASE_ADDR, MB12XX_BUS_SPEED),
ModuleParams(nullptr), ModuleParams(nullptr),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())) ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id()))
{ {
} }

View File

@@ -157,7 +157,7 @@ extern "C" __EXPORT int sf0x_main(int argc, char *argv[]);
SF0X::SF0X(const char *port, uint8_t rotation) : SF0X::SF0X(const char *port, uint8_t rotation) :
CDev(RANGE_FINDER0_DEVICE_PATH), CDev(RANGE_FINDER0_DEVICE_PATH),
ScheduledWorkItem(px4::wq_configurations::hp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_rotation(rotation), _rotation(rotation),
_min_distance(0.30f), _min_distance(0.30f),
_max_distance(40.0f), _max_distance(40.0f),

View File

@@ -167,7 +167,7 @@ extern "C" __EXPORT int sf1xx_main(int argc, char *argv[]);
SF1XX::SF1XX(uint8_t rotation, int bus, int address) : SF1XX::SF1XX(uint8_t rotation, int bus, int address) :
I2C("SF1XX", SF1XX_DEVICE_PATH, bus, address, 400000), I2C("SF1XX", SF1XX_DEVICE_PATH, bus, address, 400000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_rotation(rotation) _rotation(rotation)
{ {
} }

View File

@@ -172,7 +172,7 @@ extern "C" __EXPORT int srf02_main(int argc, char *argv[]);
SRF02::SRF02(uint8_t rotation, int bus, int address) : SRF02::SRF02(uint8_t rotation, int bus, int address) :
I2C("SRF02", SRF02_DEVICE_PATH, bus, address, 100000), I2C("SRF02", SRF02_DEVICE_PATH, bus, address, 100000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_rotation(rotation) _rotation(rotation)
{ {
} }

View File

@@ -192,7 +192,7 @@ static uint8_t crc8(uint8_t *p, uint8_t len)
TERARANGER::TERARANGER(const int bus, const uint8_t orientation, const int address) : TERARANGER::TERARANGER(const int bus, const uint8_t orientation, const int address) :
I2C("TERARANGER", TERARANGER_DEVICE_PATH, bus, address, 100000), I2C("TERARANGER", TERARANGER_DEVICE_PATH, bus, address, 100000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_orientation(orientation) _orientation(orientation)
{ {
// up the retries since the device misses the first measure attempts // up the retries since the device misses the first measure attempts

View File

@@ -34,7 +34,7 @@
#include "TFMINI.hpp" #include "TFMINI.hpp"
TFMINI::TFMINI(const char *port, uint8_t rotation) : TFMINI::TFMINI(const char *port, uint8_t rotation) :
ScheduledWorkItem(px4::wq_configurations::hp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_px4_rangefinder(0 /* TODO: device id */, ORB_PRIO_DEFAULT, rotation) _px4_rangefinder(0 /* TODO: device id */, ORB_PRIO_DEFAULT, rotation)
{ {
// store port name // store port name

View File

@@ -172,7 +172,7 @@ private:
Radar::Radar(const char *port, uint8_t rotation) : Radar::Radar(const char *port, uint8_t rotation) :
CDev(RANGE_FINDER0_DEVICE_PATH), CDev(RANGE_FINDER0_DEVICE_PATH),
ScheduledWorkItem(px4::wq_configurations::hp_default), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_rotation(rotation) _rotation(rotation)
{ {
/* store port name */ /* store port name */

View File

@@ -167,7 +167,7 @@ private:
VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) : VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) :
I2C("VL53LXX", VL53LXX_DEVICE_PATH, bus, address, 400000), I2C("VL53LXX", VL53LXX_DEVICE_PATH, bus, address, 400000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_rotation(rotation) _rotation(rotation)
{ {
// Allow 3 retries as the device typically misses the first measure attempts. // Allow 3 retries as the device typically misses the first measure attempts.

View File

@@ -51,7 +51,7 @@
Heater::Heater() : Heater::Heater() :
ModuleParams(nullptr), ModuleParams(nullptr),
ScheduledWorkItem(px4::wq_configurations::lp_default) ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default)
{ {
px4_arch_configgpio(GPIO_HEATER_OUTPUT); px4_arch_configgpio(GPIO_HEATER_OUTPUT);
px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, 0); px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, 0);

View File

@@ -39,7 +39,7 @@
ADIS16448::ADIS16448(int bus, uint32_t device, enum Rotation rotation) : ADIS16448::ADIS16448(int bus, uint32_t device, enum Rotation rotation) :
SPI("ADIS16448", nullptr, bus, device, SPIDEV_MODE3, 1000000), SPI("ADIS16448", nullptr, bus, device, SPIDEV_MODE3, 1000000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation), _px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
_px4_baro(get_device_id(), ORB_PRIO_MAX), _px4_baro(get_device_id(), ORB_PRIO_MAX),
_px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation), _px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation),
@@ -64,7 +64,6 @@ ADIS16448::~ADIS16448()
// Delete the perf counter. // Delete the perf counter.
perf_free(_perf_read); perf_free(_perf_read);
perf_free(_perf_read_interval);
perf_free(_perf_transfer); perf_free(_perf_transfer);
perf_free(_perf_bad_transfer); perf_free(_perf_bad_transfer);
perf_free(_perf_crc_bad); perf_free(_perf_crc_bad);
@@ -314,7 +313,6 @@ void
ADIS16448::print_info() ADIS16448::print_info()
{ {
perf_print_counter(_perf_read); perf_print_counter(_perf_read);
perf_print_counter(_perf_read_interval);
perf_print_counter(_perf_transfer); perf_print_counter(_perf_transfer);
perf_print_counter(_perf_bad_transfer); perf_print_counter(_perf_bad_transfer);
perf_print_counter(_perf_crc_bad); perf_print_counter(_perf_crc_bad);
@@ -444,8 +442,6 @@ convert12BitToINT16(uint16_t word)
int int
ADIS16448::measure() ADIS16448::measure()
{ {
perf_count(_perf_read_interval);
// Start measuring. // Start measuring.
perf_begin(_perf_read); perf_begin(_perf_read);

View File

@@ -211,7 +211,6 @@ private:
static constexpr float _sample_rate{ADIS16448_ACCEL_GYRO_UPDATE_RATE}; static constexpr float _sample_rate{ADIS16448_ACCEL_GYRO_UPDATE_RATE};
perf_counter_t _perf_read{perf_counter_t(perf_alloc(PC_ELAPSED, "ADIS16448: read"))}; perf_counter_t _perf_read{perf_counter_t(perf_alloc(PC_ELAPSED, "ADIS16448: read"))};
perf_counter_t _perf_read_interval{perf_alloc(PC_INTERVAL, "ADIS16448: read interval")};
perf_counter_t _perf_transfer{perf_counter_t(perf_alloc(PC_ELAPSED, "ADIS16448: transfer"))}; perf_counter_t _perf_transfer{perf_counter_t(perf_alloc(PC_ELAPSED, "ADIS16448: transfer"))};
perf_counter_t _perf_bad_transfer{perf_counter_t(perf_alloc(PC_COUNT, "ADIS16448: bad transfers"))}; perf_counter_t _perf_bad_transfer{perf_counter_t(perf_alloc(PC_COUNT, "ADIS16448: bad transfers"))};
perf_counter_t _perf_crc_bad{perf_counter_t(perf_alloc(PC_COUNT, "ADIS16448: CRC16 bad"))}; perf_counter_t _perf_crc_bad{perf_counter_t(perf_alloc(PC_COUNT, "ADIS16448: CRC16 bad"))};

View File

@@ -55,10 +55,9 @@ using namespace time_literals;
ADIS16477::ADIS16477(int bus, uint32_t device, enum Rotation rotation) : ADIS16477::ADIS16477(int bus, uint32_t device, enum Rotation rotation) :
SPI("ADIS16477", nullptr, bus, device, SPIDEV_MODE3, 1000000), SPI("ADIS16477", nullptr, bus, device, SPIDEV_MODE3, 1000000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation), _px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
_px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation), _px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation),
_sample_interval_perf(perf_alloc(PC_INTERVAL, "adis16477: read interval")),
_sample_perf(perf_alloc(PC_ELAPSED, "adis16477: read")), _sample_perf(perf_alloc(PC_ELAPSED, "adis16477: read")),
_bad_transfers(perf_alloc(PC_COUNT, "adis16477: bad transfers")) _bad_transfers(perf_alloc(PC_COUNT, "adis16477: bad transfers"))
{ {
@@ -82,7 +81,6 @@ ADIS16477::~ADIS16477()
stop(); stop();
// delete the perf counters // delete the perf counters
perf_free(_sample_interval_perf);
perf_free(_sample_perf); perf_free(_sample_perf);
perf_free(_bad_transfers); perf_free(_bad_transfers);
} }
@@ -321,7 +319,6 @@ ADIS16477::Run()
int int
ADIS16477::measure() ADIS16477::measure()
{ {
perf_count(_sample_interval_perf);
perf_begin(_sample_perf); perf_begin(_sample_perf);
// Fetch the full set of measurements from the ADIS16477 in one pass (burst read). // Fetch the full set of measurements from the ADIS16477 in one pass (burst read).
@@ -391,7 +388,6 @@ ADIS16477::measure()
void void
ADIS16477::print_info() ADIS16477::print_info()
{ {
perf_print_counter(_sample_interval_perf);
perf_print_counter(_sample_perf); perf_print_counter(_sample_perf);
perf_print_counter(_bad_transfers); perf_print_counter(_bad_transfers);

View File

@@ -65,7 +65,6 @@ private:
PX4Accelerometer _px4_accel; PX4Accelerometer _px4_accel;
PX4Gyroscope _px4_gyro; PX4Gyroscope _px4_gyro;
perf_counter_t _sample_interval_perf;
perf_counter_t _sample_perf; perf_counter_t _sample_perf;
perf_counter_t _bad_transfers; perf_counter_t _bad_transfers;

View File

@@ -68,10 +68,9 @@ using namespace time_literals;
ADIS16497::ADIS16497(int bus, uint32_t device, enum Rotation rotation) : ADIS16497::ADIS16497(int bus, uint32_t device, enum Rotation rotation) :
SPI("ADIS16497", nullptr, bus, device, SPIDEV_MODE3, 5000000), SPI("ADIS16497", nullptr, bus, device, SPIDEV_MODE3, 5000000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation), _px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
_px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation), _px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation),
_sample_interval_perf(perf_alloc(PC_INTERVAL, "adis16497: read interval")),
_sample_perf(perf_alloc(PC_ELAPSED, "adis16497: read")), _sample_perf(perf_alloc(PC_ELAPSED, "adis16497: read")),
_bad_transfers(perf_alloc(PC_COUNT, "adis16497: bad transfers")) _bad_transfers(perf_alloc(PC_COUNT, "adis16497: bad transfers"))
{ {
@@ -95,7 +94,6 @@ ADIS16497::~ADIS16497()
stop(); stop();
// delete the perf counters // delete the perf counters
perf_free(_sample_interval_perf);
perf_free(_sample_perf); perf_free(_sample_perf);
perf_free(_bad_transfers); perf_free(_bad_transfers);
} }
@@ -384,7 +382,6 @@ ADIS16497::Run()
int int
ADIS16497::measure() ADIS16497::measure()
{ {
perf_count(_sample_interval_perf);
perf_begin(_sample_perf); perf_begin(_sample_perf);
// Fetch the full set of measurements from the ADIS16497 in one pass (burst read). // Fetch the full set of measurements from the ADIS16497 in one pass (burst read).
@@ -468,7 +465,6 @@ ADIS16497::measure()
void void
ADIS16497::print_info() ADIS16497::print_info()
{ {
perf_print_counter(_sample_interval_perf);
perf_print_counter(_sample_perf); perf_print_counter(_sample_perf);
perf_print_counter(_bad_transfers); perf_print_counter(_bad_transfers);

View File

@@ -101,7 +101,6 @@ private:
PX4Accelerometer _px4_accel; PX4Accelerometer _px4_accel;
PX4Gyroscope _px4_gyro; PX4Gyroscope _px4_gyro;
perf_counter_t _sample_interval_perf;
perf_counter_t _sample_perf; perf_counter_t _sample_perf;
perf_counter_t _bad_transfers; perf_counter_t _bad_transfers;

View File

@@ -223,7 +223,7 @@ private:
BMA180::BMA180(int bus, uint32_t device) : BMA180::BMA180(int bus, uint32_t device) :
SPI("BMA180", ACCEL_DEVICE_PATH, bus, device, SPIDEV_MODE3, 8000000), SPI("BMA180", ACCEL_DEVICE_PATH, bus, device, SPIDEV_MODE3, 8000000),
ScheduledWorkItem(px4::device_bus_to_wq(this->get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(this->get_device_id())),
_call_interval(0), _call_interval(0),
_reports(nullptr), _reports(nullptr),
_accel_range_scale(0.0f), _accel_range_scale(0.0f),

View File

@@ -46,10 +46,9 @@ const uint8_t BMI055_accel::_checked_registers[BMI055_ACCEL_NUM_CHECKED_REGISTER
BMI055_accel::BMI055_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation) : BMI055_accel::BMI055_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation) :
BMI055("BMI055_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation), BMI055("BMI055_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_px4_accel(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation), _px4_accel(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
_sample_perf(perf_alloc(PC_ELAPSED, "bmi055_accel_read")), _sample_perf(perf_alloc(PC_ELAPSED, "bmi055_accel_read")),
_measure_interval(perf_alloc(PC_INTERVAL, "bmi055_accel_measure_interval")),
_bad_transfers(perf_alloc(PC_COUNT, "bmi055_accel_bad_transfers")), _bad_transfers(perf_alloc(PC_COUNT, "bmi055_accel_bad_transfers")),
_bad_registers(perf_alloc(PC_COUNT, "bmi055_accel_bad_registers")), _bad_registers(perf_alloc(PC_COUNT, "bmi055_accel_bad_registers")),
_duplicates(perf_alloc(PC_COUNT, "bmi055_accel_duplicates")), _duplicates(perf_alloc(PC_COUNT, "bmi055_accel_duplicates")),
@@ -65,7 +64,6 @@ BMI055_accel::~BMI055_accel()
/* delete the perf counter */ /* delete the perf counter */
perf_free(_sample_perf); perf_free(_sample_perf);
perf_free(_measure_interval);
perf_free(_bad_transfers); perf_free(_bad_transfers);
perf_free(_bad_registers); perf_free(_bad_registers);
perf_free(_duplicates); perf_free(_duplicates);
@@ -286,8 +284,6 @@ BMI055_accel::check_registers(void)
void void
BMI055_accel::measure() BMI055_accel::measure()
{ {
perf_count(_measure_interval);
if (hrt_absolute_time() < _reset_wait) { if (hrt_absolute_time() < _reset_wait) {
// we're waiting for a reset to complete // we're waiting for a reset to complete
return; return;
@@ -409,7 +405,6 @@ void
BMI055_accel::print_info() BMI055_accel::print_info()
{ {
perf_print_counter(_sample_perf); perf_print_counter(_sample_perf);
perf_print_counter(_measure_interval);
perf_print_counter(_bad_transfers); perf_print_counter(_bad_transfers);
perf_print_counter(_bad_registers); perf_print_counter(_bad_registers);
perf_print_counter(_duplicates); perf_print_counter(_duplicates);

View File

@@ -169,7 +169,6 @@ private:
PX4Accelerometer _px4_accel; PX4Accelerometer _px4_accel;
perf_counter_t _sample_perf; perf_counter_t _sample_perf;
perf_counter_t _measure_interval;
perf_counter_t _bad_transfers; perf_counter_t _bad_transfers;
perf_counter_t _bad_registers; perf_counter_t _bad_registers;
perf_counter_t _duplicates; perf_counter_t _duplicates;

View File

@@ -49,10 +49,9 @@ const uint8_t BMI055_gyro::_checked_registers[BMI055_GYRO_NUM_CHECKED_REGISTERS]
BMI055_gyro::BMI055_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) : BMI055_gyro::BMI055_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) :
BMI055("BMI055_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation), BMI055("BMI055_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())), ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_px4_gyro(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation), _px4_gyro(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
_sample_perf(perf_alloc(PC_ELAPSED, "bmi055_gyro_read")), _sample_perf(perf_alloc(PC_ELAPSED, "bmi055_gyro_read")),
_measure_interval(perf_alloc(PC_INTERVAL, "bmi055_gyro_measure_interval")),
_bad_transfers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_transfers")), _bad_transfers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_transfers")),
_bad_registers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_registers")) _bad_registers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_registers"))
{ {
@@ -66,7 +65,6 @@ BMI055_gyro::~BMI055_gyro()
/* delete the perf counter */ /* delete the perf counter */
perf_free(_sample_perf); perf_free(_sample_perf);
perf_free(_measure_interval);
perf_free(_bad_transfers); perf_free(_bad_transfers);
perf_free(_bad_registers); perf_free(_bad_registers);
} }
@@ -322,8 +320,6 @@ BMI055_gyro::check_registers(void)
void void
BMI055_gyro::measure() BMI055_gyro::measure()
{ {
perf_count(_measure_interval);
if (hrt_absolute_time() < _reset_wait) { if (hrt_absolute_time() < _reset_wait) {
// we're waiting for a reset to complete // we're waiting for a reset to complete
return; return;
@@ -421,7 +417,6 @@ BMI055_gyro::print_info()
PX4_INFO("Gyro"); PX4_INFO("Gyro");
perf_print_counter(_sample_perf); perf_print_counter(_sample_perf);
perf_print_counter(_measure_interval);
perf_print_counter(_bad_transfers); perf_print_counter(_bad_transfers);
perf_print_counter(_bad_registers); perf_print_counter(_bad_registers);

View File

@@ -161,7 +161,6 @@ private:
PX4Gyroscope _px4_gyro; PX4Gyroscope _px4_gyro;
perf_counter_t _sample_perf; perf_counter_t _sample_perf;
perf_counter_t _measure_interval;
perf_counter_t _bad_transfers; perf_counter_t _bad_transfers;
perf_counter_t _bad_registers; perf_counter_t _bad_registers;

Some files were not shown because too many files have changed in this diff Show More