mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
drivers: Fix snapshot loop.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
190aecc45c
commit
65ac3ca2ea
@ -287,6 +287,9 @@ typedef struct _omv_csi_callback_t {
|
||||
void *arg;
|
||||
} omv_csi_cb_t;
|
||||
|
||||
typedef int (*omv_csi_snapshot_t)
|
||||
(omv_csi_t *csi, image_t *image, uint32_t flags);
|
||||
|
||||
typedef struct _omv_csi {
|
||||
uint32_t chip_id; // Sensor ID 32 bits.
|
||||
uint8_t slv_addr; // Sensor I2C slave address.
|
||||
|
@ -139,7 +139,7 @@ static int set_colorbar(omv_csi_t *csi, int enable) {
|
||||
}
|
||||
|
||||
static int snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
||||
int ret = omv_csi_snapshot(csi, image, flags);
|
||||
int ret = ((omv_csi_snapshot_t) csi->priv)(csi, image, flags);
|
||||
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@ -165,6 +165,7 @@ int boson_init(omv_csi_t *csi) {
|
||||
csi->set_pixformat = set_pixformat;
|
||||
csi->set_framesize = set_framesize;
|
||||
csi->set_colorbar = set_colorbar;
|
||||
csi->priv = csi->snapshot;
|
||||
csi->snapshot = snapshot;
|
||||
|
||||
// Set csi flags
|
||||
|
@ -406,7 +406,7 @@ static int snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
||||
|
||||
// Collect events to calibrate hot pixels.
|
||||
for (uint32_t i = 0; i < EVENT_THRESHOLD_TO_CALIBRATE; ) {
|
||||
int ret = omv_csi_snapshot(csi, image, flags);
|
||||
int ret = ((omv_csi_snapshot_t) csi->priv)(csi, image, flags);
|
||||
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@ -451,7 +451,7 @@ static int snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
||||
}
|
||||
#endif // (OMV_GENX320_CAL_ENABLE == 1)
|
||||
|
||||
int ret = omv_csi_snapshot(csi, image, flags);
|
||||
int ret = ((omv_csi_snapshot_t) csi->priv)(csi, image, flags);
|
||||
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@ -604,6 +604,7 @@ int genx320_init(omv_csi_t *csi) {
|
||||
csi->set_colorbar = set_colorbar;
|
||||
csi->set_hmirror = set_hmirror;
|
||||
csi->set_vflip = set_vflip;
|
||||
csi->priv = csi->snapshot;
|
||||
csi->snapshot = snapshot;
|
||||
csi->ioctl = ioctl;
|
||||
|
||||
|
@ -661,8 +661,9 @@ static int reset(omv_csi_t *csi) {
|
||||
}
|
||||
|
||||
static int paj6100_snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
||||
int res = omv_csi_snapshot(csi, image, flags);
|
||||
if (res == 0) {
|
||||
int ret = ((omv_csi_snapshot_t) csi->priv)(csi, image, flags);
|
||||
|
||||
if (ret == 0) {
|
||||
l_total = 0;
|
||||
int iml = image->h * image->w;
|
||||
for (int i = 0; i < iml; ++i) {
|
||||
@ -673,7 +674,7 @@ static int paj6100_snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
||||
auto_exposure(csi);
|
||||
}
|
||||
|
||||
return res;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int paj6100_init(omv_csi_t *csi) {
|
||||
@ -700,6 +701,7 @@ int paj6100_init(omv_csi_t *csi) {
|
||||
csi->set_special_effect = set_special_effect;
|
||||
csi->set_lens_correction = set_lens_correction;
|
||||
|
||||
csi->priv = csi->snapshot;
|
||||
csi->snapshot = paj6100_snapshot;
|
||||
|
||||
// Set csi flags
|
||||
|
Loading…
Reference in New Issue
Block a user