APMrover2: update for changed AP_Camera API

This commit is contained in:
Andrew Tridgell 2016-01-19 16:26:14 +11:00
parent 061ee5e4fd
commit eed575886c
4 changed files with 20 additions and 26 deletions

View File

@ -68,7 +68,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
SCHED_TASK(update_events, 50, 1000),
SCHED_TASK(check_usb_mux, 3, 1000),
SCHED_TASK(mount_update, 50, 600),
SCHED_TASK(update_trigger, 1, 600),
SCHED_TASK(update_trigger, 50, 600),
SCHED_TASK(gcs_failsafe_check, 10, 600),
SCHED_TASK(compass_accumulate, 50, 900),
SCHED_TASK(update_notify, 50, 300),
@ -188,13 +188,12 @@ void Rover::update_trigger(void)
{
#if CAMERA == ENABLED
camera.trigger_pic_cleanup();
if(camera._camera_triggered == 0 && camera._feedback_pin != -1 && check_digital_pin(camera._feedback_pin) == 0){
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
camera._camera_triggered = 1;
}
if (camera.check_trigger_pin()) {
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
}
#endif
}
@ -523,4 +522,4 @@ void Rover::update_navigation()
}
}
AP_HAL_MAIN_CALLBACKS(&rover);
AP_HAL_MAIN_CALLBACKS(&rover);

View File

@ -48,7 +48,6 @@ bool Rover::print_log_menu(void)
PLOG(COMPASS);
PLOG(CAMERA);
PLOG(STEERING);
PLOG(TRIGGER);
#undef PLOG
}
@ -128,7 +127,6 @@ int8_t Rover::select_logs(uint8_t argc, const Menu::arg *argv)
TARG(COMPASS);
TARG(CAMERA);
TARG(STEERING);
TARG(TRIGGER);
#undef TARG
}
@ -477,4 +475,4 @@ void Rover::Log_Write_Attitude() {}
void Rover::start_logging() {}
void Rover::Log_Write_RC(void) {}
#endif // LOGGING_ENABLED
#endif // LOGGING_ENABLED

View File

@ -370,16 +370,14 @@ void Rover::do_take_picture()
// log_picture - log picture taken and send feedback to GCS
void Rover::log_picture()
{
if (camera._feedback_pin == -1 ){
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
if (!camera.using_feedback_pin()) {
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
} else {
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Trigger(ahrs, gps, current_loc);
}
}
else {
camera._camera_triggered = 0;
if (should_log(MASK_LOG_TRIGGER)) {
DataFlash.Log_Write_Trigger(ahrs, gps, current_loc);
}
}
}
}

View File

@ -92,7 +92,6 @@ enum mode {
#define MASK_LOG_ARM_DISARM (1<<15)
#define MASK_LOG_WHEN_DISARMED (1UL<<16)
#define MASK_LOG_IMU_RAW (1UL<<19)
#define MASK_LOG_TRIGGER (1UL<<20)
// Waypoint Modes
@ -128,4 +127,4 @@ enum mode {
// convert a boolean (0 or 1) to a sign for multiplying (0 maps to 1, 1 maps to -1)
#define BOOL_TO_SIGN(bvalue) ((bvalue)?-1:1)
#endif // _DEFINES_H
#endif // _DEFINES_H