From 0a9454cf91844957e85e0ac8c00d879fb8c501f9 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 28 Aug 2019 12:54:10 -0400 Subject: [PATCH] 2019-08-26 Fred Gleason * Fixed a bug in the 'pypad_xmpad.py' PyPAD script that caused an infinite loop. --- ChangeLog | 3 +++ apis/pypad/scripts/pypad_xmpad.py | 32 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 758c26e3..37d3f7f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19021,3 +19021,6 @@ 2019-08-26 Fred Gleason * Fixed a bug in the 'pypad_xds.py' PyPAD script that caused an infinite loop. +2019-08-26 Fred Gleason + * Fixed a bug in the 'pypad_xmpad.py' PyPAD script that caused + an infinite loop. diff --git a/apis/pypad/scripts/pypad_xmpad.py b/apis/pypad/scripts/pypad_xmpad.py index 23837aa7..eb5a1dd2 100755 --- a/apis/pypad/scripts/pypad_xmpad.py +++ b/apis/pypad/scripts/pypad_xmpad.py @@ -149,24 +149,22 @@ def ProcessTimer(config): def ProcessPad(update): n=1 - try: - while(True): - section='Serial'+str(n) - if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW): - dev=OpenSerialDevice(update.config(),section) - b4=MakeB4(update,section) - a4=MakeA4(update,section) - a5=MakeA5(update,section) - dev.write(b4.encode('utf-8')) - dev.write(b4.encode('utf-8')) - dev.write(b4.encode('utf-8')) - dev.write(a4.encode('utf-8')) - dev.write(a5.encode('utf-8')) - dev.close() - n=n+1 + section='Serial'+str(n) + while(update.config().has_section(section)): + if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW): + dev=OpenSerialDevice(update.config(),section) + b4=MakeB4(update,section) + a4=MakeA4(update,section) + a5=MakeA5(update,section) + dev.write(b4.encode('utf-8')) + dev.write(b4.encode('utf-8')) + dev.write(b4.encode('utf-8')) + dev.write(a4.encode('utf-8')) + dev.write(a5.encode('utf-8')) + dev.close() + n=n+1 + section='Serial'+str(n) - except configparser.NoSectionError: - return # # 'Main' function