camera_interface: initialize _p_pin & handle error

This commit is contained in:
Beat Küng
2017-04-24 16:09:38 +02:00
committed by Lorenz Meier
parent f42a626527
commit 44a507fcfe

View File

@@ -1,4 +1,5 @@
#include "camera_interface.h" #include "camera_interface.h"
#include <px4_log.h>
/** /**
* @file camera_interface.cpp * @file camera_interface.cpp
@@ -6,6 +7,7 @@
*/ */
CameraInterface::CameraInterface(): CameraInterface::CameraInterface():
_p_pin(PARAM_INVALID),
_pins{} _pins{}
{ {
} }
@@ -20,6 +22,11 @@ void CameraInterface::get_pins()
// Get parameter handle // Get parameter handle
_p_pin = param_find("TRIG_PINS"); _p_pin = param_find("TRIG_PINS");
if (_p_pin == PARAM_INVALID) {
PX4_ERR("param TRIG_PINS not found");
return;
}
int pin_list; int pin_list;
param_get(_p_pin, &pin_list); param_get(_p_pin, &pin_list);