From 3e0824e7ca2fa8e125a82baacd9ebd6a1e26ec16 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Tue, 16 May 2017 12:33:10 +0200 Subject: [PATCH] remap pins for paper size --- screenless/bureau/photography/photography.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/screenless/bureau/photography/photography.py b/screenless/bureau/photography/photography.py index d9e8833..9ef87c7 100644 --- a/screenless/bureau/photography/photography.py +++ b/screenless/bureau/photography/photography.py @@ -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: