Permalink
Browse files

added link status line

  • Loading branch information...
1 parent 9bc7c86 commit 6dd5614ab2e7acc2626585b8887f236a466df20b @tridge committed May 10, 2012
Showing with 29 additions and 13 deletions.
  1. +1 −0 .gitignore
  2. +5 −1 modules/camera.py
  3. +22 −11 modules/console.py
  4. +1 −1 modules/lib/textconsole.py
View
@@ -3,3 +3,4 @@ mavproxy
*.o
*.pyc
*.log
+camera/
View
@@ -301,6 +301,9 @@ def view_thread():
view_dir = os.path.join(state.camera_dir, "view")
mkdir_p(view_dir)
+ mpstate.console.set_status('Images', 'Images %u' % image_count, row=3)
+ mpstate.console.set_status('Regions', 'Regions %u' % region_count, row=3)
+
while not state.unload.wait(0.05):
if state.viewing:
if not view_window:
@@ -340,7 +343,8 @@ def view_thread():
image_count += 1
region_count += len(regions)
- mpstate.console.set_status('Camera', 'Images %u' % image_count, row=2)
+ mpstate.console.set_status('Images', 'Images %u' % image_count)
+ mpstate.console.set_status('Regions', 'Regions %u' % region_count)
else:
if view_window:
view_window = False
View
@@ -26,14 +26,14 @@ def init(_mpstate):
mpstate.console = wxconsole.MessageConsole()
# setup some default status information
- mpstate.console.set_status('Mode', 'UNKNOWN', row=0)
+ mpstate.console.set_status('Mode', 'UNKNOWN', row=0, fg='blue')
mpstate.console.set_status('GPS', 'GPS: --', fg='red', row=0)
- mpstate.console.set_status('Heading', 'Hdg ---/---', row=1)
- mpstate.console.set_status('Alt', 'Alt ---/---', row=1)
- mpstate.console.set_status('Speed', 'Speed --/--', row=1)
- mpstate.console.set_status('Thr', 'Thr ---', row=1)
- mpstate.console.set_status('Roll', 'Roll ---', row=1)
- mpstate.console.set_status('Pitch', 'Pitch ---', row=1)
+ mpstate.console.set_status('Heading', 'Hdg ---/---', row=2)
+ mpstate.console.set_status('Alt', 'Alt ---/---', row=2)
+ mpstate.console.set_status('Speed', 'Speed --/--', row=2)
+ mpstate.console.set_status('Thr', 'Thr ---', row=2)
+ mpstate.console.set_status('Roll', 'Roll ---', row=2)
+ mpstate.console.set_status('Pitch', 'Pitch ---', row=2)
def unload():
@@ -63,13 +63,24 @@ def mavlink_packet(msg):
gps_heading = mpstate.status.msgs['GPS_RAW'].hdg
mpstate.console.set_status('Heading', 'Hdg %u/%u' % (master.field('VFR_HUD', 'heading', '-'), gps_heading))
if type == 'VFR_HUD':
- mpstate.console.set_status('Mode', '%s' % master.flightmode)
+ mpstate.console.set_status('Mode', '%s' % master.flightmode, fg='blue')
mpstate.console.set_status('Alt', 'Alt %u/%u' % (mpstate.status.altitude, master.field('GPS_RAW', 'alt', '-')))
mpstate.console.set_status('Speed', 'Speed %u/%u' % (msg.airspeed, msg.groundspeed))
mpstate.console.set_status('Thr', 'Thr %u' % msg.throttle)
if type == 'ATTITUDE':
mpstate.console.set_status('Roll', 'Roll %u' % math.degrees(msg.roll))
mpstate.console.set_status('Pitch', 'Pitch %u' % math.degrees(msg.pitch))
-
-
-
+ if type == 'HEARTBEAT':
+ for m in mpstate.mav_master:
+ linkdelay = (mpstate.status.highest_usec - m.highest_usec)*1e-6
+ linkline = "Link %u " % (m.linknum+1)
+ if m.linkerror:
+ linkline += "down" % (m.linknum+1)
+ fg = 'red'
+ elif master.link_delayed:
+ linkline += "delayed %.2fs" % linkdelay
+ fg = 'yellow'
+ else:
+ linkline += "OK (%u pkts, %.2fs delay, %u lost)" % (m.mav_count, linkdelay, m.mav_loss)
+ fg = 'darkgreen'
+ mpstate.console.set_status('Link%u'%m.linknum, linkline, row=m.linknum+1, fg=fg)
@@ -21,7 +21,7 @@ def writeln(self, text, fg='black', bg='white'):
'''write to the console with linefeed'''
self.write(text + '\n', fg=fg, bg=bg)
- def set_status(self, name, text='', fg='black', bg='white'):
+ def set_status(self, name, text='', row=0, fg='black', bg='white'):
'''set a status value'''
pass

0 comments on commit 6dd5614

Please sign in to comment.