First… I recommend looking at the API code for for the lepton too. It helps:
https://github.com/openmv/openmv/tree/master/src/lepton/src
https://github.com/openmv/openmv/tree/master/src/lepton/include
Then, here’s the code for that:
import sensor, struct
def read_enable(en):
sensor.ioctl(sensor.IOCTL_LEPTON_SET_ATTRIBUTE, 0x4E11, struct.pack("<I", 1 if en else 0))
If you look at the API… all the OpenMV Cam code is doing is just executing a FLIR Lepton set attribute command, passing the attribute number to that set command, and then some byte struct. If you check the API for this command it says it expects two shorts (4 bytes) which is the enable enum (32-bits) which can have values 0 or 1.
For various reasons the lengths in the FLIR API are all in shorts (16-bits), that’s what the IDD means when it says command get or set length.
…
Anyway, for setting things you want to pass a byte struct created by struct.pack(). Then you create the byte struct and pass that to the OpenMV Cam IOCTL code.
…
And this example before shows grabbing data from the lepton:
import sensor, struct
data = sensor.ioctl(sensor.IOCTL_LEPTON_GET_ATTRIBUTE, 0x4ED0, 4)
radSpotmeterValue, radSpotmeterMaxValue, radSpotmeterMinValue, radSpotmeterPopulation = struct.unpack("<HHHH", data)
As you can see above… the command will do a get operation for opcode 0x4ED0 to the lepton and get 4 shorts back which I then unpack into the 4 values above.