camera_trigger: Use proper types

This commit is contained in:
David Sidrane 2021-04-21 08:17:37 -07:00 committed by Julian Oes
parent 7b2a1d4742
commit c12a3330b8
2 changed files with 5 additions and 4 deletions

View File

@ -52,8 +52,8 @@ void CameraInterface::get_pins()
_pins[i] = -1;
}
int pin_list = 0;
int pin_list_ex = 0;
int32_t pin_list = 0;
int32_t pin_list_ex = 0;
if (_p_pin_ex != PARAM_INVALID) {
param_get(_p_pin_ex, &pin_list_ex);

View File

@ -73,7 +73,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, (int32_t) 0, (int32_t) 2000));
}
}
@ -84,7 +84,8 @@ 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, (int32_t) 0,
(int32_t) 2000));
}
}
}