Lepton sensor.shutdown

I am new to python on microcontrollers and having some issues running the shutdown of the lepton sensor. I am using the sensor.shutdown() to disable the lepton when battery voltage drops below 2.9V or the temperature is above 65c but the shutter continues to activate. Does sensor.shutdown work with the lepton? If not, what routine controls power to the lepton?

Also, the temperature rises abruptly when vbatt drops below 3.3v. unsure why, but I can hit 105c at 2.9v when the microcontroller is really at 40c.

    if H7_TEMPC > 65 :
        lptn_error = 4
        pyb.LED(GREEN_PIN).on()
        sensor.shutdown(True)

        if sleep_mode == 1 :
            pyb.stop()

    if H7_VBATT < 2.9 :
        lptn_error = 1
        pyb.LED(GREEN_PIN).on()
        sensor.shutdown(True)

        if sleep_mode == 1 :
            pyb.stop()

Hi, the lepton doesn’t shutdown via that method. That’s only for camera sensors. You’ll need to use the ioctl API with the lepton API to manually do method reads/writes to the API to cause it to do what you’d like.

If you search the forums for the lepton API you’ll find examples of how to do this.

Thanks. For completeness of this thread here is the command. certain commands require the protection bit so it is 4802 instead of 0802. Also want to check 0002 to see if the unit is ready to accept commands.

sensor.ioctl(sensor.IOCTL_LEPTON_RUN_COMMAND, 0x4802)

Also depending on what is called, the lepton may restart so you will want a shutdown flag to keep communications to the unit from occurring and restarting the sensor.