mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-14 20:31:35 +08:00
Showcase clang-format google style
This commit is contained in:
@@ -31,16 +31,15 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "wqueue_test.h"
|
||||
#include "wqueue_scheduled_test.h"
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/init.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int PX4_MAIN(int argc, char **argv)
|
||||
{
|
||||
#include "wqueue_scheduled_test.h"
|
||||
#include "wqueue_test.h"
|
||||
|
||||
int PX4_MAIN(int argc, char **argv) {
|
||||
px4::init(argc, argv, "wqueue_test");
|
||||
|
||||
PX4_INFO("wqueue test 1");
|
||||
|
||||
@@ -34,20 +34,18 @@
|
||||
#include "wqueue_scheduled_test.h"
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <inttypes.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace px4;
|
||||
|
||||
AppState WQueueScheduledTest::appState;
|
||||
|
||||
void WQueueScheduledTest::Run()
|
||||
{
|
||||
//PX4_INFO("iter: %d elapsed: %" PRId64 " us", _iter, hrt_elapsed_time(&_qtime));
|
||||
void WQueueScheduledTest::Run() {
|
||||
// PX4_INFO("iter: %d elapsed: %" PRId64 " us", _iter, hrt_elapsed_time(&_qtime));
|
||||
|
||||
if (_iter > 1000) {
|
||||
appState.requestExit();
|
||||
@@ -56,8 +54,7 @@ void WQueueScheduledTest::Run()
|
||||
_iter++;
|
||||
}
|
||||
|
||||
int WQueueScheduledTest::main()
|
||||
{
|
||||
int WQueueScheduledTest::main() {
|
||||
appState.setRunning(true);
|
||||
|
||||
_iter = 0;
|
||||
@@ -72,7 +69,7 @@ int WQueueScheduledTest::main()
|
||||
|
||||
PX4_INFO("WQueueScheduledTest finished");
|
||||
|
||||
//print_status();
|
||||
// print_status();
|
||||
|
||||
px4_sleep(2);
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
|
||||
#include <string.h>
|
||||
|
||||
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
|
||||
|
||||
using namespace px4;
|
||||
|
||||
class WQueueScheduledTest : public px4::ScheduledWorkItem
|
||||
{
|
||||
class WQueueScheduledTest : public px4::ScheduledWorkItem {
|
||||
public:
|
||||
WQueueScheduledTest() : px4::ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::test2) {}
|
||||
~WQueueScheduledTest() = default;
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
static px4::AppState appState; /* track requests to terminate app */
|
||||
|
||||
private:
|
||||
|
||||
void Run() override;
|
||||
|
||||
int _iter{0};
|
||||
|
||||
@@ -31,39 +31,32 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "wqueue_test.h"
|
||||
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
|
||||
static int daemon_task = -1; /* Handle of daemon task / thread */
|
||||
#include "wqueue_test.h"
|
||||
|
||||
static int daemon_task = -1; /* Handle of daemon task / thread */
|
||||
|
||||
extern "C" __EXPORT int wqueue_test_main(int argc, char *argv[]);
|
||||
int wqueue_test_main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
int wqueue_test_main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
PX4_INFO("usage: wqueue_test {start|stop|status}\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
|
||||
if (WQueueTest::appState.isRunning()) {
|
||||
PX4_INFO("already running\n");
|
||||
/* this is not an error */
|
||||
return 0;
|
||||
}
|
||||
|
||||
daemon_task = px4_task_spawn_cmd("wqueue",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
2000,
|
||||
PX4_MAIN,
|
||||
daemon_task = px4_task_spawn_cmd("wqueue", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2000, PX4_MAIN,
|
||||
(argv[2]) ? (char *const *)&argv[2] : (char *const *)nullptr);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -34,20 +34,18 @@
|
||||
#include "wqueue_test.h"
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <inttypes.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace px4;
|
||||
|
||||
AppState WQueueTest::appState;
|
||||
|
||||
void WQueueTest::Run()
|
||||
{
|
||||
//PX4_INFO("iter: %d elapsed: %" PRId64 " us", _iter, hrt_elapsed_time(&_qtime));
|
||||
void WQueueTest::Run() {
|
||||
// PX4_INFO("iter: %d elapsed: %" PRId64 " us", _iter, hrt_elapsed_time(&_qtime));
|
||||
|
||||
if (_iter > 10000) {
|
||||
appState.requestExit();
|
||||
@@ -59,8 +57,7 @@ void WQueueTest::Run()
|
||||
_iter++;
|
||||
}
|
||||
|
||||
int WQueueTest::main()
|
||||
{
|
||||
int WQueueTest::main() {
|
||||
appState.setRunning(true);
|
||||
|
||||
_iter = 0;
|
||||
@@ -75,7 +72,7 @@ int WQueueTest::main()
|
||||
|
||||
PX4_INFO("WQueueTest finished");
|
||||
|
||||
//print_status();
|
||||
// print_status();
|
||||
|
||||
px4_sleep(2);
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/px4_work_queue/WorkItem.hpp>
|
||||
#include <string.h>
|
||||
|
||||
#include <px4_platform_common/px4_work_queue/WorkItem.hpp>
|
||||
|
||||
using namespace px4;
|
||||
|
||||
class WQueueTest : public px4::WorkItem
|
||||
{
|
||||
class WQueueTest : public px4::WorkItem {
|
||||
public:
|
||||
WQueueTest() : px4::WorkItem("WQueueTest", px4::wq_configurations::test1) {}
|
||||
~WQueueTest() = default;
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
static px4::AppState appState; /* track requests to terminate app */
|
||||
|
||||
private:
|
||||
|
||||
void Run() override;
|
||||
|
||||
int _iter{0};
|
||||
|
||||
Reference in New Issue
Block a user