diff --git a/APMrover2/APMrover2.pde b/APMrover2/APMrover2.pde index 5f87a46286..dfb4fc183c 100644 --- a/APMrover2/APMrover2.pde +++ b/APMrover2/APMrover2.pde @@ -624,7 +624,7 @@ static void fast_loop() // Read Sonar // ---------- - if (g.sonar_enabled) { + if (sonar.enabled()) { float sonar_dist_cm = sonar.distance_cm(); if (sonar_dist_cm <= g.sonar_trigger_cm) { // obstacle detected in front diff --git a/APMrover2/Parameters.h b/APMrover2/Parameters.h index 9194345b80..423b080558 100644 --- a/APMrover2/Parameters.h +++ b/APMrover2/Parameters.h @@ -99,7 +99,7 @@ public: k_param_fs_gcs_enabled, // obstacle control - k_param_sonar_enabled = 190, + k_param_sonar_enabled = 190, // deprecated, can be removed k_param_sonar, // sonar object k_param_sonar_trigger_cm, k_param_sonar_turn_angle, @@ -205,7 +205,6 @@ public: AP_Int8 fs_gcs_enabled; // obstacle control - AP_Int8 sonar_enabled; AP_Int16 sonar_trigger_cm; AP_Float sonar_turn_angle; AP_Float sonar_turn_time; diff --git a/APMrover2/Parameters.pde b/APMrover2/Parameters.pde index 48227e756f..3115d552a8 100644 --- a/APMrover2/Parameters.pde +++ b/APMrover2/Parameters.pde @@ -256,13 +256,6 @@ const AP_Param::Info var_info[] PROGMEM = { // @User: Standard GSCALAR(fs_gcs_enabled, "FS_GCS_ENABLE", 0), - // @Param: SONAR_ENABLE - // @DisplayName: Enable Sonar - // @Description: Setting this to Enabled(1) will enable the sonar. Setting this to Disabled(0) will disable the sonar - // @Values: 0:Disabled,1:Enabled - // @User: Standard - GSCALAR(sonar_enabled, "SONAR_ENABLE", SONAR_ENABLED), - // @Param: SONAR_TRIGGER_CM // @DisplayName: Sonar trigger distance // @Description: The distance from an obstacle at which the sonar triggers a turn to avoid the obstacle diff --git a/APMrover2/test.pde b/APMrover2/test.pde index f7109ef9b5..aaae094083 100644 --- a/APMrover2/test.pde +++ b/APMrover2/test.pde @@ -550,7 +550,7 @@ test_mag(uint8_t argc, const Menu::arg *argv) static int8_t test_sonar(uint8_t argc, const Menu::arg *argv) { - if (!g.sonar_enabled) { + if (!sonar.enabled()) { cliSerial->println_P(PSTR("WARNING: Sonar is not enabled")); }