Showcase clang-format google style

This commit is contained in:
Matthias Grob
2022-06-30 16:10:40 +02:00
parent 437148f8f3
commit 25ed6b67fb
2694 changed files with 103014 additions and 118862 deletions
@@ -37,14 +37,13 @@
*
* @author Mark Charlebois <charlebm@gmail.com>
*/
#include "wqueue_test.h"
#include <px4_platform_common/log.h>
#include <px4_platform_common/app.h>
#include <px4_platform_common/log.h>
#include <stdio.h>
int PX4_MAIN(int argc, char **argv)
{
#include "wqueue_test.h"
int PX4_MAIN(int argc, char **argv) {
px4::init(argc, argv, "wqueue_test");
PX4_INFO("wqueue hello\n");
@@ -37,41 +37,34 @@
* @author Thomas Gubler <thomasgubler@gmail.com>
* @author Mark Charlebois <mcharleb@gmail.com>
*/
#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; /* Handle of deamon task / thread */
#include "wqueue_test.h"
//using namespace px4;
static int daemon_task; /* Handle of deamon task / thread */
// using namespace px4;
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) ? (char *const *)&argv[2] : (char *const *)nullptr);
return 0;
@@ -43,27 +43,24 @@
#include <px4_platform_common/time.h>
#include <px4_platform_common/workqueue.h>
#include <unistd.h>
#include <stdio.h>
#include <unistd.h>
px4::AppState WQueueTest::appState;
void WQueueTest::hp_worker_cb(void *p)
{
void WQueueTest::hp_worker_cb(void *p) {
WQueueTest *wqep = (WQueueTest *)p;
wqep->do_hp_work();
}
void WQueueTest::lp_worker_cb(void *p)
{
void WQueueTest::lp_worker_cb(void *p) {
WQueueTest *wqep = (WQueueTest *)p;
wqep->do_lp_work();
}
void WQueueTest::do_lp_work()
{
void WQueueTest::do_lp_work() {
static int iter = 0;
printf("done lp work\n");
@@ -76,8 +73,7 @@ void WQueueTest::do_lp_work()
work_queue(LPWORK, &_lpwork, (worker_t)&lp_worker_cb, this, 1000);
}
void WQueueTest::do_hp_work()
{
void WQueueTest::do_hp_work() {
static int iter = 0;
printf("done hp work\n");
@@ -91,18 +87,15 @@ void WQueueTest::do_hp_work()
work_queue(HPWORK, &_hpwork, (worker_t)&hp_worker_cb, this, 1000);
}
int WQueueTest::main()
{
int WQueueTest::main() {
appState.setRunning(true);
//Put work on HP work queue
// Put work on HP work queue
work_queue(HPWORK, &_hpwork, (worker_t)&hp_worker_cb, this, 1000);
//Put work on LP work queue
// Put work on LP work queue
work_queue(LPWORK, &_lpwork, (worker_t)&lp_worker_cb, this, 1000);
// Wait for work to finsh
while (!appState.exitRequested() && !(_hpwork_done && _lpwork_done)) {
printf(" Sleeping for 2 sec...\n");
@@ -43,8 +43,7 @@
#include <px4_platform_common/workqueue.h>
#include <string.h>
class WQueueTest
{
class WQueueTest {
public:
WQueueTest() = default;
~WQueueTest() = default;
@@ -59,8 +58,8 @@ private:
void do_lp_work(void);
void do_hp_work(void);
bool _lpwork_done {false};
bool _hpwork_done {false};
work_s _lpwork {};
work_s _hpwork {};
bool _lpwork_done{false};
bool _hpwork_done{false};
work_s _lpwork{};
work_s _hpwork{};
};