remap pins for paper size

workspace
Brendan Howell 7 years ago
parent 92da0895a3
commit 3e0824e7ca

@ -34,9 +34,9 @@ class Photography(Bureau):
prefix = "PX"
version = 0
landscape_pin = port.PB3
a3_pin = port.PB4
a4_pin = port.PB5
a5_pin = port.PB6
a5_pin = port.PB5
a4_pin = port.PB4
a6_pin = port.PB6
doc_light_pin = port.PB7
def __init__(self):
@ -115,20 +115,23 @@ class Photography(Bureau):
#TODO: crop here to trim calibrated extra pixels
xsize, ysize = img.size
if gpio.input(self.a3_pin) == 0:
pass
if gpio.input(self.a4_pin) == 0:
print("scanning as A4")
offset = (xsize - ysize) / 2
box = (offset, 0, (offset + ysize), xsize / 2)
img = img.crop(box)
elif gpio.input(self.a5_pin) == 0:
print("scanning as A5")
offset = xsize / 4
box = (offset, 0, (offset + (xsize / 2)), ysize / 2)
img = img.crop(box)
else:
elif gpio.input(self.a6_pin) == 0:
print("scanning as A6")
offset = (xsize - (ysize / 2)) / 2
box = (offset, 0, (offset + (ysize / 2)), xsize / 4)
img = img.crop(box)
else:
print("scanning as A3")
# rotate
if gpio.input(self.landscape_pin) == 0:

Loading…
Cancel
Save