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?

geek1011
  • 457
  • 4
  • 15
Isabel Alphonse
  • 111
  • 1
  • 3

2 Answers2

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
KennetRunner
  • 1,050
  • 7
  • 13
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.

weirdgyn
  • 122
  • 2
  • 15