Skip to main content

Power Management

The header file for PSDK power management-related functions is uav_power_management.h. This document describes the key information and usage of structures and function prototypes in the uav_power_management.h file.

Table of Contents

  • Macro Definitions, Enumerations, and Structures
    E_UAVPowerManagementPinState
    UAVWriteHighPowerApplyPinCallback
    UAVPowerOffNotificationCallback
  • Function Prototypes
    UAV_PowerManagement_Init
    UAV_PowerManagement_Deinit
    UAV_PowerManagement_ApplyHighPowerSync
    UAV_PowerManagement_RegWriteHighPowerApplyPinCallback
    UAV_PowerManagement_PowerOffNotificationCallback

Macro Definitions, Enumerations, and Structures

typedef enum E_UAVPowerManagementPinState

The status of the high-power pin.

typedef enum {
UAV_POWER_MANAGEMENT_PIN_STATE_DISABLE= 0, /*!< Specifies pin is in low level state. */
UAV_POWER_MANAGEMENT_PIN_STATE_ENABLE = 1 /*!< Specifies pin is in high level state. */
}E_UAVPowerManagementPinState;

typedef function UAVWriteHighPowerApplyPinCallback

  • Function: Set the status of the high-power pin. In the current version, this cannot be set via software during network communication, but the same effect can be achieved by pulling the hardware pin high. Refer to the UAV hardware interface for operation details.
  • product: all

Callback function for setting the status of the high-power pin.

typedef T_UAVReturnCode (*UAVWriteHighPowerApplyPinCallback)(E_UAVPowerManagementPinState pinState);
  • ParameterspinState:The state of the high-power pin.
  • Return Value The return value corresponds to the program execution status. For details, please refer to the UAV Error Codes.

typedef function UAVPowerOffNotificationCallback

  • Function: Shutdown Notification
  • product: all

This notifies the payload device that the drone is about to shut down and retrieves the payload device's shutdown preparation status through a callback function.

Note:

  • To prevent this function from blocking the PSDK main thread, which could cause program responsiveness issues, camera payload disconnections, or infinite loops, please avoid executing this function in a blocking manner within the callback function.
typedef T_UAVReturnCode (*UAVPowerOffNotificationCallback)(bool *powerOffPreparationFlag);
  • ParameterpowerOffPreparationFlag:A pointer to the memory space used to store the shutdown preparation status.
  • Return Value The corresponding return value based on the program's execution status. For details, refer to: UAV Error Codes.

Function Prototypes

function UAV_PowerManagement_Init

  • Function: Initialize the power management module.
  • product: all

This function initializes the power management module. The user should call this function before using power management features.

T_UAVReturnCode UAV_PowerManagement_Init(void);
  • Parameternone
  • Return Value The corresponding return value based on the program's execution status. For details, refer to: UAV Error Codes.

function UAV_PowerManagement_Deinit

  • Function:Uninitialize the power management module.
  • product: all
T_UAVReturnCode UAV_PowerManagement_Deinit(void);
  • Parameternone
  • Return Value The function will return a corresponding value based on the program's execution status. For more details, refer to the UAV Error Codes.

function UAV_PowerManagement_ApplyHighPowerSync

  • Function:Apply high power in blocking mode from the drone.
  • product: all

Before using this function, the user should register a callback function using UAV_PowerManagement_RegWriteHighPowerApplyPinCallback() to set the power application pin's level status. After applying high power, the UAV adapter's power pin will output high power according to the predetermined specifications. The maximum execution time of this function is slightly greater than 600ms.

T_UAVReturnCode UAV_PowerManagement_ApplyHighPowerSync(void);
  • Parameternone
  • Return Value The return value depends on the execution of the program. For details, refer to the UAV Error Codes.

function UAV_PowerManagement_RegWriteHighPowerApplyPinCallback

  • Function:Registers a callback function to set the power application pin's level status.

    Product: all.

  • product: all

This function registers a callback for setting the power application pin's level status. It must be called before applying high power.

T_UAVReturnCode UAV_PowerManagement_RegWriteHighPowerApplyPinCallback(UAVWriteHighPowerApplyPinCallback callback);
  • Parametercallback:Pointer to the callback function.
  • Return Value The return value depends on the execution of the program. For details, refer to the UAV Error Codes.

function UAV_PowerManagement_PowerOffNotificationCallback

  • Function: Registers a callback function to notify the Payload that the UAV is about to power off and to check whether the Payload is ready for shutdown.
  • product: all

After registration, the callback function will be called at a fixed frequency when the UAV is about to shut down. The user fills in the shutdown preparation flag. Once the Payload is ready to shut down, the callback function will not be called again. After the specified time (10s), if the Payload is not ready, the UAV will immediately shut down.

T_UAVReturnCode UAV_PowerManagement_PowerOffNotificationCallback(UAVPowerOffNotificationCallback callback);
  • Parametercallback:A pointer to the callback function used to notify the UAV shutdown message and retrieve the payload shutdown readiness flag.
  • Return Value The return value depends on the execution of the program. For details, refer to the UAV Error Codes.