mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-13 08:05:55 +01:00
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the 'pypad_inno713.py' PyPAD script that caused an infinite loop.
This commit is contained in:
@@ -18984,3 +18984,6 @@
|
|||||||
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
|
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a bug in the 'pypad_filewrite.py' PyPAD script that caused
|
* Fixed a bug in the 'pypad_filewrite.py' PyPAD script that caused
|
||||||
an infinite loop.
|
an infinite loop.
|
||||||
|
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Fixed a bug in the 'pypad_inno713.py' PyPAD script that caused
|
||||||
|
an infinite loop.
|
||||||
|
|||||||
@@ -32,55 +32,52 @@ def eprint(*args,**kwargs):
|
|||||||
|
|
||||||
def ProcessPad(update):
|
def ProcessPad(update):
|
||||||
n=1
|
n=1
|
||||||
while(True):
|
section='Rds'+str(n)
|
||||||
|
while(update.config().has_section(section)):
|
||||||
|
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
|
||||||
|
dps=''
|
||||||
|
if(len(update.config().get(section,'DynamicPsString'))!=0):
|
||||||
|
dps='DPS='+update.resolvePadFields(update.config().get(section,'DynamicPsString'),pypad.ESCAPE_NONE)+'\r\n'
|
||||||
|
ps=''
|
||||||
|
if(len(update.config().get(section,'PsString'))!=0):
|
||||||
|
ps='PS='+update.resolvePadFields(update.config().get(section,'PsString'),pypad.ESCAPE_NONE)+'\r\n'
|
||||||
|
text=''
|
||||||
|
if(len(update.config().get(section,'RadiotextString'))!=0):
|
||||||
|
text='TEXT='+update.resolvePadFields(update.config().get(section,'RadiotextString'),pypad.ESCAPE_NONE)+'\r\n'
|
||||||
|
if(update.config().has_option(section,'Device')):
|
||||||
|
#
|
||||||
|
# Use serial output
|
||||||
|
#
|
||||||
|
tty_dev=update.config().get(section,'Device')
|
||||||
|
speed=int(update.config().get(section,'Speed'))
|
||||||
|
parity=serial.PARITY_NONE
|
||||||
|
if int(update.config().get(section,'Parity'))==1:
|
||||||
|
parity=serial.PARITY_EVEN
|
||||||
|
if int(update.config().get(section,'Parity'))==2:
|
||||||
|
parity=serial.PARITY_ODD
|
||||||
|
bytesize=int(update.config().get(section,'WordSize'))
|
||||||
|
dev=serial.Serial(tty_dev,speed,parity=parity,bytesize=bytesize)
|
||||||
|
if(len(dps)!=0):
|
||||||
|
dev.write(dps.encode('utf-8'))
|
||||||
|
if(len(ps)!=0):
|
||||||
|
dev.write(ps.encode('utf-8'))
|
||||||
|
if(len(text)!=0):
|
||||||
|
dev.write(text.encode('utf-8'))
|
||||||
|
dev.close()
|
||||||
|
else:
|
||||||
|
#
|
||||||
|
# Use UDP output
|
||||||
|
#
|
||||||
|
ipaddr=update.config().get(section,'IpAddress')
|
||||||
|
port=int(update.config().get(section,'UdpPort'))
|
||||||
|
if(len(dps)!=0):
|
||||||
|
send_sock.sendto(dps.encode('utf-8'),(ipaddr,port))
|
||||||
|
if(len(ps)!=0):
|
||||||
|
send_sock.sendto(ps.encode('utf-8'),(ipaddr,port))
|
||||||
|
if(len(text)!=0):
|
||||||
|
send_sock.sendto(text.encode('utf-8'),(ipaddr,port))
|
||||||
|
n=n+1
|
||||||
section='Rds'+str(n)
|
section='Rds'+str(n)
|
||||||
try:
|
|
||||||
if update.shouldBeProcessed(section) and update.hasPadType(pypad.TYPE_NOW):
|
|
||||||
dps=''
|
|
||||||
if(len(update.config().get(section,'DynamicPsString'))!=0):
|
|
||||||
dps='DPS='+update.resolvePadFields(update.config().get(section,'DynamicPsString'),pypad.ESCAPE_NONE)+'\r\n'
|
|
||||||
ps=''
|
|
||||||
if(len(update.config().get(section,'PsString'))!=0):
|
|
||||||
ps='PS='+update.resolvePadFields(update.config().get(section,'PsString'),pypad.ESCAPE_NONE)+'\r\n'
|
|
||||||
text=''
|
|
||||||
if(len(update.config().get(section,'RadiotextString'))!=0):
|
|
||||||
text='TEXT='+update.resolvePadFields(update.config().get(section,'RadiotextString'),pypad.ESCAPE_NONE)+'\r\n'
|
|
||||||
try:
|
|
||||||
#
|
|
||||||
# Use serial output
|
|
||||||
#
|
|
||||||
tty_dev=update.config().get(section,'Device')
|
|
||||||
speed=int(update.config().get(section,'Speed'))
|
|
||||||
parity=serial.PARITY_NONE
|
|
||||||
if int(update.config().get(section,'Parity'))==1:
|
|
||||||
parity=serial.PARITY_EVEN
|
|
||||||
if int(update.config().get(section,'Parity'))==2:
|
|
||||||
parity=serial.PARITY_ODD
|
|
||||||
bytesize=int(update.config().get(section,'WordSize'))
|
|
||||||
dev=serial.Serial(tty_dev,speed,parity=parity,bytesize=bytesize)
|
|
||||||
if(len(dps)!=0):
|
|
||||||
dev.write(dps.encode('utf-8'))
|
|
||||||
if(len(ps)!=0):
|
|
||||||
dev.write(ps.encode('utf-8'))
|
|
||||||
if(len(text)!=0):
|
|
||||||
dev.write(text.encode('utf-8'))
|
|
||||||
dev.close()
|
|
||||||
|
|
||||||
except configparser.NoOptionError:
|
|
||||||
#
|
|
||||||
# Use UDP output
|
|
||||||
#
|
|
||||||
ipaddr=update.config().get(section,'IpAddress')
|
|
||||||
port=int(update.config().get(section,'UdpPort'))
|
|
||||||
if(len(dps)!=0):
|
|
||||||
send_sock.sendto(dps.encode('utf-8'),(ipaddr,port))
|
|
||||||
if(len(ps)!=0):
|
|
||||||
send_sock.sendto(ps.encode('utf-8'),(ipaddr,port))
|
|
||||||
if(len(text)!=0):
|
|
||||||
send_sock.sendto(text.encode('utf-8'),(ipaddr,port))
|
|
||||||
n=n+1
|
|
||||||
except configparser.NoSectionError:
|
|
||||||
return
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 'Main' function
|
# 'Main' function
|
||||||
|
|||||||
Reference in New Issue
Block a user