Skip to content

Commit

Permalink
resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Astik-2002 committed Feb 20, 2024
1 parent b75a2a9 commit c65fe18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
15 changes: 7 additions & 8 deletions libraries/AC_CustomControl/AC_CustomControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#if AP_CUSTOMCONTROL_ENABLED


#include "AC_CustomControl_Backend.h"
// #include "AC_CustomControl_Empty.h"
#include "AC_CustomControl_PID.h"
Expand Down Expand Up @@ -123,30 +122,30 @@ void AC_CustomControl::set_custom_controller(bool enabled)

// don't allow accidental main controller reset without active custom controller
if (_controller_type == CustomControlType::CONT_NONE) {
gcs().send_text(MAV_SEVERITY_INFO, "Custom controller is not enabled");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Custom controller is not enabled");
return;
}

// controller type is out of range
if (_controller_type > CUSTOMCONTROL_MAX_TYPES) {
gcs().send_text(MAV_SEVERITY_INFO, "Custom controller type is out of range");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Custom controller type is out of range");
return;
}

// backend is not created
if (_backend == nullptr) {
gcs().send_text(MAV_SEVERITY_INFO, "Reboot to enable selected custom controller");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Reboot to enable selected custom controller");
return;
}

if (_custom_controller_mask == 0 && enabled) {
gcs().send_text(MAV_SEVERITY_INFO, "Axis mask is not set");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Axis mask is not set");
return;
}

// reset main controller
if (!enabled) {
gcs().send_text(MAV_SEVERITY_INFO, "Custom controller is OFF");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Custom controller is OFF");
// don't reset if the empty backend is selected
if (_controller_type > CustomControlType::CONT_EMPTY) {
reset_main_att_controller();
Expand All @@ -156,7 +155,7 @@ void AC_CustomControl::set_custom_controller(bool enabled)
if (enabled && _controller_type > CustomControlType::CONT_NONE) {
// reset custom controller filter, integrator etc.
_backend->reset();
gcs().send_text(MAV_SEVERITY_INFO, "Custom controller is ON");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Custom controller is ON");
}

_custom_controller_active = enabled;
Expand Down Expand Up @@ -193,4 +192,4 @@ void AC_CustomControl::set_notch_sample_rate(float sample_rate)
#endif
}

#endif
#endif // AP_CUSTOMCONTROL_ENABLED
8 changes: 5 additions & 3 deletions libraries/AC_CustomControl/AC_CustomControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
/// @file AC_CustomControl.h
/// @brief ArduCopter custom control library

#include "AC_CustomControl_config.h"

#if AP_CUSTOMCONTROL_ENABLED

#include <AP_Common/AP_Common.h>
#include <AP_Param/AP_Param.h>
#include <AP_AHRS/AP_AHRS_View.h>
#include <AC_AttitudeControl/AC_AttitudeControl.h>
#include <AP_Motors/AP_MotorsMulticopter.h>
#include <AP_Logger/AP_Logger.h>

#if AP_CUSTOMCONTROL_ENABLED

#ifndef CUSTOMCONTROL_MAX_TYPES
#define CUSTOMCONTROL_MAX_TYPES 2
#endif
Expand Down Expand Up @@ -72,4 +74,4 @@ class AC_CustomControl {
AC_CustomControl_Backend *_backend;
};

#endif
#endif // AP_CUSTOMCONTROL_ENABLED
6 changes: 4 additions & 2 deletions libraries/AC_CustomControl/AC_CustomControl_Backend.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#pragma once

#include "AC_CustomControl.h"
#include "AC_CustomControl_config.h"

#if AP_CUSTOMCONTROL_ENABLED

#include "AC_CustomControl.h"

class AC_CustomControl_Backend
{
public:
Expand Down Expand Up @@ -34,4 +36,4 @@ class AC_CustomControl_Backend
AC_CustomControl& _frontend;
};

#endif
#endif // AP_CUSTOMCONTROL_ENABLED

0 comments on commit c65fe18

Please sign in to comment.