16
16
from MAVProxy .modules .lib import wxsettings
17
17
from MAVProxy .modules .lib .mp_menu import *
18
18
19
+ green = (0 , 128 , 0 )
20
+
19
21
class DisplayItem :
20
22
def __init__ (self , fmt , expression , row ):
21
23
self .expression = expression .strip ('"\' ' )
@@ -350,7 +352,7 @@ def handle_gps_raw(self, msg):
350
352
nsats = msg .satellites_visible
351
353
fix_type = msg .fix_type
352
354
if fix_type >= 3 :
353
- self .console .set_status (field , '%s OK%s (%u)' % (prefix , fix_type , nsats ), fg = ' green' )
355
+ self .console .set_status (field , '%s OK%s (%u)' % (prefix , fix_type , nsats ), fg = green )
354
356
else :
355
357
self .console .set_status (field , '%s %u (%u)' % (prefix , fix_type , nsats ), fg = 'red' )
356
358
if type == 'GPS_RAW_INT' :
@@ -465,9 +467,9 @@ def handle_sys_status(self, msg):
465
467
elif not healthy :
466
468
fg = 'red'
467
469
else :
468
- fg = ' green'
470
+ fg = green
469
471
# for terrain show yellow if still loading
470
- if s == 'TERR' and fg == ' green' and master .field ('TERRAIN_REPORT' , 'pending' , 0 ) != 0 :
472
+ if s == 'TERR' and fg == green and master .field ('TERRAIN_REPORT' , 'pending' , 0 ) != 0 :
471
473
fg = 'yellow'
472
474
self .console .set_status (s , s , fg = fg )
473
475
announce_unhealthy = {
@@ -516,19 +518,19 @@ def handle_ekf_status_report(self, msg):
516
518
elif highest >= 0.5 :
517
519
fg = 'orange'
518
520
else :
519
- fg = ' green'
521
+ fg = green
520
522
self .console .set_status ('EKF' , 'EKF' , fg = fg )
521
523
522
524
def handle_power_status (self , msg ):
523
525
if msg .Vcc >= 4600 and msg .Vcc <= 5300 :
524
- fg = ' green'
526
+ fg = green
525
527
else :
526
528
fg = 'red'
527
529
self .console .set_status ('Vcc' , 'Vcc %.2f' % (msg .Vcc * 0.001 ), fg = fg )
528
530
if msg .flags & mavutil .mavlink .MAV_POWER_STATUS_CHANGED :
529
531
fg = 'red'
530
532
else :
531
- fg = ' green'
533
+ fg = green
532
534
status = 'PWR:'
533
535
if msg .flags & mavutil .mavlink .MAV_POWER_STATUS_USB_CONNECTED :
534
536
status += 'U'
@@ -541,7 +543,7 @@ def handle_power_status(self, msg):
541
543
if msg .flags & mavutil .mavlink .MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT :
542
544
status += 'O2'
543
545
self .console .set_status ('PWR' , status , fg = fg )
544
- self .console .set_status ('Srv' , 'Srv %.2f' % (msg .Vservo * 0.001 ), fg = ' green' )
546
+ self .console .set_status ('Srv' , 'Srv %.2f' % (msg .Vservo * 0.001 ), fg = green )
545
547
546
548
# this method is called on receipt of any HEARTBEAT so long as it
547
549
# comes from the device we are interested in
@@ -557,7 +559,7 @@ def handle_heartbeat(self, msg):
557
559
if len (self .vehicle_list ) > 1 :
558
560
self .console .set_status ('SysID' , 'Sys:%u' % sysid , fg = 'blue' )
559
561
if self .master .motors_armed ():
560
- arm_colour = ' green'
562
+ arm_colour = green
561
563
else :
562
564
arm_colour = 'red'
563
565
armstring = 'ARM'
@@ -692,26 +694,26 @@ def handle_high_latency2(self, msg):
692
694
if failed :
693
695
fg = 'red'
694
696
else :
695
- fg = ' green'
697
+ fg = green
696
698
self .console .set_status (s , s , fg = fg )
697
699
698
700
# do the remaining non-standard system mappings
699
701
fence_failed = ((msg .failure_flags & mavutil .mavlink .HL_FAILURE_FLAG_GEOFENCE ) == mavutil .mavlink .HL_FAILURE_FLAG_GEOFENCE )
700
702
if fence_failed :
701
703
fg = 'red'
702
704
else :
703
- fg = ' green'
705
+ fg = green
704
706
self .console .set_status ('Fence' , 'FEN' , fg = fg )
705
707
gps_failed = ((msg .failure_flags & mavutil .mavlink .HL_FAILURE_FLAG_GPS ) == mavutil .mavlink .HL_FAILURE_FLAG_GPS )
706
708
if gps_failed :
707
709
self .console .set_status ('GPS' , 'GPS FAILED' , fg = 'red' )
708
710
else :
709
- self .console .set_status ('GPS' , 'GPS OK' , fg = ' green' )
711
+ self .console .set_status ('GPS' , 'GPS OK' , fg = green )
710
712
batt_failed = ((msg .failure_flags & mavutil .mavlink .HL_FAILURE_FLAG_GPS ) == mavutil .mavlink .HL_FAILURE_FLAG_BATTERY )
711
713
if batt_failed :
712
714
self .console .set_status ('PWR' , 'PWR FAILED' , fg = 'red' )
713
715
else :
714
- self .console .set_status ('PWR' , 'PWR OK' , fg = ' green' )
716
+ self .console .set_status ('PWR' , 'PWR OK' , fg = green )
715
717
716
718
# update user-added console entries; called after a mavlink packet
717
719
# is received:
0 commit comments