CameraTrigger: Feedback fixes

This commit is contained in:
Hamish Willee 2018-12-23 15:59:59 -08:00 committed by Beat Küng
parent 68148c5fb4
commit 541b962654
3 changed files with 6 additions and 15 deletions

View File

@ -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

View File

@ -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()
// 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)
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));
}
}
}

View File

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