Skip to content

Commit 166cdcb

Browse files
committed
modules: rcsetup: flake8 compliance
1 parent b7d20f7 commit 166cdcb

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Diff for: MAVProxy/modules/mavproxy_rcsetup.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
#!/usr/bin/env python
2-
'''RC min/max setup'''
1+
'''
2+
RC min/max setup
3+
4+
AP_FLAKE8_CLEAN
5+
'''
36

47
from MAVProxy.modules.lib import mp_module
58

9+
610
class RCSetupModule(mp_module.MPModule):
711
def __init__(self, mpstate):
812
super(RCSetupModule, self).__init__(mpstate, "rcsetup")
@@ -80,41 +84,40 @@ def idle_task(self):
8084

8185
def cmd_rctrim(self, args):
8286
'''set RCx_TRIM'''
83-
if not 'RC_CHANNELS' in self.status.msgs:
87+
if 'RC_CHANNELS' not in self.status.msgs:
8488
print("No RC_CHANNELS to trim with")
8589
return
8690
m = self.status.msgs['RC_CHANNELS']
87-
for ch in range(1,5):
91+
for ch in range(1, 5):
8892
self.param_set('RC%u_TRIM' % ch, getattr(m, 'chan%u_raw' % ch))
8993

90-
9194
def unload(self):
9295
if 'rcreset' in self.mpstate.command_map:
9396
self.mpstate.command_map.pop('rcreset')
9497
if 'rctrim' in self.mpstate.command_map:
9598
self.mpstate.command_map.pop('rctrim')
9699

97-
98100
def mavlink_packet(self, m):
99101
'''handle an incoming mavlink packet'''
100-
#do nothing if not caibrating
101-
if (self.calibrating == False):
102+
# do nothing if not caibrating
103+
if self.calibrating is False:
102104
return
103105

104106
if m.get_type() == 'RC_CHANNELS':
105-
for i in range(1,self.num_channels+1):
107+
for i in range(1, self.num_channels+1):
106108
v = getattr(m, 'chan%u_raw' % i)
107109

108110
if self.get_cal_min(i) > v:
109-
self.set_cal_min(i,v)
111+
self.set_cal_min(i, v)
110112
self.console.writeln("Calibrating: RC%u_MIN=%u" % (i, v))
111113
if self.get_cal_max(i) < v:
112-
self.set_cal_max(i,v)
114+
self.set_cal_max(i, v)
113115
self.console.writeln("Calibrating: RC%u_MAX=%u" % (i, v))
114116

115117
def print_cal_usage(self):
116118
print("Usage rccal <start|done>")
117119

120+
118121
def init(mpstate):
119122
'''initialise module'''
120123
return RCSetupModule(mpstate)

0 commit comments

Comments
 (0)