dist-sensor: reduce enum names

This commit is contained in:
bresch 2024-09-09 15:22:09 +02:00 committed by Mathieu Bresciani
parent 8bca467c15
commit 15e9c65a8f
5 changed files with 9 additions and 9 deletions

View File

@ -41,7 +41,7 @@ uint8 ROTATION_DOWNWARD_FACING = 25 # MAV_SENSOR_ROTATION_PITCH_270
uint8 ROTATION_CUSTOM = 100 # MAV_SENSOR_ROTATION_CUSTOM
uint8 mode # mode of operation
uint8 DISTANCE_SENSOR_MODE_UNKNOWN = 0 # Unknown mode
uint8 DISTANCE_SENSOR_MODE_RUN = 1 # sensor is running continuosly
uint8 DISTANCE_SENSOR_MODE_DISABLED = 2 # sensor is disabled per request
uint8 mode
uint8 MODE_UNKNOWN = 0
uint8 MODE_ENABLED = 1
uint8 MODE_DISABLED = 2

View File

@ -499,7 +499,7 @@ void LightwareLaser::RunImpl()
case State::Running:
if (!_restriction) {
_px4_rangefinder.set_mode(distance_sensor_s::DISTANCE_SENSOR_MODE_RUN);
_px4_rangefinder.set_mode(distance_sensor_s::MODE_ENABLED);
if (PX4_OK != collect()) {
PX4_DEBUG("collection error");
@ -511,7 +511,7 @@ void LightwareLaser::RunImpl()
}
} else {
_px4_rangefinder.set_mode(distance_sensor_s::DISTANCE_SENSOR_MODE_DISABLED);
_px4_rangefinder.set_mode(distance_sensor_s::MODE_DISABLED);
if (!_prev_restriction) { // Publish disabled status once
_px4_rangefinder.update(hrt_absolute_time(), -1.f, 0);

View File

@ -40,7 +40,7 @@ PX4Rangefinder::PX4Rangefinder(const uint32_t device_id, const uint8_t device_or
set_device_id(device_id);
set_orientation(device_orientation);
set_rangefinder_type(distance_sensor_s::MAV_DISTANCE_SENSOR_LASER);
set_mode(distance_sensor_s::DISTANCE_SENSOR_MODE_UNKNOWN);
set_mode(distance_sensor_s::MODE_UNKNOWN);
}
PX4Rangefinder::~PX4Rangefinder()

View File

@ -49,7 +49,7 @@ void DistanceSensorChecks::checkAndReport(const Context &context, Report &report
if (exists) {
distance_sensor_s dist_sens;
valid = _distance_sensor_sub[instance].copy(&dist_sens) && ((hrt_elapsed_time(&dist_sens.timestamp) < 1_s)
|| (dist_sens.mode == distance_sensor_s::DISTANCE_SENSOR_MODE_DISABLED));
|| (dist_sens.mode == distance_sensor_s::MODE_DISABLED));
reporter.setIsPresent(health_component_t::distance_sensor);
}