mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 20:10:34 +08:00
supports MindPXv2 borad which is a product from AirMind.
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
*
|
||||
* Definition of esc calibration
|
||||
*
|
||||
* @author Roman Bapst <bapstr@ethz.ch>
|
||||
* @author Roman Bapst <roman@px4.io>
|
||||
*/
|
||||
|
||||
#include "esc_calibration.h"
|
||||
@@ -65,6 +65,19 @@
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
int check_if_batt_disconnected(orb_advert_t *mavlink_log_pub) {
|
||||
struct battery_status_s battery;
|
||||
memset(&battery,0,sizeof(battery));
|
||||
int batt_sub = orb_subscribe(ORB_ID(battery_status));
|
||||
orb_copy(ORB_ID(battery_status), batt_sub, &battery);
|
||||
|
||||
if (battery.voltage_filtered_v > 3.0f && !(hrt_absolute_time() - battery.timestamp > 500000)) {
|
||||
mavlink_log_info(mavlink_log_pub, "Please disconnect battery and try again!");
|
||||
return ERROR;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int do_esc_calibration(orb_advert_t *mavlink_log_pub, struct actuator_armed_s* armed)
|
||||
{
|
||||
int return_code = OK;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*
|
||||
* Definition of esc calibration
|
||||
*
|
||||
* @author Roman Bapst <bapstr@ethz.ch>
|
||||
* @author Roman Bapst <roman@px4.io>
|
||||
*/
|
||||
|
||||
#ifndef ESC_CALIBRATION_H_
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
|
||||
int check_if_batt_disconnected(orb_advert_t *mavlink_log_pub);
|
||||
int do_esc_calibration(orb_advert_t *mavlink_log_pub, struct actuator_armed_s* armed);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -71,6 +71,14 @@
|
||||
using namespace DriverFramework;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_MINDPX_V2
|
||||
#define AVIONICS_ERROR_VOLTAGE 3.75f
|
||||
#define AVIONICS_WARN_VOLTAGE 3.9f
|
||||
#else
|
||||
#define AVIONICS_ERROR_VOLTAGE 4.5f
|
||||
#define AVIONICS_WARN_VOLTAGE 4.9f
|
||||
#endif
|
||||
|
||||
// This array defines the arming state transitions. The rows are the new state, and the columns
|
||||
// are the current state. Using new state and current state you can index into the array which
|
||||
// will be true for a valid transition or false for a invalid transition. In some cases even
|
||||
@@ -213,11 +221,11 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
|
||||
// are measured but are insufficient
|
||||
if (status->condition_power_input_valid && (status->avionics_power_rail_voltage > 0.0f)) {
|
||||
// Check avionics rail voltages
|
||||
if (status->avionics_power_rail_voltage < 4.5f) {
|
||||
if (status->avionics_power_rail_voltage < AVIONICS_ERROR_VOLTAGE) {
|
||||
mavlink_and_console_log_critical(mavlink_log_pub, "NOT ARMING: Avionics power low: %6.2f Volt", (double)status->avionics_power_rail_voltage);
|
||||
feedback_provided = true;
|
||||
valid_transition = false;
|
||||
} else if (status->avionics_power_rail_voltage < 4.9f) {
|
||||
} else if (status->avionics_power_rail_voltage < AVIONICS_WARN_VOLTAGE) {
|
||||
mavlink_and_console_log_critical(mavlink_log_pub, "CAUTION: Avionics power low: %6.2f Volt", (double)status->avionics_power_rail_voltage);
|
||||
feedback_provided = true;
|
||||
} else if (status->avionics_power_rail_voltage > 5.4f) {
|
||||
|
||||
Reference in New Issue
Block a user