def cmd_rc(self, args):
        '''handle RC value override'''
        if len(args) != 2:
            print("Usage: rc <channel|all> <pwmvalue>")
            return
        value = int(args[1])
        if value > 65535 or value < -1:
            raise ValueError("PWM value must be a positive integer between 0 and 65535")
        if value == -1:
            value = 65535
        channels = self.override
        if args[0] == 'all':
            for i in range(16):
                channels[i] = value
        else:
            channel = int(args[0])
            if channel < 1 or channel > 16:
                print("Channel must be between 1 and 8 or 'all'")
                return
            channels[channel - 1] = value
        self.set_override(channels)
def cmd_rc ( self , args ) : if len ( args ) != 2 : print ( "Usage: rc <channel|all> <pwmvalue>" ) return value = int ( args [ 1 ] ) if value > 65535 or value < - 1 : raise ValueError ( "PWM value must be a positive integer between 0 and 65535" ) if value == - 1 : value = 65535 channels = self . override if args [ 0 ] == 'all' : for i in range ( 16 ) : channels [ i ] = value else : channel = int ( args [ 0 ] ) if channel < 1 or channel > 16 : print ( "Channel must be between 1 and 8 or 'all'" ) return channels [ channel - 1 ] = value self . set_override ( channels )
handle RC value override