Commit fa7d14bc authored by rtn's avatar rtn

changed the output to only show TX confirmations to save screen space

so top part can be used to input new capcode/messages
parent e47640e8
......@@ -29,7 +29,7 @@ def page(ttydev,capcode,function,repeats,message):
msg+=(b'%01d' % repeats)+(b' ')
msg+=(message)+(b'\r')
print (fg(80)+"attempting to open tty:",ttydev)
print (fg(80),bg(0x12),'** opening tty:',ttydev+res)
# serial port open with error checking this time
try:
......@@ -46,11 +46,14 @@ def page(ttydev,capcode,function,repeats,message):
# ser.setRTS(False)
#
# get the lines from the buffer
print (fg(0x0b),bg(0x15))
print ('** tty open OK: Connecting to Arduino and checking TX startup**'+res)
print (fg(0x0b),bg(0x15),'** tty open OK: >>check TX<<'+res)
ibuf = ser.readlines()
print (fg(202))
pprint.pprint(ibuf)
#pprint.pprint(ibuf)
print (' ibuf[0] :',ibuf[0])
print (' ibuf[-1] :',ibuf[-1])
# check to see what came down comms line is expected
if ibuf[0] != (b'RF22 init OK\r\n'):
print(res)
......@@ -69,20 +72,34 @@ def page(ttydev,capcode,function,repeats,message):
if check != (msg+b'\n'):
print(res)
sys.exit("** ERROR: pager comms error\n\n")
print (' ++ comms OK ++')
print (' ++ comms to pager TX OK ++')
# get data returned over comms link
# and now echo it with some pretty colours :)
colindex=0x70
while True:
data=ser.readline()
print (fg(0x30),'<< from tty:',fg(colindex),data)
colindex += 1
# only print it if a sending confirmation
if data==(b'POCSAG SEND\r\n'):
print (fg(0x30),'<< from tty:',fg(colindex),data)
colindex += 1
if data==(b'F <freqmhz> <freq100Hz>\r\n'):
break
# all done, close tty
print (fg(0x28),'** message sent correctly **\n')
ser.close()
def header(scr):
scr = terminal.get_terminal(conEmu=False)
scr.clear()
scr.xterm256_set_fg_color(0x52)
scr.xterm256_set_bk_color(0x08)
scr.print_at(2,0,"rtn telecom : pagertest 1.00")
scr.xterm256_set_bk_color(0)
scr.xterm256_set_fg_color(7)
scr.gotoXY(0,9)
scr.xterm256_set_fg_color(0x28)
#
# main code now starts here
#
......@@ -93,14 +110,7 @@ def page(ttydev,capcode,function,repeats,message):
#
screen = terminal.get_terminal(conEmu=False)
screen.clear()
screen.xterm256_set_fg_color(0x52)
screen.xterm256_set_bk_color(0x08)
screen.print_at(0,0,"rtn telecom : pagertest 1.00")
screen.xterm256_set_bk_color(0)
screen.xterm256_set_fg_color(7)
screen.gotoXY(0,2)
screen.xterm256_set_fg_color(0x28)
header(screen)
#
# message now split into capcode, function (0-3), repeats
# and 40 character bytearray
......@@ -111,10 +121,11 @@ repeats = 1
message = b'rtn: miauw naar de maan!<<<pagertest>>>'
ttydev="/dev/ttyACM0"
page(ttydev,capcode,function,repeats,message)
print(res)
function = 3
repeats = 1
message = b'this is another test msg<<<pagertest>>>'
header(screen)
page(ttydev,capcode,function,repeats,message)
print (fg(0xc8),'\n++ Script completed sucessfully ++\n',res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment