0

I am connecting the Lepton FLIR thermal scanner to my Raspberry Pi and I've gotten everything setup and working but when I try to run the program all I see is a red box surrounded by black.

According to SparkFun, I could fix this problem by unplugging and then plugging back in the camera, but this didn't work for me. I searched somewhere else and I found this solution, but it's telling me to edit the LeptonThread.cpp file, but I can't figure out where to add it.

Can anyone on here help me break down what I need to do? I've written the bash script and I've opened the LeptonThread.cpp file and looked through it, but I can't figure out where to add the code shown.

Where in the LeptonThread.cpp do I add the code in this solution, and then what do I need to do with it?

1

The solution author is saying that he toggled the GPIO 8 line before and after packet received for the frame. He wrote this function to simplify it for himself (and added it to the LeptonThread.cpp file:

#define VALUE_MAX 128
#define LOW 0
#define HIGH 1

static int
GPIOWrite(int pin, int value)
{
    static const char s_values_str[] = "01";

    char path[VALUE_MAX];
    int fd;

    snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", pin);
    fd = open(path, O_WRONLY);
    if (-1 == fd) {
        fprintf(stderr, "Failed to open gpio value for writing!\n");
        return(-1);
    }

    if (1 != write(fd, &s_values_str[LOW == value ? 0 : 1], 1)) {
        fprintf(stderr, "Failed to write value!\n");
        return(-1);
    }

    close(fd);
    return(0);
}

Then he called that function before and after line 34 (correct at commit dfce76f) in this file, like this

GPIOWrite(8, LOW);   // <- added line
read(spi_cs0_fd, result+sizeof(uint8_t)*PACKET_SIZE*j, sizeof(uint8_t)*PACKET_SIZE);
GPIOWrite(8, HIGH);  // <- added line
  • Are you sure that the second GPIOWrite is supposed to be directly after the read statement? In his code he appears to include it after a } which confuses me because there are multiple } following the read statement. – Isabel Alphonse Jul 27 '16 at 17:26
  • Also what changes are they talking about making in the SPI.cpp file? It says to use spidev0.0 when spi_device==0 but I don't see a single line that uses spi_device==0 – Isabel Alphonse Jul 27 '16 at 17:41
0

be careful NOT TO USE the wiring hints reported here:

https://learn.sparkfun.com/tutorials/flir-lepton-hookup-guide/all

it's totaly wrong. Beside this I can tell you that Lepton3 module works fine with Raspberry Pi 3 while I had some problem with Raspberry Pi 0 W.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.