Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_BattMonitor_Analog: add default BATT settings for Navigator, allow per-board setup of CURR_AMP_OFFSET #18442

Merged
merged 3 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/AP_BattMonitor/AP_BattMonitor_Analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const AP_Param::GroupInfo AP_BattMonitor_Analog::var_info[] = {
// @Description: Voltage offset at zero current on current sensor
// @Units: V
// @User: Standard
AP_GROUPINFO("AMP_OFFSET", 5, AP_BattMonitor_Analog, _curr_amp_offset, 0),
AP_GROUPINFO("AMP_OFFSET", 5, AP_BattMonitor_Analog, _curr_amp_offset, AP_BATT_CURR_AMP_OFFSET_DEFAULT),

AP_GROUPEND
};
Expand Down
12 changes: 12 additions & 0 deletions libraries/AP_BattMonitor/AP_BattMonitor_Analog.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
# define AP_BATT_VOLTDIVIDER_DEFAULT 11.3f
# define AP_BATT_CURR_AMP_PERVOLT_DEFAULT 17.0f

#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && (CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIGATOR)
# define AP_BATT_VOLT_PIN 5
# define AP_BATT_CURR_PIN 4
# define AP_BATT_VOLTDIVIDER_DEFAULT 11.0f
# define AP_BATT_CURR_AMP_PERVOLT_DEFAULT 37.8788f
# define AP_BATT_CURR_AMP_OFFSET_DEFAULT 0.330f

#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && (CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_EDGE)
# define AP_BATT_VOLT_PIN 3
# define AP_BATT_CURR_PIN 2
Expand All @@ -69,6 +76,11 @@
# define AP_BATT_CURR_AMP_PERVOLT_DEFAULT 17.0f
#endif

// This is 0 for the majority of the power modules.
#ifndef AP_BATT_CURR_AMP_OFFSET_DEFAULT
#define AP_BATT_CURR_AMP_OFFSET_DEFAULT 0.0f
#endif

// Other values normally set directly by mission planner
// # define AP_BATT_VOLTDIVIDER_DEFAULT 15.70 // Volt divider for AttoPilot 50V/90A sensor
// # define AP_BATT_VOLTDIVIDER_DEFAULT 4.127 // Volt divider for AttoPilot 13.6V/45A sensor
Expand Down
4 changes: 0 additions & 4 deletions libraries/AP_HAL/board/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@
#define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "icm20602", ROTATION_ROLL_180_YAW_270)
#define HAL_MAG_PROBE_LIST PROBE_MAG_I2C(MMC5XX3, 1, 0x30, false, ROTATION_YAW_90)
#define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(BMP280, 4, 0x76)
#define HAL_BATT_CURR_PIN 4
#define HAL_BATT_CURR_SCALE 1
#define HAL_BATT_VOLT_PIN 5
#define HAL_BATT_VOLT_SCALE 1
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BLUE
#define HAL_GPIO_A_LED_PIN 66
#define HAL_GPIO_B_LED_PIN 67
Expand Down