Sorry to be the bearer of firmware problems I know you must be very busy…However, please can you look at the sensor.IOCTL_SET_READOUT_WINDOW. I am using it for Digital PTZ, but it seems to have stopped working properly. It fails in both the examples in the latest firmware as well…
Thanks I will try that, but I think there are other problems.
# Hello World Example
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time
sensor.reset()
print ("Setup Cam")
sensor.set_gainceiling(128)
print ("Set auto gain")
sensor.set_auto_gain(True)
print ("Set auto exposure")
sensor.set_auto_exposure(True)
print ("Set framesize")
sensor.set_framesize(sensor.HD)
print ("Set pixformat")
sensor.set_pixformat(sensor.RGB565)
print ("Set framerate")
sensor.set_framerate(1)
print ("Set buffers")
sensor.set_framebuffers(8)
# Reset and initialize the sensor.
#sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
#sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
while(True):
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
This stalls at the sensor.set_pixformat, but only if the set framerate is run. If you comment out set framerate and buffers it runs…
I think there may be others, but I will have to track them down.
Yes there was another crash in my code, but it appears to be just further instances of set_framerate. When they are all commented out, all is well again…
Please run the modified hello world sample below. I have added an LED to be sure below.
It never reaches the main loop. The USB disconnects and the LED flashing does not occur.
(However if you remove the set_framerate and set_framebuffers lines it does work.)
So there is a new problem with set_framerate (I believe, though it may be the set_framebuffers) but it is quite difficult to tell which line as the USB print seems to be lost in buffering when the USB disconnects.
# Hello World Example
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time, pyb
from pyb import LED
red_led = LED(1)
green_led = LED(2)
blue_led = LED(3)
ir_led = LED(4)
def led_control(x):
if (x&1)==0: red_led.off()
elif (x&1)==1: red_led.on()
if (x&2)==0: green_led.off()
elif (x&2)==2: green_led.on()
if (x&4)==0: blue_led.off()
elif (x&4)==4: blue_led.on()
if (x&8)==0: ir_led.off()
elif (x&8)==8: ir_led.on()
sensor.reset()
print ("Setup Cam")
sensor.set_gainceiling(128)
print ("Set auto gain")
sensor.set_auto_gain(True)
print ("Set auto exposure")
sensor.set_auto_exposure(True)
print ("Set framesize")
sensor.set_framesize(sensor.HD)
print ("Set pixformat")
sensor.set_pixformat(sensor.RGB565)
led_control(1)
# Reset and initialize the sensor.
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
print ("Set framerate")
sensor.set_framerate(1)
print ("Set buffers")
sensor.set_framebuffers(8)
led_control(0)
while(True):
led_control(1)
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
pyb.delay(100)
led_control(0)
pyb.delay(100)
# to the IDE. The FPS should increase once disconnected.