Commit 0a534fc8 authored by Andrey Filippov's avatar Andrey Filippov

more updates for 393, rearranged some debug output

parent 7fb56744
No preview for this file type
......@@ -137,7 +137,7 @@ int main (int argc, char *argv[]) {
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);
// MDF1(fprintf(stderr,"\n"));
if (initFilesMmap(sensor_port)<0) exit (1); /// initialization errors
if (initFilesMmap(sensor_port, sensor_subchannel)<0) exit (1); /// initialization errors
if (autoexposure_debug <0) { /// tempoorary hack for testing
GLOBALPARS_SNGL(G_DEBUG)=0;
exit (0);
......@@ -181,7 +181,7 @@ int main (int argc, char *argv[]) {
/// debugging
old_vexp=framePars[(this_frame+exp_ahead) & PARS_FRAMES_MASK].pars[P_VEXPOS];
old_that_vexpos= get_imageParamsThatValid(P_VEXPOS, this_frame-1);
MDF3(fprintf(stderr, "this_frame= 0x%x, this_frame+exp_ahead= 0x%x, old_vexp= 0x%x, old_that_vexpos = 0x%x\n", (int) this_frame,(int) (this_frame+exp_ahead), (int) old_vexp, (int) old_that_vexpos));
MDF8(fprintf(stderr, "this_frame= 0x%x, this_frame+exp_ahead= 0x%x, old_vexp= 0x%x, old_that_vexpos = 0x%x\n", (int) this_frame,(int) (this_frame+exp_ahead), (int) old_vexp, (int) old_that_vexpos));
if (hdr_mode>0) { /// align target autoexposure frame to hdr mode
if (hdr_target_frame & 1) hdr_target_frame++;
if ((hdr_mode>1) && (hdr_target_frame & 2)) hdr_target_frame+=2;
......@@ -194,7 +194,7 @@ MDF3(fprintf(stderr, "this_frame= 0x%x, this_frame+exp_ahead= 0x%x, old_vexp= 0x
}
old_vexp=framePars[(this_frame+exp_ahead) & PARS_FRAMES_MASK].pars[P_VEXPOS];
old_that_vexpos= get_imageParamsThatValid(P_VEXPOS, this_frame-1);
MDF3(fprintf(stderr, "this_frame= 0x%x, this_frame+exp_ahead= 0x%x, old_vexp= 0x%x, old_that_vexpos = 0x%x\n", (int) this_frame,(int) (this_frame+exp_ahead), (int) old_vexp, (int) old_that_vexpos));
MDF8(fprintf(stderr, "this_frame= 0x%x, this_frame+exp_ahead= 0x%x, old_vexp= 0x%x, old_that_vexpos = 0x%x\n", (int) this_frame,(int) (this_frame+exp_ahead), (int) old_vexp, (int) old_that_vexpos));
if (((ae_rslt=aexpCorr(COLOR_Y_NUMBER, this_frame, this_frame+exp_ahead )))<0) break; /// restart on errors
//GLOBALPARS_SNGL(G_AE_INTEGERR)
......
......@@ -78,6 +78,10 @@
#define MDF5(x) { if (autoexposure_debug & (1 << 5)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
#define MDF6(x) { if (autoexposure_debug & (1 << 6)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
#define MDF7(x) { if (autoexposure_debug & (1 << 7)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
//moved from MDF3 - all what is active when autoexposure is off
#define MDF8(x) { if (autoexposure_debug & (1 << 8)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
//moved from MDF3 - all what is active when white balance is off
#define MDF9(x) { if (autoexposure_debug & (1 << 9)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
#else
#define MDF0(x)
#define MDF1(x)
......
......@@ -57,7 +57,7 @@
* uses global variables for files and mmap-ed data so they are accessible everywhere
* @return 0 - OK, <0 - problems opening/mma-ing
*/
int initFilesMmap(int sensor_port) {
int initFilesMmap(int sensor_port, int sensor_subchannel) {
const char *framepars_dev_names[SENSOR_PORTS] = {
DEV393_PATH(DEV393_FRAMEPARS0),
DEV393_PATH(DEV393_FRAMEPARS1),
......@@ -90,6 +90,9 @@ int initFilesMmap(int sensor_port) {
close (fd_fparmsall);
return -1;
}
// Select port and subchannel for histograms
lseek(fd_histogram_cache, LSEEK_HIST_SET_CHN + (4 * sensor_port) + sensor_subchannel, SEEK_END); /// specify port/sub-channel is needed
histogram_cache = (struct histogram_stuct_t *) mmap(0, sizeof (struct histogram_stuct_t) * HISTOGRAM_CACHE_NUMBER , PROT_READ, MAP_SHARED, fd_histogram_cache, 0);
if((int) histogram_cache == -1) {
ELP_FERR(fprintf(stderr, "problems with mmap: %s\n", histogram_driver_name));
......
......@@ -46,7 +46,7 @@
extern unsigned long this_frame;
extern int autoexposure_debug;
int initFilesMmap(int sensor_port);
int initFilesMmap(int sensor_port, int sensor_subchannel);
int initParams(int daemon_bit);
......
......@@ -74,7 +74,7 @@ void initWhiteBalanceCorr(void) {
/// TODO: SupportT P_WB_MASK - now it is just ON/OFF. NOTE:When the bit is off it should be scaled with the G1 color!
int whiteBalanceCorr(int frame, int target_frame, int ae_rslt) {
MDF3(fprintf(stderr,"frame=0x%x, target_frame=0x%x G_WB_INTEGERR=0x%08lx\n",frame,target_frame,GLOBALPARS_SNGL(G_WB_INTEGERR))); ///======= 0 here
MDF9(fprintf(stderr,"frame=0x%x, target_frame=0x%x G_WB_INTEGERR=0x%08lx\n",frame,target_frame,GLOBALPARS_SNGL(G_WB_INTEGERR))); ///======= 0 here
int rslt;
int colors;
unsigned long write_data[18];
......
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