mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
sensors/boson: Try to initialize the FLIR BOSON in a loop.
Older FLIR Boson Sensors (< IDD 4.x) take almost 10 seconds to boot compared to newer FLIR Boson Sensors. This change tests if the FLIR BOSON sensors has booted once a second for up to 10 times before giving up.
This commit is contained in:
parent
c8a7f3fc5f
commit
fa88bbd59d
@ -44,21 +44,38 @@
|
||||
#include "Client_API.h"
|
||||
#include "UART_Connector.h"
|
||||
|
||||
#define FLIR_BOSON_BOOT_TIME_MS (2500)
|
||||
#define FLIR_BOSON_BOOT_TRY_COUNT (10)
|
||||
#define FLIR_BOSON_BOOT_TIME_MS (1000)
|
||||
|
||||
static int boson_framesize = 0;
|
||||
|
||||
static int reset(omv_csi_t *csi) {
|
||||
csi->color_palette = NULL;
|
||||
|
||||
int i = 0;
|
||||
FLR_BOSON_PARTNUMBER_T part;
|
||||
|
||||
// Older FLIR Boson (< IDD 4.x) cameras take forever to boot up.
|
||||
for (; i < FLIR_BOSON_BOOT_TRY_COUNT; i++) {
|
||||
if (i > 1) {
|
||||
// Print something to prevent the user from thinking the camera is stuck.
|
||||
mp_printf(MP_PYTHON_PRINTER,
|
||||
"CSI: FLIR Boson not ready, retrying (%d/%d)...\n",
|
||||
i, FLIR_BOSON_BOOT_TRY_COUNT - 1);
|
||||
}
|
||||
|
||||
// Give the camera time to boot.
|
||||
mp_hal_delay_ms(FLIR_BOSON_BOOT_TIME_MS);
|
||||
|
||||
// Turn the com port on.
|
||||
Initialize();
|
||||
|
||||
FLR_BOSON_PARTNUMBER_T part;
|
||||
if (bosonGetCameraPN(&part) != FLR_OK) {
|
||||
if (bosonGetCameraPN(&part) == FLR_OK) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == FLIR_BOSON_BOOT_TRY_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user