mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 04:30:35 +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) {
|
||||
|
||||
@@ -89,7 +89,8 @@ int gpio_led_main(int argc, char *argv[])
|
||||
"\t\tr2\tPX4IO RELAY2"
|
||||
);
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) || defined(CONFIG_ARCH_BOARD_PX4FMU_V4)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) || defined(CONFIG_ARCH_BOARD_PX4FMU_V4) \
|
||||
|| defined(CONFIG_ARCH_BOARD_MINDPX_V2)
|
||||
errx(1, "usage: gpio_led {start|stop} [-p <n>]\n"
|
||||
"\t-p <n>\tUse specified AUX OUT pin number (default: 1)"
|
||||
);
|
||||
@@ -111,7 +112,8 @@ int gpio_led_main(int argc, char *argv[])
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||
char *pin_name = "PX4FMU GPIO_EXT1";
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) || defined(CONFIG_ARCH_BOARD_PX4FMU_V4)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) || defined(CONFIG_ARCH_BOARD_PX4FMU_V4) \
|
||||
|| defined(CONFIG_ARCH_BOARD_MINDPX_V2)
|
||||
char pin_name[] = "AUX OUT 1";
|
||||
#endif
|
||||
|
||||
@@ -154,7 +156,8 @@ int gpio_led_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) || defined(CONFIG_ARCH_BOARD_PX4FMU_V4)
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) || defined(CONFIG_ARCH_BOARD_PX4FMU_V4) \
|
||||
|| defined(CONFIG_ARCH_BOARD_MINDPX_V2)
|
||||
unsigned int n = strtoul(argv[3], NULL, 10);
|
||||
|
||||
if (n >= 1 && n <= 6) {
|
||||
|
||||
@@ -893,7 +893,7 @@ Sensors::parameters_update()
|
||||
/* apply scaling according to defaults if set to default */
|
||||
#if defined (CONFIG_ARCH_BOARD_PX4FMU_V4)
|
||||
_parameters.battery_voltage_scaling = 0.011f;
|
||||
#elif defined (CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
#elif defined (CONFIG_ARCH_BOARD_PX4FMU_V2) || defined ( CONFIG_ARCH_BOARD_MINDPX_V2 )
|
||||
_parameters.battery_voltage_scaling = 0.0082f;
|
||||
#elif defined (CONFIG_ARCH_BOARD_AEROCORE)
|
||||
_parameters.battery_voltage_scaling = 0.0063f;
|
||||
@@ -914,7 +914,7 @@ Sensors::parameters_update()
|
||||
#if defined (CONFIG_ARCH_BOARD_PX4FMU_V4)
|
||||
/* current scaling for ACSP4 */
|
||||
_parameters.battery_current_scaling = 0.029296875f;
|
||||
#elif defined (CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
#elif defined (CONFIG_ARCH_BOARD_PX4FMU_V2) || defined ( CONFIG_ARCH_BOARD_MINDPX_V2 )
|
||||
/* current scaling for 3DR power brick */
|
||||
_parameters.battery_current_scaling = 0.0124f;
|
||||
#elif defined (CONFIG_ARCH_BOARD_AEROCORE)
|
||||
|
||||
Reference in New Issue
Block a user