Skip to content

Commit

Permalink
RC: Make RC GUI fit according to max received value
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendade committed Jan 20, 2025
1 parent 2b1803c commit 162abc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MAVProxy/modules/lib/wxrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,23 @@ def update_gauges(self, msg):
for i, gauge in enumerate(self.rc_gauges):
if msg.get_type() == 'RC_CHANNELS' and self.panelType == PanelType.RC_IN:
value = getattr(msg, 'chan{0}_raw'.format(i+1), 0)
if value > gauge.GetRange():
gauge.SetRange(value + 50)
gauge.SetValue(value)
gauge.Refresh()
elif (msg.get_type() == 'SERVO_OUTPUT_RAW' and self.panelType == PanelType.SERVO_OUT and
getattr(msg, 'port', 0) == 0) and i < 16:
value = getattr(msg, 'servo{0}_raw'.format(i+1), 0)
if value > gauge.GetRange():
gauge.SetRange(value + 50)
gauge.SetValue(value)
gauge.Refresh()
elif (msg.get_type() == 'SERVO_OUTPUT_RAW' and self.panelType == PanelType.SERVO_OUT and
getattr(msg, 'port', 0) == 1) and i >= 17:
# 2nd bank of servos (17-32), if used
value = getattr(msg, 'servo{0}_raw'.format(i+1-16), 0)
if value > gauge.GetRange():
gauge.SetRange(value + 50)
gauge.SetValue(value)
gauge.Refresh()
return 0
Expand Down

0 comments on commit 162abc5

Please sign in to comment.