groupgets / pylepton

Quick and dirty pure python library for interfacing with FLIR lepton
MIT License
208 stars 93 forks source link

Connect Three Lepton on Raspberry Pi 3 #40

Open MicheleMussi opened 4 years ago

MicheleMussi commented 4 years ago

Good morning, I would like use three lepton to the raspberry, with your library. Is this possible?

Running this example

import numpy as np import cv2 from pylepton import Lepton

with Lepton("/dev/spidev1.0") as l: a,_ = l.capture(None,True,True,True) cv2.normalize(a, a, 0, 65535, cv2.NORM_MINMAX) # extend contrast np.right_shift(a, 8, a) # fit data into 8 bits cv2.imwrite("python3.jpg", np.uint8(a)) # write it!

it works with with Lepton("/dev/spidev0.0") as l: with Lepton("/dev/spidev0.1") as l:

after running the program on one port it does not work on the next one until the raspberry is restarted

not work with with Lepton("/dev/spidev1.0") as l: The error is:

From the following error Traceback (most recent call last): File "3Capture.py", line 7, in with Lepton ("/ dev / spidev1.0") as l: File "/usr/local/lib/python2.7/dist-packages/pylepton/Lepton.py", line 85, in enter ioctl (self .__ handle, SPI_IOC_WR_MODE, struct.pack ("= B", Lepton.MODE)) IOError: [Errno 22] Invalid argument

but the ports exist

pi @ raspberrypi: ~ / Bm / ConveyorApp / Sender $ ls / dev / spidev * /dev/spidev0.0 /dev/spidev0.1 /dev/spidev1.0 /dev/spidev1.1 /dev/spidev1.2

Thanks for your help

dylandxt commented 9 months ago

I ran into the same issue. In Lepton.py it is trying to set the SPI mode to 3. I believe it is not supported by SPI1 on RPi. https://forums.raspberrypi.com//viewtopic.php?t=149981