Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Version 2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
MrYsLab authored and MrYsLab committed Oct 2, 2017
1 parent 567df11 commit da3ff69
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 58 deletions.
33 changes: 15 additions & 18 deletions PyMata/pymata.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
__author__ = 'Copyright (c) 2013-15 Alan Yorinks All rights reserved.'

"""
Copyright (c) 2013-17 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (c) 2015-2017 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from collections import deque
Expand Down Expand Up @@ -121,7 +118,7 @@ def __init__(self, port_id='/dev/ttyACM0', bluetooth=True, verbose=True):

if self.verbose:
print("\nPython Version %s" % sys.version)
print('\nPyMata version 2.14 Copyright(C) 2013-17 Alan Yorinks All rights reserved.')
print('\nPyMata version 2.15 Copyright(C) 2013-17 Alan Yorinks All rights reserved.')

# Instantiate the serial support class
self.transport = PyMataSerial(port_id, self.command_deque)
Expand Down
41 changes: 19 additions & 22 deletions PyMata/pymata_command_handler.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
__author__ = 'Copyright (c) 2013 Alan Yorinks All rights reserved.'

"""
Copyright (c) 2013-17 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (c) 2015-2017 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import threading
Expand Down Expand Up @@ -235,7 +233,7 @@ def auto_discover_board(self, verbose):
if time.time() - start_time > 30:
return False
# keep sending out a capability query until there is a response
self.send_sysex(self.ANALOG_MAPPING_QUERY, None)
self.send_sysex(self.ANALOG_MAPPING_QUERY)
time.sleep(.1)

if verbose:
Expand Down Expand Up @@ -627,7 +625,6 @@ def send_command(self, command):
send_message = ""
for i in command:
send_message += chr(i)
#send_message += bytes(i)

for data in send_message:
self.pymata.transport.write(data)
Expand Down Expand Up @@ -660,7 +657,7 @@ def system_reset(self):
response_entry = [self.pymata.INPUT, 0, None]
self.analog_response_table.append(response_entry)

#noinspection PyMethodMayBeStatic
# noinspection PyMethodMayBeStatic
# keeps pycharm happy
def _string_data(self, data):
"""
Expand Down Expand Up @@ -791,7 +788,7 @@ def run(self):
# go to the beginning of the loop to process the next command
continue

#is this a command byte in the range of 0x80-0xff - these are the non-sysex messages
# is this a command byte in the range of 0x80-0xff - these are the non-sysex messages

elif 0x80 <= data <= 0xff:
# look up the method for the command in the command dispatch table
Expand All @@ -818,14 +815,14 @@ def run(self):
# get the number of parameters that this command provides
num_args = dispatch_entry[1]

#look at the number of args that the selected method requires
# look at the number of args that the selected method requires
# now get that number of bytes to pass to the called method
for i in range(num_args):
while len(self.pymata.command_deque) == 0:
pass
data = self.pymata.command_deque.popleft()
command_data.append(data)
#go execute the command with the argument list
# go execute the command with the argument list
method(command_data)

# go to the beginning of the loop to process the next command
Expand Down
32 changes: 14 additions & 18 deletions PyMata/pymata_serial.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
__author__ = 'Copyright (c) 2013 Alan Yorinks All rights reserved.'
"""
@author: Alan Yorinks
Copyright (c) 2013-17 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (c) 2015-2017 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import threading
Expand Down

0 comments on commit da3ff69

Please sign in to comment.