camera_trigger : enforce a minimum activation time in PWM modes

This commit is contained in:
Mohammed Kabir
2017-04-13 13:07:59 +02:00
committed by Lorenz Meier
parent 24f57b00a6
commit ae35bf524d
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -231,7 +231,7 @@ CameraTrigger::CameraTrigger() :
//Initiate Camera interface basedon camera_interface_mode
if (_camera_interface != nullptr) {
delete (_camera_interface);
/* set to zero to ensure parser is not used while not instantiated */
// set to zero to ensure parser is not used while not instantiated
_camera_interface = nullptr;
}
@@ -268,7 +268,7 @@ CameraTrigger::CameraTrigger() :
#endif
case CAMERA_INTERFACE_MODE_MAVLINK:
/* start an interface that does nothing. Instead mavlink will listen to the camera_trigger uORB message */
// start an interface that does nothing. Instead mavlink will listen to the camera_trigger uORB message
_camera_interface = new CameraInterface();
break;
@@ -277,6 +277,16 @@ CameraTrigger::CameraTrigger() :
break;
}
// Enforce a lower bound on the activation interval in PWM modes to not miss
// engage calls in-between 50Hz PWM pulses. (see PX4 PR #6973)
if ((_activation_time < 40.0f) &&
(_camera_interface_mode == CAMERA_INTERFACE_MODE_GENERIC_PWM ||
_camera_interface_mode == CAMERA_INTERFACE_MODE_SEAGULL_MAP2_PWM)) {
_activation_time = 40.0f;
PX4_WARN("Trigger interval too low for PWM interface, setting to 40 ms");
param_set(_p_activation_time, &(_activation_time));
}
struct camera_trigger_s report = {};
_trigger_pub = orb_advertise(ORB_ID(camera_trigger), &report);
@@ -92,7 +92,7 @@ PARAM_DEFINE_INT32(TRIG_POLARITY, 0);
* @decimal 1
* @group Camera trigger
*/
PARAM_DEFINE_FLOAT(TRIG_ACT_TIME, 0.5f);
PARAM_DEFINE_FLOAT(TRIG_ACT_TIME, 40.0f);
/**
* Camera trigger mode