/* Command The Camera */ void dc_send_command(uint8_t cmd) { switch (cmd) { case DC_SHOOT: // Send Photo Position To Camera dc_shot_msg.data.nr = dc_photo_nr + 1; dc_shot_msg.data.lat = stateGetPositionLla_i()->lat; dc_shot_msg.data.lon = stateGetPositionLla_i()->lon; dc_shot_msg.data.alt = stateGetPositionLla_i()->alt; dc_shot_msg.data.phi = stateGetNedToBodyEulers_i()->phi; dc_shot_msg.data.theta = stateGetNedToBodyEulers_i()->theta; dc_shot_msg.data.psi = stateGetNedToBodyEulers_i()->psi; dc_shot_msg.data.vground = *stateGetHorizontalSpeedNorm_i(); dc_shot_msg.data.course = *stateGetHorizontalSpeedDir_i(); dc_shot_msg.data.groundalt = POS_BFP_OF_REAL(state.alt_agl_f); MoraHeader(MORA_SHOOT, MORA_SHOOT_MSG_SIZE); for (int i = 0; i < (MORA_SHOOT_MSG_SIZE); i++) { MoraPutUint8(dc_shot_msg.bin[i]); } MoraTrailer(); dc_send_shot_position(); break; case DC_TALLER: break; case DC_WIDER: break; case DC_ON: break; case DC_OFF: break; default: break; } }
/* Command The Camera */ void dc_send_command(uint8_t cmd) { dc_timer = DC_SHUTTER_DELAY; switch (cmd) { case DC_SHOOT: DC_PUSH(DC_SHUTTER_SERVO); #ifndef DC_SHOOT_ON_BUTTON_RELEASE dc_send_shot_position(); #endif break; #ifdef DC_ZOOM_IN_SERVO case DC_TALLER: DC_PUSH(DC_ZOOM_IN_SERVO); break; #endif #ifdef DC_ZOOM_OUT_SERVO case DC_WIDER: DC_PUSH(DC_ZOOM_OUT_SERVO); break; #endif #ifdef DC_POWER_SERVO case DC_ON: DC_PUSH(DC_POWER_SERVO); break; #endif default: break; } }
void atmega_i2c_cam_ctrl_send(uint8_t cmd) { static uint8_t zoom = 0; static uint8_t mode = 0; unsigned char cam_ret[1]; if (cmd == DC_SHOOT) { dc_send_shot_position(); } else if (cmd == DC_TALLER) { zoom = 1; } else if (cmd == DC_WIDER) { zoom = 0; } else if (cmd == DC_GET_STATUS) { mode++; if (mode > 15) mode = 0; } cam_ret[0] = mode + zoom * 0x20; RunOnceEvery(6,DOWNLINK_SEND_PAYLOAD(DefaultChannel, DefaultDevice, 1, cam_ret )); }
void atmega_i2c_cam_ctrl_send(uint8_t cmd) { atmega_i2c_cam_ctrl_just_sent_command = 1; // Send Command atmega_i2c_cam_ctrl_trans.buf[0] = cmd; I2CTransceive(ATMEGA_I2C_DEV, atmega_i2c_cam_ctrl_trans, ATMEGA_SLAVE_ADDR, 1, 1); if (cmd == DC_SHOOT) { dc_send_shot_position(); } }