diff --git a/conf/flight_plans/BMSM.xml b/conf/flight_plans/BMSM.xml index e46ae8869e..656137744d 100644 --- a/conf/flight_plans/BMSM.xml +++ b/conf/flight_plans/BMSM.xml @@ -4,6 +4,7 @@
#include "nav_line.h" #include "datalink.h" +#include "dc.h"
@@ -18,7 +19,6 @@ - @@ -57,7 +57,7 @@ - + diff --git a/conf/settings/dc.xml b/conf/settings/dc.xml index aec823f096..ed97cb2652 100644 --- a/conf/settings/dc.xml +++ b/conf/settings/dc.xml @@ -10,6 +10,7 @@ + diff --git a/sw/airborne/dc.c b/sw/airborne/dc.c index d2239cb3cd..839265e96c 100644 --- a/sw/airborne/dc.c +++ b/sw/airborne/dc.c @@ -3,3 +3,4 @@ uint8_t dc_timer; uint8_t dc_periodic_shutter; uint8_t dc_shutter_timer; +uint8_t dc_utm_threshold; diff --git a/sw/airborne/dc.h b/sw/airborne/dc.h index cfb8177455..ba30c86f6b 100644 --- a/sw/airborne/dc.h +++ b/sw/airborne/dc.h @@ -18,6 +18,10 @@ extern uint8_t dc_periodic_shutter; extern uint8_t dc_shutter_timer; /* In s. Related counter */ +extern uint8_t dc_utm_threshold; +/* In m. If non zero, automatic shots when greater than utm_north % 100 */ + + #define SHUTTER_DELAY 2 /* 4Hz -> 0.5s */ @@ -42,6 +46,7 @@ static inline uint8_t dc_zoom( void ) { #define dc_Zoom(_) { dc_zoom(); } #define dc_Periodic(s) { dc_periodic_shutter = s; dc_shutter_timer = s; } + #define dc_init() { /* initialized as leds */ dc_periodic_shutter = 0; } /* Output */ /* 4Hz */ @@ -66,4 +71,12 @@ static inline void dc_periodic( void ) { } } +static inline void dc_shot_on_utm_north_close_to_100m_grid( void ) { + if (dc_utm_threshold && !dc_timer) { + uint32_t dist_to_100m_grid = (gps_utm_north) / 100 % 100; + if (dist_to_100m_grid < dc_utm_threshold || 100 - dist_to_100m_grid < dc_utm_threshold) + dc_shutter(); + } +} + #endif // DC_H