diff --git a/Makefile b/Makefile index f7b5c44..cf1c53f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ .SILENT: help + +# +# all configuration is set in the Makefile.config file. +# + VERSION = 0.0.1 APP = simpleskycam +include Makefile.config -include Makefile.rules OBJECTS := $(OBJECTS) gui.oo main.oo error.oo \ @@ -44,7 +50,12 @@ config: Makefile.rules echo "#define _CONFIG_H_" >> config.h echo "" >> config.h echo "#define VERSION \"$(VERSION)\"" >> config.h - echo "#define USE_SVBONY" >> config.h +ifeq ($(USE_SVBONY),1) + echo "#define USE_SVBONY" >> config.h +endif +ifeq ($(DEBUG_ANGLES),1) + echo "#define DEBUG_ANGLES" >> config.h +endif echo "" >> config.h echo "#endif" >> config.h @@ -84,7 +95,7 @@ dist: clean rm -rf $(DISTNAME) dep: - $(CXX) -MM `ls *.cc` $(CXXFLAGS) > $(DEPENDFILE) + $(CXX) -M `ls *.cc` $(CPPFLAGS) > $(DEPENDFILE) .PHONY: all .PHONY: count diff --git a/Makefile.config b/Makefile.config new file mode 100644 index 0000000..2653a43 --- /dev/null +++ b/Makefile.config @@ -0,0 +1,8 @@ + +# +# configurations should be made in here. +# set one of these variables to 0 to disable the function. +# +USE_SVBONY = 1 +DEBUG_ANGLES = 1 + diff --git a/Makefile.rules.linux b/Makefile.rules.linux index 4867d20..fb7e3d2 100644 --- a/Makefile.rules.linux +++ b/Makefile.rules.linux @@ -1,4 +1,6 @@ +include Makefile.config + TARGET = $(APP) CPP = c++ @@ -10,11 +12,24 @@ OBJECTS = # -# Uncomment to enable support for SVBONY Cammeras. +# add makefile configuration for svbony cams # +ifeq ($(USE_SVBONY),1) CPPFLAGS := $(CPPFLAGS) -I/usr/local/include LDFLAGS := $(LDFLAGS) -lSVBCameraSDK -L/usr/local/lib OBJECTS := $(OBJECTS) videodev-svbcam.oo -# +endif +# + + +# +# add configuration for debug_angles +# +ifeq ($(DEBUG_ANGLES),1) +CPPFLAGS := $(CPPFLAGS) +OBJECTS := $(OBJECTS) debug-angles.oo +endif +# + diff --git a/debug-angles.cc b/debug-angles.cc new file mode 100644 index 0000000..dec351b --- /dev/null +++ b/debug-angles.cc @@ -0,0 +1,26 @@ +/*************************************************************************************** + * + * debug-angles.cc is part of SimpleSkyCam. + * + *****************************************************************************************/ + +#include +#include +#include + +#include "debug.h" + +void debug_angles_draw(cairo_t *cr) { + +}; + + +void debug_angles_motionevent(GdkEvent *event) { + +}; + + +void debug_angles_btnpress(GdkEvent *event) { + +}; + diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..5d16ece --- /dev/null +++ b/debug.h @@ -0,0 +1,20 @@ +/*************************************************************************************** + * + * debug.h is part of SimpleSkyCam. + * + *****************************************************************************************/ + +#ifndef _DEBUG_H_ +#define _DEBUG_H_ + +#include "config.h" +#include "simpleskycam.h" +#include "gui.h" + +#ifdef DEBUG_ANGLES +extern void debug_angles_draw(cairo_t *cr); +extern void debug_angles_motionevent(GdkEvent *event); +extern void debug_angles_btnpress(GdkEvent *event); +#endif + +#endif diff --git a/simpleskycam.h b/simpleskycam.h index 4de9cd9..38e3db0 100644 --- a/simpleskycam.h +++ b/simpleskycam.h @@ -2,7 +2,9 @@ #ifndef _SIMPLESKYCAM_H_ #define _SIMPLESKYCAM_H_ +#include "config.h" #include "gui.h" +#include "debug.h" extern void errorexit(char *fmt, ...); extern void calc_vec2anglelen(position_f_2d *p, vector_2d *v); @@ -10,5 +12,6 @@ extern void calc_vec2anglelen(position_f_2d *p, vector_2d *v); #define sindeg(_angle_) sin((M_PI * _angle_ / 180.0)) #define cosdeg(_angle_) cos((M_PI * _angle_ / 180.0)) + #endif diff --git a/video.cc b/video.cc index f559163..f6b5f71 100644 --- a/video.cc +++ b/video.cc @@ -16,6 +16,7 @@ #include "video.h" #include "videodev.h" #include "histogram.h" +#include "simpleskycam.h" VideoDev *videodev = NULL; GThread *videodev_thread = NULL; @@ -234,6 +235,11 @@ void cb_videoda_draw(GtkWidget *area, cairo_t *cr, int w, int h, gpointer data) snprintf (txt2, 255, "Y: %f", detectedpos_data.dy); gtk_label_set_text(GTK_LABEL(lbX), txt1); gtk_label_set_text(GTK_LABEL(lbY), txt2); + +#ifdef DEBUG_ANGLES + debug_angles_draw(cr); +#endif + /* drawing the text on the screen disabled for (int i = 0; i < 5; i++) { int dx, dy; @@ -630,6 +636,10 @@ void cb_videoda_motionevent (GtkWidget *widget, GdkEvent *event, gpointer data) gdk_window_invalidate_rect(gtk_widget_get_window(video_da), NULL, true); } + +#ifdef DEBUG_ANGLES + debug_angles_motionevent(event); +#endif }; @@ -637,6 +647,10 @@ void cb_videoda_btnpress (GtkWidget *widget, GdkEvent *event, gpointer data) { int x = event->motion.x; int y = event->motion.y; +#ifdef DEBUG_ANGLES + debug_angles_btnpress(event); +#endif + printf ("%s:%d %s %d, %d\n", __FILE__, __LINE__, __FUNCTION__, x, y); }; diff --git a/videodev.cc b/videodev.cc index d8b5d62..105ff21 100644 --- a/videodev.cc +++ b/videodev.cc @@ -23,6 +23,7 @@ #include #include +#include "simpleskycam.h" #include "gui.h" #include "video.h" #include "videoframe.h" diff --git a/videodev.h b/videodev.h index 7d69b10..2987cbc 100644 --- a/videodev.h +++ b/videodev.h @@ -10,6 +10,7 @@ #include #include +#include "simpleskycam.h" #include "json.h" #include "gui.h" #include "config.h"