Skip to content
Snippets Groups Projects
Commit 0fecd1af authored by Michael Day's avatar Michael Day Committed by Michael Day
Browse files

param: Prompt auto updates when SYSID_THISMAV arrives from the plane.

parent f3f4c0a9
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,9 @@ class ParamState: ...@@ -37,7 +37,9 @@ class ParamState:
added_new_parameter = False added_new_parameter = False
if m.param_count != -1: if m.param_count != -1:
self.mav_param_count = m.param_count self.mav_param_count = m.param_count
self.mav_param[str(param_id)] = m.param_value self.mav_param[str(param_id)] = m.param_value
if self.fetch_one > 0: if self.fetch_one > 0:
self.fetch_one -= 1 self.fetch_one -= 1
print("%s = %f" % (param_id, m.param_value)) print("%s = %f" % (param_id, m.param_value))
...@@ -50,7 +52,7 @@ class ParamState: ...@@ -50,7 +52,7 @@ class ParamState:
self.fetch_check(master, force=True) self.fetch_check(master, force=True)
def fetch_check(self, master, force=False): def fetch_check(self, master, force=False):
'''check for missing parameters periodically''' '''check for missing parameters periodically'''
if self.param_period.trigger() or force: if self.param_period.trigger() or force:
if master is None: if master is None:
return return
...@@ -281,7 +283,11 @@ class ParamModule(mp_module.MPModule): ...@@ -281,7 +283,11 @@ class ParamModule(mp_module.MPModule):
def mavlink_packet(self, m): def mavlink_packet(self, m):
'''handle an incoming mavlink packet''' '''handle an incoming mavlink packet'''
self.pstate.handle_mavlink_packet(self.master, m) param_changed = self.pstate.handle_mavlink_packet(self.master, m)
#hack to put plane's sysid in front of mode on prompt
if param_changed != None and param_changed[0].upper() == "SYSID_THISMAV":
self.mpstate.rl.set_prompt(str(int(param_changed[1])) + ":" + self.status.flightmode + "> ")
def idle_task(self): def idle_task(self):
'''handle missing parameters''' '''handle missing parameters'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment