diff --git a/APMrover2/APMrover2.cpp b/APMrover2/APMrover2.cpp index f3ba1201c7..6d40bb01bf 100644 --- a/APMrover2/APMrover2.cpp +++ b/APMrover2/APMrover2.cpp @@ -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); \ No newline at end of file +AP_HAL_MAIN_CALLBACKS(&rover); diff --git a/APMrover2/Log.cpp b/APMrover2/Log.cpp index 72b120fa41..e6fa309c98 100644 --- a/APMrover2/Log.cpp +++ b/APMrover2/Log.cpp @@ -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 \ No newline at end of file +#endif // LOGGING_ENABLED diff --git a/APMrover2/commands_logic.cpp b/APMrover2/commands_logic.cpp index 4254a03d85..a20f6f7258 100644 --- a/APMrover2/commands_logic.cpp +++ b/APMrover2/commands_logic.cpp @@ -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); - } - } -} \ No newline at end of file +} diff --git a/APMrover2/defines.h b/APMrover2/defines.h index 609c299b97..ac91574c8a 100644 --- a/APMrover2/defines.h +++ b/APMrover2/defines.h @@ -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 \ No newline at end of file +#endif // _DEFINES_H