Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WpFlickrEmbed has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/plugins/wp-flickr-embed/wp-flickr-embed.php on line 34
Warning: session_start(): Cannot start session when headers already sent in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/plugins/wp-flickr-embed/include/class.flickr.php on line 104
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/plugins/wptouch/core/class-wptouch-pro.php on line 1623
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/load.php on line 926
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/functions/media.php on line 666
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/functions/media.php on line 671
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/functions/media.php on line 684
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/functions/media.php on line 689
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/functions/media.php on line 694
Notice: Trying to access array offset on value of type bool in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/theme.php on line 2360
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Widgets has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-widgets.php on line 10
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Search has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-search.php on line 9
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Follow_Twitter has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-twitter.php on line 10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Category_Posts has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Featured_Posts has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-featured-posts.php on line 10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Google_Translator has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-translator.php on line 10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Subscription has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-subscription.php on line 20
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Flickr has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-flickr.php on line 10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Query_Users has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-query-users.php on line 10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Suffusion_Child_Pages has a deprecated constructor in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-content/themes/suffusion/widgets/suffusion-child-pages.php on line 10 June 2017 – rtn VFRmedia Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
This small thermal printer is very basic and uses 1980s style ESC/POS control codes (like most similar printers of this type that are used in shops for receipt printing). Sending UTF-8 text directly to it (such as any accented characters) doesn’t work well, as the accented characters have different codes (this printer can use a variety of old DOS code pages but defaults to 437).
Luckily Python has all these text conversion functions built in (you don’t even need to roll your own lookup tables!)
#
#
# convert UTF-8 to codepage for thermal printer
#
#
# this is UTF-8 text with German characters
#
import pprint
import serial
#
# USB converter device name for thermal printer
#
ttyname = 'COM2'
text1 = [ 'Sie kam als Kind\nwohl am Sonntag an,\n',
'denn sie hieß,\nseit ich denken kann,\n',
'immer nur Sunday Girl.\n',
'Sie war nie Schuld,\nganz egal woran,\n',
'ihr hat nie etwas weh getan,\n',
'denn sie war Sunday Girl.\n\n',
'Kalt wie Eis und genau so süß\n',
'so war sie und auch manchmal\nganz schön mies.\n',
'Für sie war es ein Kinderspiel,\n',
'pech für den, dem sie gefiel.\n',
]
#
# convert output to list of bytes with codepage
# using printers default codepage 437
#
opt =[]
for i in range(len(text1)):
byt = str.encode(text1[i],'cp437')
opt.append(byt)
#
# open the printer port and send data
#
s=serial.Serial(ttyname,19200)
#
# centre the title text and bold it
#
s.write(b'\x1ba1\x1bE1')
s.write(b'Text conversion test\n\n')
s.write(b'\x1ba0\x1bE0')
# print the converted text
for i in range(len(opt)):
s.write(opt[i])
#
# done, print complete message
#
s.write(b'\x1ba1\x1bE1')
s.write(b'\n\nComplete...\n\n\n')
s.write(b'\x1ba0\x1bE0')
Control the Arduino pager TX via Python running on a Linux machine
# control the Arduino RF22 pager TX
# modified ON1ARF code
#
# 2017-06-23 Alex The Engineer
# The Rat's Nest, Ipswich UK
#
#
import serial
import pprint
import sys
from colorconsole import terminal
from colored import fg, bg, attr
import readline
# global colours
res=attr('reset')
# tty open now coded as a function
#
# colored module used here instead of colorconsole/screen object
# just in case there isn't a global screen object available
#
def page(ttydev,capcode,function,repeats,message):
#
# create msg bytearray (NB: there should be more error
# checking here
#
msg=(b'P ')
msg+=(b'%07d' % capcode)+(b' ')
msg+=(b'%01d' % function)+(b' ')
msg+=(b'%01d' % repeats)+(b' ')
msg+=(message)+(b'\r')
print (fg(80),bg(0x12),'** opening tty:',ttydev+res)
# serial port open with error checking this time
try:
ser = serial.Serial(ttydev, timeout=3)
except serial.SerialException:
print(res)
sys.exit("** ERROR: cannot open tty\n\n")
# if we got here everything is OK
# RTS/DTR does not actually need to be flipped
# as opening the tty does that anyway
# which saves some time starting up the arduino comms
# ser.setRTS(True)
# ser.setRTS(False)
#
# get the lines from the buffer
print (fg(0x0b),bg(0x15),'** tty open OK: >>check TX<<'+res)
ibuf = ser.readlines()
print (fg(202))
#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)
sys.exit("** ERROR: RF22 init error\n\n")
if ibuf[-1] != (b'F <freqmhz> <freq100Hz>\r\n'):
print(res)
sys.exit("** ERROR: RF22 comms error\n\n")
# if TX has correctly initialised now send message
ser.write(msg)
# get a line back from TTY, it should be exactly same as msg
# but with a \n after it
# if it hasn't something has gone wrong
check=ser.readline()
print(fg(0x50),'<< from tty:',fg(0x72),bg(0x08),check,res,fg(0x52))
if check != (msg+b'\n'):
print(res)
sys.exit("** ERROR: pager comms error\n\n")
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()
# 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.gotoXY(2,3)
scr.xterm256_set_fg_color(0x20)
print('capcode:')
scr.xterm256_set_bk_color(0x08)
scr.xterm256_set_fg_color(0x78)
scr.gotoXY(10,3)
print(' ')
scr.xterm256_set_bk_color(0)
scr.gotoXY(20,3)
scr.xterm256_set_fg_color(0x20)
print('alert:')
scr.xterm256_set_bk_color(0x08)
scr.xterm256_set_fg_color(0x78)
scr.gotoXY(26,3)
print(' ')
scr.xterm256_set_bk_color(0)
scr.gotoXY(2,5)
scr.xterm256_set_fg_color(0x20)
print('message:')
scr.xterm256_set_bk_color(0x08)
scr.xterm256_set_fg_color(0x78)
scr.gotoXY(10,5)
print(' ')
scr.xterm256_set_bk_color(0)
scr.gotoXY(0,9)
scr.xterm256_set_fg_color(0x28)
# to be developed, input capcode
def get_capcode(scr,default):
pass
# display capcode in input box
def disp_capcode(scr,capcode):
scr.xterm256_set_bk_color(0x08)
scr.xterm256_set_fg_color(0x78)
scr.gotoXY(10,3)
print (str((b'%07d' % capcode),'utf-8'))
scr.xterm256_set_bk_color(0)
# display alert code in input box
def disp_alert(scr,alert):
scr.xterm256_set_bk_color(0x08)
scr.xterm256_set_fg_color(0x78)
scr.gotoXY(26,3)
print (str((b'%01d' % alert),'utf-8'))
scr.xterm256_set_bk_color(0)
# display message in input box
def disp_msg(scr,message):
scr.xterm256_set_bk_color(0x08)
scr.xterm256_set_fg_color(0x78)
scr.gotoXY(10,5)
print (str(message,'utf-8'))
scr.xterm256_set_bk_color(0)
scr.gotoXY(0,9)
#
# main code now starts here
#
# initialise the screen
#
# 2017-06-23: now accepts interactive input of message
#
# a blank line transmits the hardcoded message
#
# 'q' exits the code
#
while True:
# refresh the header
screen = terminal.get_terminal(conEmu=False)
header(screen)
# message now split into capcode, function (0-3), repeats
# and 40 character bytearray
#
# hardcoded values
#
capcode = 20008
function = 2
repeats = 1
message = b'rtn: miauw naar de maan!<<<pagertest>>>'
ttydev="/dev/ttyACM0"
# display the capcode and alert that are currently hardcoded
# but leave the msg box blank as it now accepts user input
#
disp_capcode(screen,capcode)
disp_alert(screen,function)
#
# create a quick and dirty coloured prompt for the input
#
screen.gotoXY(2,7)
screen.xterm256_set_fg_color(0x38)
print('------>')
screen.gotoXY(10,7)
screen.xterm256_set_fg_color(0x68)
#
# this uses readline so has some basic editing functions
#
# anything over 40 character is clipped
#
ms1=input()
if ms1 !='':
message=ms1[0:40].encode('utf-8')
if ms1 =='q':
break
#
# display the msg in the top box and transmit it
#
disp_msg(screen,message)
page(ttydev,capcode,function,repeats,message)
#
# terminate script and reset all the console colours
#
print (fg(0xc8),'\n++ Script completed sucessfully ++\n',res)
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/42/d24067567/htdocs/clickandbuilds/WordPress/rtn_vfrmedia_newblog/wp-includes/formatting.php on line 4803