Skip to content

Commit

Permalink
mavproxy_rc.py: flake8 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Mar 7, 2025
1 parent 6db88f6 commit 8188f7f
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions MAVProxy/modules/mavproxy_rc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env python3
'''rc command handling'''
'''
rc command handling
AP_FLAKE8_CLEAN
'''

import struct
import sys

import time, os, struct, sys
from pymavlink import mavutil
from MAVProxy.modules.lib import mp_module
from MAVProxy.modules.lib import mp_settings
Expand All @@ -14,10 +20,10 @@

class RCModule(mp_module.MPModule):
def __init__(self, mpstate):
super(RCModule, self).__init__(mpstate, "rc", "rc command handling", public = True)
super(RCModule, self).__init__(mpstate, "rc", "rc command handling", public=True)
self.count = 18
self.override = [ 0 ] * self.count
self.last_override = [ 0 ] * self.count
self.override = [0] * self.count
self.last_override = [0] * self.count
self.override_counter = 0
x = "|".join(str(x) for x in range(1, (self.count+1)))
self.add_command('rc', self.cmd_rc, "RC input control", ['<%s|all>' % x])
Expand Down Expand Up @@ -83,9 +89,9 @@ def unload_remove_menu_items(self):
def idle_task(self):
self.override_period.frequency = self.rc_settings.override_hz
if self.override_period.trigger():
if (self.override != [ 0 ] * self.count or
self.override != self.last_override or
self.override_counter > 0):
if (self.override != [0] * self.count or
self.override != self.last_override or
self.override_counter > 0):
self.last_override = self.override[:]
self.send_rc_override()
if self.override_counter > 0:
Expand Down Expand Up @@ -118,7 +124,7 @@ def send_rc_override(self):

def cmd_switch(self, args):
'''handle RC switch changes'''
mapping = [ 0, 1165, 1295, 1425, 1555, 1685, 1815 ]
mapping = [0, 1165, 1295, 1425, 1555, 1685, 1815]
if len(args) != 1:
print("Usage: switch <pwmvalue>")
return
Expand Down

0 comments on commit 8188f7f

Please sign in to comment.