Browse Source

CameraTrigger: Feedback fixes

sbg
Hamish Willee 6 years ago committed by Beat Küng
parent
commit
541b962654
  1. 2
      src/drivers/camera_trigger/camera_trigger_params.c
  2. 16
      src/drivers/camera_trigger/interfaces/src/pwm.cpp
  3. 3
      src/drivers/camera_trigger/interfaces/src/pwm.h

2
src/drivers/camera_trigger/camera_trigger_params.c

@ -143,8 +143,6 @@ PARAM_DEFINE_FLOAT(TRIG_DISTANCE, 25.0f); @@ -143,8 +143,6 @@ PARAM_DEFINE_FLOAT(TRIG_DISTANCE, 25.0f);
/**
* PWM output to trigger shot.
*
* @reboot_required true
*
* @min 1000
* @max 2000
* @unit us

16
src/drivers/camera_trigger/interfaces/src/pwm.cpp

@ -9,19 +9,11 @@ @@ -9,19 +9,11 @@
#include "pwm.h"
// TODO : make these parameters later
//#define PWM_CAMERA_SHOOT 1900
//#define PWM_CAMERA_NEUTRAL 1500
int32_t pwm_camera_shoot = 0;
param_get(param_find("TRIG_PWM_SHOOT"), &pwm_camera_shoot);
int32_t pwm_camera_neutral = 0;
param_get(param_find("TRIG_PWM_NEUTRAL"), &pwm_camera_neutral);
CameraInterfacePWM::CameraInterfacePWM():
CameraInterface()
{
param_get(param_find("TRIG_PWM_SHOOT"), &_pwm_camera_shoot);
param_get(param_find("TRIG_PWM_NEUTRAL"), &_pwm_camera_neutral);
get_pins();
setup();
}
@ -49,7 +41,7 @@ void CameraInterfacePWM::setup() @@ -49,7 +41,7 @@ void CameraInterfacePWM::setup()
// Set neutral pulsewidths
for (unsigned i = 0; i < arraySize(_pins); i++) {
if (_pins[i] >= 0) {
up_pwm_trigger_set(_pins[i], math::constrain(pwm_camera_neutral, 0, 2000));
up_pwm_trigger_set(_pins[i], math::constrain(_pwm_camera_neutral, 0, 2000));
}
}
@ -60,7 +52,7 @@ void CameraInterfacePWM::trigger(bool trigger_on_true) @@ -60,7 +52,7 @@ void CameraInterfacePWM::trigger(bool trigger_on_true)
for (unsigned i = 0; i < arraySize(_pins); i++) {
if (_pins[i] >= 0) {
// Set all valid pins to shoot or neutral levels
up_pwm_trigger_set(_pins[i], math::constrain(trigger_on_true ? pwm_camera_shoot : pwm_camera_neutral, 0, 2000));
up_pwm_trigger_set(_pins[i], math::constrain(trigger_on_true ? _pwm_camera_shoot : _pwm_camera_neutral, 0, 2000));
}
}
}

3
src/drivers/camera_trigger/interfaces/src/pwm.h

@ -25,7 +25,8 @@ public: @@ -25,7 +25,8 @@ public:
void info();
private:
int32_t _pwm_camera_shoot = 0;
int32_t _pwm_camera_neutral = 0;
void setup();
};

Loading…
Cancel
Save