Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
e3f8676c
Commit
e3f8676c
authored
Nov 18, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't let other function mapping lock out usage of those channels for cal
parent
8eab3f6e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
91 deletions
+11
-91
RadioComponentController.cc
src/AutoPilotPlugins/Common/RadioComponentController.cc
+2
-46
RadioComponentController.h
src/AutoPilotPlugins/Common/RadioComponentController.h
+0
-13
RadioConfigTest.cc
src/qgcunittest/RadioConfigTest.cc
+9
-31
RadioConfigTest.h
src/qgcunittest/RadioConfigTest.h
+0
-1
No files found.
src/AutoPilotPlugins/Common/RadioComponentController.cc
View file @
e3f8676c
...
...
@@ -58,29 +58,17 @@ const char* RadioComponentController::_settingsGroup = "RadioCalibration";
const
char
*
RadioComponentController
::
_settingsKeyTransmitterMode
=
"TransmitterMode"
;
const
struct
RadioComponentController
::
FunctionInfo
RadioComponentController
::
_rgFunctionInfoPX4
[
RadioComponentController
::
rcCalFunctionMax
]
=
{
//Parameter required
{
"RC_MAP_ROLL"
},
{
"RC_MAP_PITCH"
},
{
"RC_MAP_YAW"
},
{
"RC_MAP_THROTTLE"
},
{
"RC_MAP_MODE_SW"
},
{
"RC_MAP_POSCTL_SW"
},
{
"RC_MAP_LOITER_SW"
},
{
"RC_MAP_RETURN_SW"
},
{
"RC_MAP_ACRO_SW"
},
{
"RC_MAP_THROTTLE"
}
};
const
struct
RadioComponentController
::
FunctionInfo
RadioComponentController
::
_rgFunctionInfoAPM
[
RadioComponentController
::
rcCalFunctionMax
]
=
{
//Parameter required
{
"RCMAP_ROLL"
},
{
"RCMAP_PITCH"
},
{
"RCMAP_YAW"
},
{
"RCMAP_THROTTLE"
},
{
NULL
},
{
NULL
},
{
NULL
},
{
NULL
},
{
NULL
},
{
"RCMAP_THROTTLE"
}
};
RadioComponentController
::
RadioComponentController
(
void
)
:
...
...
@@ -572,38 +560,6 @@ void RadioComponentController::_resetInternalCalibrationValues(void)
_rgFunctionChannelMapping
[
i
]
=
_chanMax
();
}
if
(
_px4Vehicle
())
{
// Reserve the existing Flight Mode switch settings channels so we don't re-use them
static
const
rcCalFunctions
rgFlightModeFunctions
[]
=
{
rcCalFunctionModeSwitch
,
rcCalFunctionPosCtlSwitch
,
rcCalFunctionLoiterSwitch
,
rcCalFunctionReturnSwitch
};
static
const
size_t
crgFlightModeFunctions
=
sizeof
(
rgFlightModeFunctions
)
/
sizeof
(
rgFlightModeFunctions
[
0
]);
for
(
size_t
i
=
0
;
i
<
crgFlightModeFunctions
;
i
++
)
{
QVariant
value
;
enum
rcCalFunctions
curFunction
=
rgFlightModeFunctions
[
i
];
Fact
*
paramFact
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
_functionInfo
()[
curFunction
].
parameterName
);
if
(
paramFact
)
{
bool
ok
;
int
switchChannel
=
paramFact
->
rawValue
().
toInt
(
&
ok
);
Q_ASSERT
(
ok
);
// Parameter: 1-based channel, 0=not mapped
// _rgFunctionChannelMapping: 0-based channel, _chanMax=not mapped
if
(
switchChannel
!=
0
)
{
qCDebug
(
RadioComponentControllerLog
)
<<
"Reserving 0-based switch channel"
<<
switchChannel
-
1
;
_rgFunctionChannelMapping
[
curFunction
]
=
switchChannel
-
1
;
_rgChannelInfo
[
switchChannel
-
1
].
function
=
curFunction
;
}
}
}
}
_signalAllAttiudeValueChanges
();
}
...
...
src/AutoPilotPlugins/Common/RadioComponentController.h
View file @
e3f8676c
...
...
@@ -149,20 +149,7 @@ private:
rcCalFunctionPitch
,
rcCalFunctionYaw
,
rcCalFunctionThrottle
,
rcCalFunctionModeSwitch
,
rcCalFunctionPosCtlSwitch
,
rcCalFunctionLoiterSwitch
,
rcCalFunctionReturnSwitch
,
rcCalFunctionAcroSwitch
,
rcCalFunctionMax
,
// Attitude functions are roll/pitch/yaw/throttle
rcCalFunctionFirstAttitudeFunction
=
rcCalFunctionRoll
,
rcCalFunctionLastAttitudeFunction
=
rcCalFunctionThrottle
,
// Non-Attitude functions are everything else
rcCalFunctionFirstNonAttitudeFunction
=
rcCalFunctionModeSwitch
,
rcCalFunctionLastNonAttitudeFunction
=
rcCalFunctionAcroSwitch
,
};
/// @brief The states of the calibration state machine.
...
...
src/qgcunittest/RadioConfigTest.cc
View file @
e3f8676c
...
...
@@ -332,28 +332,6 @@ void RadioConfigTest::_switchMinMaxStep(void)
QCOMPARE
(
_controller
->
_currentStep
,
saveStep
+
1
);
}
void
RadioConfigTest
::
_switchSelectAutoStep
(
const
char
*
functionStr
,
RadioComponentController
::
rcCalFunctions
function
)
{
Q_UNUSED
(
functionStr
);
////qCDebug(RadioConfigTestLog)() << "_switchSelectAutoStep" << functionStr << "function:" << function;
int
buttonMask
=
cancelButtonMask
;
if
(
function
!=
RadioComponentController
::
rcCalFunctionModeSwitch
)
{
buttonMask
|=
skipButtonMask
;
}
CHK_BUTTONS
(
buttonMask
);
int
saveStep
=
_controller
->
_currentStep
;
// Wiggle stick for channel
int
channel
=
_rgFunctionChannelMap
[
function
];
_mockLink
->
emitRemoteControlChannelRawChanged
(
channel
,
_testMinValue
);
_mockLink
->
emitRemoteControlChannelRawChanged
(
channel
,
_testMaxValue
);
QCOMPARE
(
_controller
->
_currentStep
,
saveStep
+
1
);
}
void
RadioConfigTest
::
_fullCalibrationWorker
(
MAV_AUTOPILOT
firmwareType
)
{
_init
(
firmwareType
);
...
...
@@ -409,15 +387,15 @@ void RadioConfigTest::_fullCalibrationWorker(MAV_AUTOPILOT firmwareType)
_channelHomePosition
();
_controller
->
nextButtonClicked
();
_beginCalibration
();
_stickMoveAutoStep
(
"Throttle"
,
RadioComponentController
::
rcCalFunctionThrottle
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Throttle"
,
RadioComponentController
::
rcCalFunctionThrottle
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Yaw"
,
RadioComponentController
::
rcCalFunctionYaw
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Yaw"
,
RadioComponentController
::
rcCalFunctionYaw
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Roll"
,
RadioComponentController
::
rcCalFunctionRoll
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Roll"
,
RadioComponentController
::
rcCalFunctionRoll
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToCenter
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Throttle"
,
RadioComponentController
::
rcCalFunctionThrottle
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Throttle"
,
RadioComponentController
::
rcCalFunctionThrottle
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Yaw"
,
RadioComponentController
::
rcCalFunctionYaw
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Yaw"
,
RadioComponentController
::
rcCalFunctionYaw
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Roll"
,
RadioComponentController
::
rcCalFunctionRoll
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Roll"
,
RadioComponentController
::
rcCalFunctionRoll
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToMax
,
true
/* identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToCenter
,
false
/* not identify step */
);
_switchMinMaxStep
();
// One more click and the parameters should get saved
...
...
src/qgcunittest/RadioConfigTest.h
View file @
e3f8676c
...
...
@@ -76,7 +76,6 @@ private:
void
_stickMoveWaitForSettle
(
int
channel
,
int
value
);
void
_stickMoveAutoStep
(
const
char
*
functionStr
,
enum
RadioComponentController
::
rcCalFunctions
function
,
enum
MoveToDirection
direction
,
bool
identifyStep
);
void
_switchMinMaxStep
(
void
);
void
_switchSelectAutoStep
(
const
char
*
functionStr
,
RadioComponentController
::
rcCalFunctions
function
);
bool
_px4Vehicle
(
void
)
const
;
const
struct
RadioComponentController
::
FunctionInfo
*
_functionInfo
(
void
)
const
;
const
struct
ChannelSettings
*
_channelSettings
(
void
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment