Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
v1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
MrYsLab authored and MrYsLab committed Feb 8, 2018
1 parent 6b2ef0a commit 4cd390b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions s2aio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,21 @@
# noinspection PyUnusedLocal
class S2AIO:
def __init__(self, client='scratch', language='1', com_port=None, base_path=None,
version_request=False):
version_request=False, sleeper=3):
"""
This is the constructor for the s2aio. Establish somme class variables for use
:param client: Client specifier Scratch or Snap!
:param com_port: Arduino com port
:param sleeper: time to wait before starting the watchdog timer
:return: None
"""

# establish initial base_path - where s2aio lives
self.base_path = base_path

# set wait time before starting the watchdog timer
self.sleeper = sleeper

# if not base path was specified, try to establish one
if not self.base_path:
# get all the paths
Expand Down Expand Up @@ -784,7 +788,7 @@ async def poll_watchdog(self):
sent, and if so, shuts down the server. It waits 2 seconds before shutting down.
:return: None
"""
await asyncio.sleep(2)
await asyncio.sleep(self.sleeper)
while True:
await asyncio.sleep(1)
current_time = self.loop.time()
Expand Down Expand Up @@ -830,6 +834,7 @@ def main():
parser.add_argument("-p", dest="comport", default="None", help="Arduino COM port - e.g. /dev/ttyACMO or COM3")
parser.add_argument("-b", dest="base_path", default="None",
help="Python File Path - e.g. /usr/local/lib/python3.5/dist-packages/s2aio")
parser.add_argument("-s", dest="sleeper", default="3", help="Set timeout to allow Scratch to initialize.")
parser.add_argument("-v", action='store_true', help='Print version and Python path')

args = parser.parse_args()
Expand All @@ -847,11 +852,14 @@ def main():

language_type = args.language

sleep = int(args.sleeper)


# noinspection PyUnusedLocal
version = parser.parse_args('-v'.split())

s2aio = S2AIO(client=client_type, language=language_type, com_port=comport, base_path=user_base_path,
version_request=args.v)
version_request=args.v, sleeper=sleep)

the_loop = asyncio.get_event_loop()
# noinspection PyBroadException
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='s2aio',
version='1.11',
version='1.12',
packages=['s2aio'],
install_requires=['pymata-aio>=2.7',
'aiohttp==0.22.4'],
Expand Down

0 comments on commit 4cd390b

Please sign in to comment.