Commit 487dd09b authored by Andrey Filippov's avatar Andrey Filippov

added waiting for frame>0 at startup, daemons can be started before bitstream load

parent 66cba9b1
......@@ -135,9 +135,10 @@ int main (int argc, char *argv[]) {
daemon_bit=strtol(argv[6], NULL, 10);
if ((daemon_bit<0) || (daemon_bit>31)) {printf ("Invalid bit number %d (should be 0..31)\n", daemon_bit); exit (1);}
fprintf(stderr,"autoexposure started, daemon_bit=0x%x, debug=0x%x\n",daemon_bit,autoexposure_debug);
fprintf(stderr,"autoexposure started, port = %d, daemon_bit=0x%x, debug=0x%x\n",sensor_port, daemon_bit,autoexposure_debug);
// MDF1(fprintf(stderr,"\n"));
if (initFilesMmap(sensor_port, sensor_subchannel)<0) exit (1); /// initialization errors
MDF0(fprintf(stderr,"autoexposure: drivers initialized\n"));
if (autoexposure_debug <0) { /// tempoorary hack for testing
GLOBALPARS_SNGL(G_DEBUG)=0;
exit (0);
......
......@@ -75,6 +75,13 @@ int initFilesMmap(int sensor_port, int sensor_subchannel) {
ELP_FERR(fprintf(stderr, "Open failed: (%s)\r\n", framepars_driver_name));
return -1;
}
// Wait hardware to be initialized, so frame number >0 (otherwise histograms_cache will fail to open as it depends on number of subframes)
lseek(fd_fparmsall,1+LSEEK_FRAME_WAIT_ABS, SEEK_END); /// skip 3 frames (first got 0 pixels, 2- 0x3fff) - one extra, sometimes it is needed
// frameParsAll = (struct framepars_all_t *) mmap(0, sizeof (struct framepars_all_t) * HISTOGRAM_CACHE_NUMBER , PROT_READ | PROT_WRITE, MAP_SHARED, fd_fparmsall, 0);
frameParsAll = (struct framepars_all_t *) mmap(0, sizeof (struct framepars_all_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd_fparmsall, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment