Skip to content

Commit aa48ccf

Browse files
AC_Fence: use number-of-items-loaded rather than fence-loaded
AC_Fence: fail prearms on zero items, not just fence-loaded Co-authored-by: Andy Piper <[email protected]> we fail to load the fence if the storage is invalid, but if it is just empty we will be marked as "loaded". AC_Fence: never breach on zero items loaded Co-authored-by: Andy Piper <[email protected]> we can be loaded but with zero points AC_Fence: remove unused loaded method Co-authored-by: Andy Piper <[email protected]>
1 parent fad5eb1 commit aa48ccf

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

libraries/AC_Fence/AC_Fence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ bool AC_Fence::pre_arm_check_polygon(const char* &fail_msg) const
274274
return true;
275275
}
276276

277-
if (! _poly_loader.loaded()) {
277+
if (_poly_loader.total_fence_count() == 0) {
278278
fail_msg = "Fences invalid";
279279
return false;
280280
}

libraries/AC_Fence/AC_PolyFence_loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ bool AC_PolyFence_loader::breached() const
227227
// returns true if location is outside the boundary
228228
bool AC_PolyFence_loader::breached(const Location& loc) const
229229
{
230-
if (!loaded()) {
230+
if (total_fence_count() == 0) {
231231
return false;
232232
}
233233

libraries/AC_Fence/AC_PolyFence_loader.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ class AC_PolyFence_loader
140140
return _num_loaded_inclusion_boundaries != 0;
141141
}
142142

143-
// loaded - returns true if the fences have been loaded from
144-
// storage and are available for use
145-
bool loaded() const WARN_IF_UNUSED {
146-
return _load_time_ms != 0;
147-
};
148-
149143
// maximum number of fence points we can store in eeprom
150144
uint16_t max_items() const;
151145

0 commit comments

Comments
 (0)