From e3db030d7ae3b8ef58d589782bfd5e52df48e1f4 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 1 Jun 2021 13:17:39 +1000 Subject: [PATCH] AC_Fence: load and store fence radii in floats These were simply being cast down to integers --- libraries/AC_Fence/AC_PolyFence_loader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/AC_Fence/AC_PolyFence_loader.cpp b/libraries/AC_Fence/AC_PolyFence_loader.cpp index c89833dd41..9fc6c5de06 100644 --- a/libraries/AC_Fence/AC_PolyFence_loader.cpp +++ b/libraries/AC_Fence/AC_PolyFence_loader.cpp @@ -116,7 +116,7 @@ bool AC_PolyFence_loader::get_item(const uint16_t seq, AC_PolyFenceItem &item) if (!read_latlon_from_storage(offset, item.loc)) { return false; } - item.radius = fence_storage.read_uint32(offset); + item.radius = fence_storage.read_float(offset); break; case AC_PolyFenceType::POLYGON_INCLUSION: case AC_PolyFenceType::POLYGON_EXCLUSION: @@ -789,7 +789,7 @@ bool AC_PolyFence_loader::load_from_eeprom() break; } // now read the radius - circle.radius = fence_storage.read_uint32(storage_offset); + circle.radius = fence_storage.read_float(storage_offset); if (circle.radius <= 0) { gcs().send_text(MAV_SEVERITY_WARNING, "AC_Fence: non-positive circle radius"); storage_valid = false; @@ -1075,7 +1075,7 @@ bool AC_PolyFence_loader::write_fence(const AC_PolyFenceItem *new_items, uint16_ return false; } // store the radius - fence_storage.write_uint32(offset, new_item.radius); + fence_storage.write_float(offset, new_item.radius); offset += 4; break; case AC_PolyFenceType::RETURN_POINT: