mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 05:53:35 +08:00
PWM automatic trigger system (ATS) for parachutes (#13726)
* parameter and logic to commander for triggering failsafe from external automatic trigger system. * logic to startup script for enabling ATS. Added uORB publishing to pwm_input module. * Refactored out CDev usage from pwm_input and ll40ls. Refactored out ll40ls specifics from pwm_input and cleaned up dead code.
This commit is contained in:
@@ -44,10 +44,13 @@
|
||||
|
||||
#include "LidarLitePWM.h"
|
||||
|
||||
#ifdef LIDAR_LITE_PWM_SUPPORTED
|
||||
|
||||
LidarLitePWM::LidarLitePWM(const uint8_t rotation) :
|
||||
LidarLite(rotation),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default)
|
||||
{
|
||||
px4_arch_configgpio(GPIO_VDD_RANGEFINDER_EN);
|
||||
}
|
||||
|
||||
LidarLitePWM::~LidarLitePWM()
|
||||
@@ -113,17 +116,16 @@ LidarLitePWM::measure()
|
||||
int
|
||||
LidarLitePWM::collect()
|
||||
{
|
||||
int fd = ::open(PWMIN0_DEVICE_PATH, O_RDONLY);
|
||||
pwm_input_s pwm_input;
|
||||
|
||||
if (fd == -1) {
|
||||
return PX4_ERROR;
|
||||
}
|
||||
if (_sub_pwm_input.update(&pwm_input)) {
|
||||
|
||||
_pwm = pwm_input;
|
||||
|
||||
if (::read(fd, &_pwm, sizeof(_pwm)) == sizeof(_pwm)) {
|
||||
::close(fd);
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
::close(fd);
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -45,14 +45,15 @@
|
||||
|
||||
#include "LidarLite.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <drivers/drv_pwm_input.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
|
||||
|
||||
#include <uORB/topics/pwm_input.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
|
||||
#ifdef GPIO_GPIO5_OUTPUT
|
||||
|
||||
#define LIDAR_LITE_PWM_SUPPORTED
|
||||
#define GPIO_VDD_RANGEFINDER_EN GPIO_GPIO5_OUTPUT
|
||||
|
||||
class LidarLitePWM : public LidarLite, public px4::ScheduledWorkItem
|
||||
{
|
||||
@@ -73,7 +74,9 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
int _pwmSub{-1};
|
||||
uORB::Subscription _sub_pwm_input{ORB_ID(pwm_input)};
|
||||
|
||||
pwm_input_s _pwm{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -164,7 +164,12 @@ start_pwm(const uint8_t rotation)
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
#ifdef LIDAR_LITE_PWM_SUPPORTED
|
||||
instance = new LidarLitePWM(rotation);
|
||||
#else
|
||||
instance = nullptr;
|
||||
PX4_ERR("PWM input not supported.");
|
||||
#endif
|
||||
|
||||
if (instance == nullptr) {
|
||||
PX4_ERR("Failed to instantiate the driver");
|
||||
|
||||
Reference in New Issue
Block a user