Skip to content

Commit

Permalink
AP_RangeFinder: preserve cm -> m -> cm roundtrip
Browse files Browse the repository at this point in the history
  • Loading branch information
clydemcqueen committed Aug 29, 2024
1 parent 14043a7 commit 5c088c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/AP_RangeFinder/AP_RangeFinder_Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AP_RangeFinder_Backend

enum Rotation orientation() const { return (Rotation)params.orientation.get(); }
float distance() const { return state.distance_m; }
uint16_t distance_cm() const { return state.distance_m*100.0f; }
uint16_t distance_cm() const { return std::lround(state.distance_m*100.0f); }
int8_t signal_quality_pct() const WARN_IF_UNUSED { return state.signal_quality_pct; }
uint16_t voltage_mv() const { return state.voltage_mv; }
virtual int16_t max_distance_cm() const { return params.max_distance_cm; }
Expand Down

0 comments on commit 5c088c8

Please sign in to comment.