Rover: fixed CLI sonartest

This commit is contained in:
Andrew Tridgell 2014-11-11 11:33:51 +11:00
parent b2badee172
commit ef62a2c697
1 changed files with 6 additions and 2 deletions

View File

@ -455,12 +455,15 @@ test_mag(uint8_t argc, const Menu::arg *argv)
static int8_t
test_sonar(uint8_t argc, const Menu::arg *argv)
{
init_sonar();
delay(20);
sonar.update();
if (!sonar.healthy()) {
cliSerial->println_P(PSTR("WARNING: Sonar is not enabled"));
}
print_hit_enter();
init_sonar();
float sonar_dist_cm_min = 0.0f;
float sonar_dist_cm_max = 0.0f;
@ -472,6 +475,7 @@ test_sonar(uint8_t argc, const Menu::arg *argv)
while (true) {
delay(20);
sonar.update();
uint32_t now = millis();
float dist_cm = sonar.distance_cm(0);