Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Forked from ednisley/gethp54602
Created January 29, 2020 23:35
Show Gist options
  • Save zeroeth/0acebc825ee7fb39feb503659e451e73 to your computer and use it in GitHub Desktop.
Save zeroeth/0acebc825ee7fb39feb503659e451e73 to your computer and use it in GitHub Desktop.
Kermit script to capture HP 54602 oscilloscope screen image
#!/usr/bin/kermit +
# Fetches screen shot from HP54602B oscilloscope
# Presumes it's set up for plotter output...
# Converts HPGL to PNG image
set host 192.168.1.40 7001 /raw-socket
set modem none
# Make sure we have a param
if not defined \%1 ask \%1 {File name? }
set input echo off
set input buffer-length 200000
# Wait for PRINT button to send the plot
echo Set HP54602B for HP Plotter, FACTORS ON, 19200, XON
echo Press PRINT SCREEN button on HP54602B...
log session "\%1.hgl"
# Factors On
input 480 \x03
close session
close
echo Converting HPGL in
echo --\%1.hgl
echo to PNG in
echo --\%1.png
# Factors Off
#run hp2xx -q -m png -a 1.762 -h 91 -c 14 "\%1.hgl"
#run mogrify -density 300 -resize 200% "\%1.png"
# Factors On
run sed '/lb/!d' "\%1.hgl" > "\%1-1.hgl"
#run hp2xx -q -m eps -r 270 -a 0.447 -d 300 -w 130 -c 14 -p 34 -f "\%1.eps" "\%1-1.hgl"
run hp2xx -q -e 40 -m eps -r 270 -a 0.447 -c 14 -f "\%1.eps" "\%1-1.hgl"
run rm "\%1-1.hgl"
#run convert -density 300 -resize 675x452+2+2 "\%1.eps" "\%1.png"
run convert "\%1.eps" -alpha off -resize 675x452 "\%1.png"
echo Finished!
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment