Skip to content

Commit

Permalink
cleanup whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Feb 15, 2011
1 parent db377e0 commit 27a2c79
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 197 deletions.
13 changes: 6 additions & 7 deletions conf/modules/digital_cam.xml
@@ -1,8 +1,8 @@
<!DOCTYPE module SYSTEM "./module.dtd">

<!--
<!--
// Use (parts of) the following section in airframe file to change
// Use (parts of) the following section in airframe file to change
<section name="DIGITAL_CAMERA" prefix="DC_">
Expand All @@ -13,9 +13,9 @@
<configure name="AUTOSHOOT_METER_GRID" value="50" unit="meter"/>
</section>
# ap.CFLAGS += -DGPS_TRIGGERED_FUNCTION="dc_shoot_on_gps"
# ap.CFLAGS += -DDC_GPS_TRIGGER_START=1
# ap.CFLAGS += -DDC_GPS_TRIGGER_STOP=3
# ap.CFLAGS += -DGPS_TRIGGERED_FUNCTION="dc_shoot_on_gps"
# ap.CFLAGS += -DDC_GPS_TRIGGER_START=1
# ap.CFLAGS += -DDC_GPS_TRIGGER_STOP=3
-->

Expand All @@ -33,10 +33,9 @@
<define name="DIGITAL_CAM" />
<file name="led_cam_ctrl.c"/>
<file name="dc.c"/>
<define name="SENSOR_SYNC_SEND" value="1" />
<define name="SENSOR_SYNC_SEND" value="1" />

</makefile>


</module>

77 changes: 39 additions & 38 deletions sw/airborne/modules/digital_cam/dc.c
Expand Up @@ -58,17 +58,17 @@ uint16_t dc_buffer = 0;
#include "estimator.h"
#include "latlong.h"

void dc_send_shot_position(void)
{
int16_t phi = DegOfRad(estimator_phi*10.0f);
int16_t theta = DegOfRad(estimator_theta*10.0f);
float gps_z = ((float)gps_alt) / 100.0f;
int16_t photo_nr = -1;
void dc_send_shot_position(void)
{
int16_t phi = DegOfRad(estimator_phi*10.0f);
int16_t theta = DegOfRad(estimator_theta*10.0f);
float gps_z = ((float)gps_alt) / 100.0f;
int16_t photo_nr = -1;

latlong_of_utm(gps_utm_east/100, gps_utm_north/100, gps_utm_zone);
latlong_of_utm(gps_utm_east/100, gps_utm_north/100, gps_utm_zone);

// float gps_lat_send = DegOfRad(latlong_lat);
// float gps_lon_send = DegOfRad(latlong_lon);
// float gps_lat_send = DegOfRad(latlong_lat);
// float gps_lon_send = DegOfRad(latlong_lon);

if (dc_buffer < DC_IMAGE_BUFFER) {
dc_buffer++;
Expand All @@ -77,38 +77,38 @@ uint16_t dc_buffer = 0;
}


DOWNLINK_SEND_DC_SHOT(DefaultChannel,
&photo_nr,
&gps_utm_east,
&gps_utm_north,
&gps_z,
&gps_utm_zone,
&phi,
&theta,
&gps_course,
&gps_gspeed,
&gps_itow);
}
#endif
uint8_t dc_info(void) {
DOWNLINK_SEND_DC_SHOT(DefaultChannel,
&photo_nr,
&gps_utm_east,
&gps_utm_north,
&gps_z,
&gps_utm_zone,
&phi,
&theta,
&gps_course,
&gps_gspeed,
&gps_itow);
}
#endif /* SENSOR_SYNC_SEND */

uint8_t dc_info(void) {
#ifdef DOWNLINK_SEND_DC_INFO
float course = DegOfRad(estimator_psi);
DOWNLINK_SEND_DC_INFO(DefaultChannel,
&dc_autoshoot,
&estimator_x,
&estimator_y,
&course,
&dc_buffer,
&dc_gps_dist,
&dc_gps_next_dist,
&dc_gps_x,
&dc_gps_y,
&dc_circle_start_angle,
&dc_circle_interval,
&dc_circle_last_block,
&dc_gps_count,
&dc_autoshoot_quartersec_period);
&dc_autoshoot,
&estimator_x,
&estimator_y,
&course,
&dc_buffer,
&dc_gps_dist,
&dc_gps_next_dist,
&dc_gps_x,
&dc_gps_y,
&dc_circle_start_angle,
&dc_circle_interval,
&dc_circle_last_block,
&dc_gps_count,
&dc_autoshoot_quartersec_period);
#endif
return 0;
}
Expand All @@ -133,6 +133,7 @@ uint8_t dc_circle(float interval, float start) {
dc_info();
return 0;
}

/* shoot on survey */
uint8_t dc_survey(float interval, float x, float y) {
dc_autoshoot = DC_AUTOSHOOT_SURVEY;
Expand All @@ -153,6 +154,7 @@ uint8_t dc_survey(float interval, float x, float y) {
dc_info();
return 0;
}

uint8_t dc_stop(void) {
dc_autoshoot = DC_AUTOSHOOT_STOP;
dc_info();
Expand Down Expand Up @@ -192,4 +194,3 @@ static inline void dc_shoot_on_gps( void ) {
}
}
*/

114 changes: 57 additions & 57 deletions sw/airborne/modules/digital_cam/dc.h
Expand Up @@ -24,8 +24,8 @@
/** \file dc.h
* \brief Standard Digital Camera Control Interface
*
* -Standard IO
* -I2C Control
* -Standard IO
* -I2C Control
*
* Usage: (from the flight plan, the settings or any airborne code):
* - dc_send_command( )
Expand Down Expand Up @@ -76,26 +76,26 @@ extern uint8_t dc_cam_tracing;

/* Generic Set of Digital Camera Commands */
typedef enum {
DC_GET_STATUS = 0,
DC_GET_STATUS = 0,

DC_HOLD = 13,
DC_SHOOT = 32,
DC_HOLD = 13,
DC_SHOOT = 32,

DC_WIDER = 'w',
DC_TALLER = 't',
DC_WIDER = 'w',
DC_TALLER = 't',

DC_UP = 'u',
DC_DOWN = 'd',
DC_CENTER = 'c',
DC_LEFT = 'l',
DC_RIGHT = 'r',
DC_UP = 'u',
DC_DOWN = 'd',
DC_CENTER = 'c',
DC_LEFT = 'l',
DC_RIGHT = 'r',

DC_MENU = 'm',
DC_HOME = 'h',
DC_PLAY = 'p',
DC_MENU = 'm',
DC_HOME = 'h',
DC_PLAY = 'p',

DC_ON = 'O',
DC_OFF = 'o',
DC_ON = 'O',
DC_OFF = 'o',

} dc_command_type;

Expand All @@ -104,12 +104,12 @@ static inline void dc_send_command(uint8_t cmd);

/* Auotmatic Digital Camera Photo Triggering */
typedef enum {
DC_AUTOSHOOT_STOP = 0,
DC_AUTOSHOOT_PERIODIC = 1,
DC_AUTOSHOOT_DISTANCE = 2,
DC_AUTOSHOOT_EXT_TRIG = 3,
DC_AUTOSHOOT_SURVEY = 4,
DC_AUTOSHOOT_CIRCLE = 5
DC_AUTOSHOOT_STOP = 0,
DC_AUTOSHOOT_PERIODIC = 1,
DC_AUTOSHOOT_DISTANCE = 2,
DC_AUTOSHOOT_EXT_TRIG = 3,
DC_AUTOSHOOT_SURVEY = 4,
DC_AUTOSHOOT_CIRCLE = 5
} dc_autoshoot_type;
extern dc_autoshoot_type dc_autoshoot;

Expand Down Expand Up @@ -198,7 +198,7 @@ static inline void dc_init(void)
#endif
}

/* shoot on grid
/* shoot on grid
static inline void dc_shot_on_utm_north_close_to_100m_grid( void )
{
uint32_t dist_to_100m_grid = (gps_utm_north / 100) % 100;
Expand All @@ -221,10 +221,10 @@ static float dim_mod(float a, float b, float m) {
static inline void dc_periodic_4Hz( void )
{
static uint8_t dc_shutter_timer = 0;

switch (dc_autoshoot) {

case DC_AUTOSHOOT_PERIODIC:
case DC_AUTOSHOOT_PERIODIC:
if (dc_shutter_timer) {
dc_shutter_timer--;
} else {
Expand All @@ -244,43 +244,43 @@ static uint8_t dc_shutter_timer = 0;
break;

case DC_AUTOSHOOT_CIRCLE: {
float course = DegOfRad(estimator_psi) - dc_circle_start_angle;
if (course < 0.)
course += 360.;
float current_block = floorf(course/dc_circle_interval);

if (dc_probing) {
if (current_block == dc_circle_last_block) {
dc_probing = FALSE;
}
}

if (dim_mod(current_block, dc_circle_last_block, dc_circle_max_blocks) == 1) {
dc_gps_count++;
dc_circle_last_block = current_block;
dc_send_command(DC_SHOOT);
}
float course = DegOfRad(estimator_psi) - dc_circle_start_angle;
if (course < 0.)
course += 360.;
float current_block = floorf(course/dc_circle_interval);

if (dc_probing) {
if (current_block == dc_circle_last_block) {
dc_probing = FALSE;
}
}

if (dim_mod(current_block, dc_circle_last_block, dc_circle_max_blocks) == 1) {
dc_gps_count++;
dc_circle_last_block = current_block;
dc_send_command(DC_SHOOT);
}
}
break;

case DC_AUTOSHOOT_SURVEY : {
float dist_x = dc_gps_x - estimator_x;
float dist_y = dc_gps_y - estimator_y;

if (dc_probing) {
if (dist_x*dist_x + dist_y*dist_y < dc_gps_dist*dc_gps_dist) {
dc_probing = FALSE;
}
}

if (dist_x*dist_x + dist_y*dist_y >= dc_gps_next_dist*dc_gps_next_dist) {
dc_gps_next_dist += dc_gps_dist;
dc_gps_count++;
dc_send_command(DC_SHOOT);
}
float dist_x = dc_gps_x - estimator_x;
float dist_y = dc_gps_y - estimator_y;

if (dc_probing) {
if (dist_x*dist_x + dist_y*dist_y < dc_gps_dist*dc_gps_dist) {
dc_probing = FALSE;
}
}

if (dist_x*dist_x + dist_y*dist_y >= dc_gps_next_dist*dc_gps_next_dist) {
dc_gps_next_dist += dc_gps_dist;
dc_gps_count++;
dc_send_command(DC_SHOOT);
}
}
break;

default :
dc_autoshoot = DC_AUTOSHOOT_STOP;
}
Expand Down

0 comments on commit 27a2c79

Please sign in to comment.