From f304fcf4da57997aba6d5dd4a8bfa913108e1ede Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Wed, 30 Mar 2016 22:47:38 -0300 Subject: [PATCH] AP_InertialSensor: examples: add coding style fixes Several coding style problems were already fixed by previous commit, just finish the cleanup on this example: - replace tabs with spaces - remove unneeded \r - remove extra spaces --- .../examples/INS_generic/INS_generic.cpp | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libraries/AP_InertialSensor/examples/INS_generic/INS_generic.cpp b/libraries/AP_InertialSensor/examples/INS_generic/INS_generic.cpp index 6e1b817a04..f2f625fff7 100644 --- a/libraries/AP_InertialSensor/examples/INS_generic/INS_generic.cpp +++ b/libraries/AP_InertialSensor/examples/INS_generic/INS_generic.cpp @@ -9,7 +9,7 @@ #include #include -const AP_HAL::HAL& hal = AP_HAL::get_HAL(); +const AP_HAL::HAL &hal = AP_HAL::get_HAL(); AP_InertialSensor ins; @@ -39,31 +39,31 @@ void loop(void) hal.console->println(); hal.console->println( - "Menu:\r\n" - " d) display offsets and scaling\r\n" - " l) level (capture offsets from level)\r\n" - " t) test\r\n" + "Menu:\n" + " d) display offsets and scaling\n" + " l) level (capture offsets from level)\n" + " t) test\n" " r) reboot"); // wait for user input - while( !hal.console->available() ) { + while (!hal.console->available()) { hal.scheduler->delay(20); } // read in user input - while( hal.console->available() ) { + while (hal.console->available()) { user_input = hal.console->read(); - if( user_input == 'd' || user_input == 'D' ) { + if (user_input == 'd' || user_input == 'D') { display_offsets_and_scaling(); } - if( user_input == 't' || user_input == 'T' ) { + if (user_input == 't' || user_input == 'T') { run_test(); } - if( user_input == 'r' || user_input == 'R' ) { - hal.scheduler->reboot(false); + if (user_input == 'r' || user_input == 'R') { + hal.scheduler->reboot(false); } } } @@ -102,7 +102,7 @@ static void run_test() static uint8_t ins_count = MAX(accel_count, gyro_count); // flush any user input - while( hal.console->available() ) { + while (hal.console->available()) { hal.console->read(); } @@ -110,8 +110,7 @@ static void run_test() ins.update(); // loop as long as user does not press a key - while( !hal.console->available() ) { - + while (!hal.console->available()) { // wait until we have a sample ins.wait_for_sample(); @@ -162,7 +161,7 @@ static void run_test() } // clear user input - while( hal.console->available() ) { + while (hal.console->available()) { hal.console->read(); } }