AP_Math: examples use millis/micros/panic functions

This commit is contained in:
Caio Marcelo de Oliveira Filho 2015-11-20 12:12:15 +09:00 committed by Randy Mackay
parent 5292bc0054
commit 8257e6ab89
2 changed files with 4 additions and 4 deletions

View File

@ -66,10 +66,10 @@ static void test_one_offset(const struct Location &loc,
float dist2, bearing2; float dist2, bearing2;
loc2 = loc; loc2 = loc;
uint32_t t1 = hal.scheduler->micros(); uint32_t t1 = AP_HAL::micros();
location_offset(loc2, ofs_north, ofs_east); location_offset(loc2, ofs_north, ofs_east);
hal.console->printf("location_offset took %u usec\n", hal.console->printf("location_offset took %u usec\n",
(unsigned)(hal.scheduler->micros() - t1)); (unsigned)(AP_HAL::micros() - t1));
dist2 = get_distance(loc, loc2); dist2 = get_distance(loc, loc2);
bearing2 = get_bearing_cd(loc, loc2) * 0.01f; bearing2 = get_bearing_cd(loc, loc2) * 0.01f;
float brg_error = bearing2-bearing; float brg_error = bearing2-bearing;

View File

@ -92,7 +92,7 @@ void setup(void)
hal.console->println(all_passed ? "TEST PASSED" : "TEST FAILED"); hal.console->println(all_passed ? "TEST PASSED" : "TEST FAILED");
hal.console->println("Speed test:"); hal.console->println("Speed test:");
start_time = hal.scheduler->micros(); start_time = AP_HAL::micros();
for (count=0; count<1000; count++) { for (count=0; count<1000; count++) {
for (i=0; i<ARRAY_SIZE(test_points); i++) { for (i=0; i<ARRAY_SIZE(test_points); i++) {
bool result; bool result;
@ -103,7 +103,7 @@ void setup(void)
} }
} }
} }
hal.console->printf("%u usec/call\n", (unsigned)((hal.scheduler->micros() hal.console->printf("%u usec/call\n", (unsigned)((AP_HAL::micros()
- start_time)/(count*ARRAY_SIZE(test_points)))); - start_time)/(count*ARRAY_SIZE(test_points))));
hal.console->println(all_passed ? "ALL TESTS PASSED" : "TEST FAILED"); hal.console->println(all_passed ? "ALL TESTS PASSED" : "TEST FAILED");
} }