mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-28 23:44:07 +08:00
Deprecate unnecessary #includes from the batt_smbus driver.
This commit is contained in:
parent
d1e46737a3
commit
b10cb2a24e
@ -42,9 +42,6 @@
|
||||
*/
|
||||
|
||||
#include "batt_smbus.h"
|
||||
#include <px4_getopt.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
extern "C" __EXPORT int batt_smbus_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
@ -43,48 +43,49 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <ecl/geo/geo.h>
|
||||
#include <lib/drivers/smbus/SMBus.hpp>
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <px4_config.h>
|
||||
#include <px4_work_queue/ScheduledWorkItem.hpp>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <platforms/px4_module.h>
|
||||
#include <px4_getopt.h>
|
||||
#include <px4_work_queue/ScheduledWorkItem.hpp>
|
||||
#include <uORB/topics/battery_status.h>
|
||||
|
||||
#define DATA_BUFFER_SIZE 32
|
||||
#include "board_config.h"
|
||||
|
||||
#define BATT_CELL_VOLTAGE_THRESHOLD_RTL 0.5f ///< Threshold in volts to RTL if cells are imbalanced
|
||||
#define BATT_CELL_VOLTAGE_THRESHOLD_FAILED 1.5f ///< Threshold in volts to Land if cells are imbalanced
|
||||
#define DATA_BUFFER_SIZE 32
|
||||
|
||||
#define BATT_CURRENT_UNDERVOLTAGE_THRESHOLD 5.0f ///< Threshold in amps to disable undervoltage protection
|
||||
#define BATT_VOLTAGE_UNDERVOLTAGE_THRESHOLD 3.4f ///< Threshold in volts to re-enable undervoltage protection
|
||||
#define BATT_CELL_VOLTAGE_THRESHOLD_RTL 0.5f ///< Threshold in volts to RTL if cells are imbalanced
|
||||
#define BATT_CELL_VOLTAGE_THRESHOLD_FAILED 1.5f ///< Threshold in volts to Land if cells are imbalanced
|
||||
|
||||
#define BATT_SMBUS_CURRENT 0x0A ///< current register
|
||||
#define BATT_SMBUS_AVERAGE_CURRENT 0x0B ///< current register
|
||||
#define BATT_SMBUS_ADDR 0x0B ///< Default 7 bit address I2C address. 8 bit = 0x16
|
||||
#define BATT_SMBUS_ADDR_MIN 0x00 ///< lowest possible address
|
||||
#define BATT_SMBUS_ADDR_MAX 0xFF ///< highest possible address
|
||||
#define BATT_SMBUS_PEC_POLYNOMIAL 0x07 ///< Polynomial for calculating PEC
|
||||
#define BATT_SMBUS_TEMP 0x08 ///< temperature register
|
||||
#define BATT_SMBUS_VOLTAGE 0x09 ///< voltage register
|
||||
#define BATT_SMBUS_FULL_CHARGE_CAPACITY 0x10 ///< capacity when fully charged
|
||||
#define BATT_SMBUS_RUN_TIME_TO_EMPTY 0x11 ///< predicted remaining battery capacity based on the present rate of discharge in min
|
||||
#define BATT_SMBUS_AVERAGE_TIME_TO_EMPTY 0x12 ///< predicted remaining battery capacity based on the present rate of discharge in min
|
||||
#define BATT_SMBUS_REMAINING_CAPACITY 0x0F ///< predicted remaining battery capacity as a percentage
|
||||
#define BATT_SMBUS_CYCLE_COUNT 0x17 ///< number of cycles the battery has experienced
|
||||
#define BATT_SMBUS_DESIGN_CAPACITY 0x18 ///< design capacity register
|
||||
#define BATT_SMBUS_DESIGN_VOLTAGE 0x19 ///< design voltage register
|
||||
#define BATT_SMBUS_MANUFACTURER_NAME 0x20 ///< manufacturer name
|
||||
#define BATT_SMBUS_MANUFACTURE_DATE 0x1B ///< manufacture date register
|
||||
#define BATT_SMBUS_SERIAL_NUMBER 0x1C ///< serial number register
|
||||
#define BATT_SMBUS_MEASUREMENT_INTERVAL_US 100000 ///< time in microseconds, measure at 10Hz
|
||||
#define BATT_SMBUS_TIMEOUT_US 1000000 ///< timeout looking for battery 10seconds after startup
|
||||
#define BATT_CURRENT_UNDERVOLTAGE_THRESHOLD 5.0f ///< Threshold in amps to disable undervoltage protection
|
||||
#define BATT_VOLTAGE_UNDERVOLTAGE_THRESHOLD 3.4f ///< Threshold in volts to re-enable undervoltage protection
|
||||
|
||||
#define BATT_SMBUS_CURRENT 0x0A ///< current register
|
||||
#define BATT_SMBUS_AVERAGE_CURRENT 0x0B ///< current register
|
||||
#define BATT_SMBUS_ADDR 0x0B ///< Default 7 bit address I2C address. 8 bit = 0x16
|
||||
#define BATT_SMBUS_ADDR_MIN 0x00 ///< lowest possible address
|
||||
#define BATT_SMBUS_ADDR_MAX 0xFF ///< highest possible address
|
||||
#define BATT_SMBUS_PEC_POLYNOMIAL 0x07 ///< Polynomial for calculating PEC
|
||||
#define BATT_SMBUS_TEMP 0x08 ///< temperature register
|
||||
#define BATT_SMBUS_VOLTAGE 0x09 ///< voltage register
|
||||
#define BATT_SMBUS_FULL_CHARGE_CAPACITY 0x10 ///< capacity when fully charged
|
||||
#define BATT_SMBUS_RUN_TIME_TO_EMPTY 0x11 ///< predicted remaining battery capacity based on the present rate of discharge in min
|
||||
#define BATT_SMBUS_AVERAGE_TIME_TO_EMPTY 0x12 ///< predicted remaining battery capacity based on the present rate of discharge in min
|
||||
#define BATT_SMBUS_REMAINING_CAPACITY 0x0F ///< predicted remaining battery capacity as a percentage
|
||||
#define BATT_SMBUS_CYCLE_COUNT 0x17 ///< number of cycles the battery has experienced
|
||||
#define BATT_SMBUS_DESIGN_CAPACITY 0x18 ///< design capacity register
|
||||
#define BATT_SMBUS_DESIGN_VOLTAGE 0x19 ///< design voltage register
|
||||
#define BATT_SMBUS_MANUFACTURER_NAME 0x20 ///< manufacturer name
|
||||
#define BATT_SMBUS_MANUFACTURE_DATE 0x1B ///< manufacture date register
|
||||
#define BATT_SMBUS_SERIAL_NUMBER 0x1C ///< serial number register
|
||||
#define BATT_SMBUS_MEASUREMENT_INTERVAL_US 100000 ///< time in microseconds, measure at 10Hz
|
||||
#define BATT_SMBUS_TIMEOUT_US 1000000 ///< timeout looking for battery 10seconds after startup
|
||||
#define BATT_SMBUS_MANUFACTURER_ACCESS 0x00
|
||||
#define BATT_SMBUS_MANUFACTURER_DATA 0x23
|
||||
#define BATT_SMBUS_MANUFACTURER_DATA 0x23
|
||||
#define BATT_SMBUS_MANUFACTURER_BLOCK_ACCESS 0x44
|
||||
#define BATT_SMBUS_SECURITY_KEYS 0x0035
|
||||
#define BATT_SMBUS_SECURITY_KEYS 0x0035
|
||||
#define BATT_SMBUS_CELL_1_VOLTAGE 0x3F
|
||||
#define BATT_SMBUS_CELL_2_VOLTAGE 0x3E
|
||||
#define BATT_SMBUS_CELL_3_VOLTAGE 0x3D
|
||||
@ -94,8 +95,8 @@
|
||||
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_ADDRESS 0x4938
|
||||
#define BATT_SMBUS_SEAL 0x0030
|
||||
|
||||
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_DEFAULT 0xcf
|
||||
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_CUV_DISABLED 0xce
|
||||
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_DEFAULT 0xcf
|
||||
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_CUV_DISABLED 0xce
|
||||
|
||||
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user