Skip to content

Commit

Permalink
fieldcheck: fix for modern ArduPlane and mission_item_protocol changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Aug 21, 2023
1 parent c9328b1 commit aff5fdd
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions MAVProxy/modules/mavproxy_fieldcheck/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ def flightdata_filepath(self, filename):
def loadRally(self):
filepath = self.flightdata_filepath(self.fc_settings.rally_filename)
rallymod = self.module('rally')
rallymod.cmd_rally(["load", filepath])
rallymod.cmd_load([filepath])

def loadFoamyFence(self):
filepath = self.flightdata_filepath(self.fc_settings.fence_filename)
fencemod = self.module('fence')
fencemod.cmd_fence(["load", filepath])
fencemod.cmd_load([filepath])

def loadFoamyMission(self, filename):
filepath = self.flightdata_filepath(filename)
wpmod = self.module('wp')
wpmod.cmd_wp(["load", filepath])
wpmod.cmd_load([filepath])

def loadFoamyMissionCW(self):
self.loadFoamyMission(self.fc_settings.mission_filename_cw)
Expand All @@ -106,7 +106,7 @@ def check_parameters(self, fix=False):
'''check key parameters'''
want_values = {
"FENCE_ACTION": 4,
"FENCE_MAXALT": self.fc_settings.param_fence_maxalt,
"FENCE_ALT_MAX": self.fc_settings.param_fence_maxalt,
"THR_FAILSAFE": 1,
"FS_SHORT_ACTN": 0,
"FS_LONG_ACTN": 1,
Expand All @@ -133,18 +133,17 @@ def check_fence_location(self):
if fencemod is None:
self.whinge("Fence module not loaded")
return False
if not fencemod.have_list:
self.whinge("No fence list")
if not fencemod.check_have_list():
if self.is_armed:
return False
now = time.time()
if now - self.last_fence_fetch > 10:
self.last_fence_fetch = now
self.whinge("Running 'fence list'")
fencemod.list_fence(None)
fencemod.cmd_list(None)
return False

count = fencemod.fenceloader.count()
count = fencemod.count()
if count < 6:
self.whinge("Too few fence points")
return False
Expand All @@ -163,15 +162,15 @@ def check_rally(self):
if rallymod is None:
self.whinge("No rally module")
return False
if not rallymod.have_list:
if not rallymod.check_have_list():
self.whinge("No rally list")
if self.is_armed:
return False
now = time.time()
if now - self.last_rally_fetch > 10:
self.last_rally_fetch = now
self.whinge("Running 'rally list'")
rallymod.cmd_rally(["list"])
rallymod.cmd_list([])
return False

count = rallymod.rally_count()
Expand Down

0 comments on commit aff5fdd

Please sign in to comment.