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_Torqeedo: add support for two motors #26494

Merged
merged 3 commits into from
May 8, 2024
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
11 changes: 9 additions & 2 deletions Rover/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,9 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
AP_GROUPINFO("FS_OPTIONS", 48, ParametersG2, fs_options, 0),

#if HAL_TORQEEDO_ENABLED
// @Group: TRQD_
// @Group: TRQ
// @Path: ../libraries/AP_Torqeedo/AP_Torqeedo.cpp
AP_SUBGROUPINFO(torqeedo, "TRQD_", 49, ParametersG2, AP_Torqeedo),
AP_SUBGROUPINFO(torqeedo, "TRQ", 49, ParametersG2, AP_Torqeedo),
#endif

// @Group: PSC
Expand Down Expand Up @@ -808,6 +808,13 @@ const AP_Param::ConversionInfo conversion_table[] = {
{ Parameters::k_param_g2, 722, AP_PARAM_INT8, "PRX1_IGN_WID4" },
{ Parameters::k_param_g2, 1234, AP_PARAM_FLOAT, "PRX1_MIN" },
{ Parameters::k_param_g2, 1298, AP_PARAM_FLOAT, "PRX1_MAX" },
{ Parameters::k_param_g2, 113, AP_PARAM_INT8, "TRQ1_TYPE" },
{ Parameters::k_param_g2, 177, AP_PARAM_INT8, "TRQ1_ONOFF_PIN" },
{ Parameters::k_param_g2, 241, AP_PARAM_INT8, "TRQ1_DE_PIN" },
{ Parameters::k_param_g2, 305, AP_PARAM_INT16, "TRQ1_OPTIONS" },
{ Parameters::k_param_g2, 369, AP_PARAM_INT8, "TRQ1_POWER" },
{ Parameters::k_param_g2, 433, AP_PARAM_FLOAT, "TRQ1_SLEW_TIME" },
{ Parameters::k_param_g2, 497, AP_PARAM_FLOAT, "TRQ1_DIR_DELAY" },
};


Expand Down
6 changes: 4 additions & 2 deletions libraries/AP_BattMonitor/AP_BattMonitor_Torqeedo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ void AP_BattMonitor_Torqeedo::read(void)
}

// get voltage, current, temp and remaining capacity percentage
// assumes battery monitor instance matches torqeedo instance
float volts;
float current_amps;
float temp_C;
if (torqeedo->get_batt_info(volts, current_amps, temp_C, remaining_pct)) {
if (torqeedo->get_batt_info(_state.instance, volts, current_amps, temp_C, remaining_pct)) {
have_info = true;
_state.voltage = volts;
_state.current_amps = current_amps;
Expand All @@ -56,9 +57,10 @@ void AP_BattMonitor_Torqeedo::read(void)
}

// read battery pack capacity
// assumes battery monitor instance matches torqeedo instance
if (!have_capacity) {
uint16_t batt_capacity_ah;
if (torqeedo->get_batt_capacity_Ah(batt_capacity_ah)) {
if (torqeedo->get_batt_capacity_Ah(_state.instance, batt_capacity_ah)) {
have_capacity = true;
if (batt_capacity_ah * 1000 != _params._pack_capacity) {
_params._pack_capacity.set_and_notify(batt_capacity_ah * 1000);
Expand Down
Loading
Loading