48 #include <px4_platform_common/defines.h> 49 #include <px4_platform_common/posix.h> 50 #include <px4_platform_common/time.h> 59 int return_code = PX4_OK;
61 #if defined(__PX4_POSIX_OCPOC) || defined(__PX4_POSIX_BBBLUE) 80 if (return_code ==
OK) {
88 bool batt_connected =
true;
100 return_code = PX4_ERROR;
109 batt_connected =
false;
112 if (batt_connected) {
114 return_code = PX4_ERROR;
124 return_code = PX4_ERROR;
131 return_code = PX4_ERROR;
138 return_code = PX4_ERROR;
145 return_code = PX4_ERROR;
156 static constexpr
hrt_abstime battery_connect_wait_timeout{20_s};
157 static constexpr
hrt_abstime pwm_high_timeout{3_s};
158 hrt_abstime timeout_wait = batt_connected ? pwm_high_timeout : battery_connect_wait_timeout;
161 if (!batt_connected) {
163 return_code = PX4_ERROR;
171 if (!batt_connected) {
172 if (batt_sub.update()) {
175 batt_connected =
true;
205 if (return_code == PX4_OK) {
static orb_advert_t * mavlink_log_pub
#define PWM_SERVO_SET_ARM_OK
set the 'ARM ok' bit, which activates the safety switch
#define PWM_SERVO_SET_FORCE_SAFETY_ON
force safety switch on (to enable use of safety switch)
#define PWM_SERVO_ARM
arm all servo outputs handle by this driver
Common calibration messages.
#define PWM_SERVO_CLEAR_ARM_OK
clear the 'ARM ok' bit, which deactivates the safety switch
High-resolution timer with callouts and timekeeping.
bool in_esc_calibration_mode
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
#define PWM_OUTPUT0_DEVICE_PATH
int do_esc_calibration(orb_advert_t *mavlink_log_pub, struct actuator_armed_s *armed)
static struct actuator_armed_s armed
static hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
Compute the delta between a timestamp taken in the past and now.
#define CAL_QGC_STARTED_MSG
#define PWM_SERVO_SET_FORCE_SAFETY_OFF
force safety switch off (to disable use of safety switch)
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
Definition of esc calibration.
#define calibration_log_critical(_pub, _text,...)
#define CAL_QGC_FAILED_MSG
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
#define calibration_log_info(_pub, _text,...)
#define PWM_SERVO_DISARM
disarm all servo outputs (stop generating pulses)