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
aefd1860
Commit
aefd1860
authored
Mar 07, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Flaps/Aux to Radio Cal screen combos
parent
76975530
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
173 deletions
+30
-173
RadioComponent.qml
src/AutoPilotPlugins/Common/RadioComponent.qml
+21
-0
RadioComponentController.cc
src/AutoPilotPlugins/Common/RadioComponentController.cc
+0
-118
RadioComponentController.h
src/AutoPilotPlugins/Common/RadioComponentController.h
+1
-9
RadioConfigTest.cc
src/qgcunittest/RadioConfigTest.cc
+8
-45
RadioConfigTest.h
src/qgcunittest/RadioConfigTest.h
+0
-1
No files found.
src/AutoPilotPlugins/Common/RadioComponent.qml
View file @
aefd1860
...
...
@@ -471,6 +471,27 @@ QGCView {
onClicked
:
showDialog
(
copyTrimsDialogComponent
,
dialogTitle
,
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Ok
|
StandardButton
.
Cancel
)
}
Repeater
{
model
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
px4Firmware
?
[
"
RC_MAP_FLAPS
"
,
"
RC_MAP_AUX1
"
,
"
RC_MAP_AUX2
"
,
"
RC_MAP_AUX3
"
]
:
0
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
modelData
)
QGCLabel
{
anchors.baseline
:
optCombo
.
baseline
text
:
fact
.
shortDescription
+
"
:
"
}
FactComboBox
{
id
:
optCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
fact
:
parent
.
fact
indexModel
:
false
}
}
}
// Repeater
}
// Column - Left Column
Item
{
...
...
src/AutoPilotPlugins/Common/RadioComponentController.cc
View file @
aefd1860
...
...
@@ -81,9 +81,6 @@ const struct RadioComponentController::FunctionInfo RadioComponentController::_r
{
"RC_MAP_LOITER_SW"
},
{
"RC_MAP_RETURN_SW"
},
{
"RC_MAP_ACRO_SW"
},
{
"RC_MAP_FLAPS"
},
{
"RC_MAP_AUX1"
},
{
"RC_MAP_AUX2"
},
};
const
struct
RadioComponentController
::
FunctionInfo
RadioComponentController
::
_rgFunctionInfoAPM
[
RadioComponentController
::
rcCalFunctionMax
]
=
{
...
...
@@ -97,9 +94,6 @@ const struct RadioComponentController::FunctionInfo RadioComponentController::_r
{
NULL
},
{
NULL
},
{
NULL
},
{
NULL
},
{
NULL
},
{
NULL
},
};
RadioComponentController
::
RadioComponentController
(
void
)
:
...
...
@@ -157,16 +151,7 @@ const RadioComponentController::stateMachineEntry* RadioComponentController::_ge
static
const
char
*
msgPitchDown
=
"Move the Pitch stick all the way down and hold it there..."
;
static
const
char
*
msgPitchUp
=
"Move the Pitch stick all the way up and hold it there..."
;
static
const
char
*
msgPitchCenter
=
"Allow the Pitch stick to move back to center..."
;
static
const
char
*
msgAux1Switch
=
"Move the switch or dial you want to use for Aux1.
\n\n
"
"You can click Skip if you don't want to assign."
;
static
const
char
*
msgAux2Switch
=
"Move the switch or dial you want to use for Aux2.
\n\n
"
"You can click Skip if you don't want to assign."
;
static
const
char
*
msgSwitchMinMax
=
"Move all the transmitter switches and/or dials back and forth to their extreme positions."
;
static
const
char
*
msgFlapsDetect
=
"Move the switch or dial you want to use for Flaps back and forth a few times. "
"Then leave the switch/dial at the position you want to use for Flaps fully extended.
\n\n
"
"Click Next to continue.
\n
"
"If you won't be using Flaps, click Skip."
;
static
const
char
*
msgFlapsUp
=
"Move the switch or dial you want to use for Flaps to the position you want to use for Flaps fully retracted."
;
static
const
char
*
msgComplete
=
"All settings have been captured. Click Next to write the new parameters to your board."
;
static
const
stateMachineEntry
rgStateMachinePX4
[]
=
{
...
...
@@ -182,10 +167,6 @@ const RadioComponentController::stateMachineEntry* RadioComponentController::_ge
{
rcCalFunctionPitch
,
msgPitchDown
,
_imagePitchDown
,
&
RadioComponentController
::
_inputStickMin
,
NULL
,
NULL
},
{
rcCalFunctionPitch
,
msgPitchCenter
,
_imageHome
,
&
RadioComponentController
::
_inputCenterWait
,
NULL
,
NULL
},
{
rcCalFunctionMax
,
msgSwitchMinMax
,
_imageSwitchMinMax
,
&
RadioComponentController
::
_inputSwitchMinMax
,
&
RadioComponentController
::
_advanceState
,
NULL
},
{
rcCalFunctionFlaps
,
msgFlapsDetect
,
_imageThrottleDown
,
&
RadioComponentController
::
_inputFlapsDetect
,
&
RadioComponentController
::
_saveFlapsDown
,
&
RadioComponentController
::
_skipFlaps
},
{
rcCalFunctionFlaps
,
msgFlapsUp
,
_imageThrottleDown
,
&
RadioComponentController
::
_inputFlapsUp
,
NULL
,
NULL
},
{
rcCalFunctionAux1
,
msgAux1Switch
,
_imageThrottleDown
,
&
RadioComponentController
::
_inputSwitchDetect
,
NULL
,
&
RadioComponentController
::
_advanceState
},
{
rcCalFunctionAux2
,
msgAux2Switch
,
_imageThrottleDown
,
&
RadioComponentController
::
_inputSwitchDetect
,
NULL
,
&
RadioComponentController
::
_advanceState
},
{
rcCalFunctionMax
,
msgComplete
,
_imageThrottleDown
,
NULL
,
&
RadioComponentController
::
_writeCalibration
,
NULL
},
};
...
...
@@ -547,100 +528,6 @@ void RadioComponentController::_inputSwitchMinMax(enum rcCalFunctions function,
}
}
void
RadioComponentController
::
_skipFlaps
(
void
)
{
// Flaps channel may have been identified. Clear it out.
for
(
int
i
=
0
;
i
<
_chanCount
;
i
++
)
{
if
(
_rgChannelInfo
[
i
].
function
==
RadioComponentController
::
rcCalFunctionFlaps
)
{
_rgChannelInfo
[
i
].
function
=
rcCalFunctionMax
;
}
}
_rgFunctionChannelMapping
[
RadioComponentController
::
rcCalFunctionFlaps
]
=
_chanMax
();
// Skip over flap steps
_currentStep
+=
2
;
_setupCurrentState
();
}
void
RadioComponentController
::
_saveFlapsDown
(
void
)
{
int
channel
=
_rgFunctionChannelMapping
[
rcCalFunctionFlaps
];
if
(
channel
==
_chanMax
())
{
// Channel not yet mapped, still waiting for switch to move
if
(
_unitTestMode
)
{
emit
nextButtonMessageBoxDisplayed
();
}
else
{
qgcApp
()
->
showMessage
(
"Flaps switch has not yet been detected."
);
}
return
;
}
Q_ASSERT
(
channel
!=
-
1
);
ChannelInfo
*
info
=
&
_rgChannelInfo
[
channel
];
int
rcValue
=
_rcRawValue
[
channel
];
// Switch detection is complete. Switch should be at flaps fully extended position.
// Channel should be at max value, if it is below initial set point the channel is reversed.
info
->
reversed
=
rcValue
<
_rcValueSave
[
channel
];
if
(
info
->
reversed
)
{
_rgChannelInfo
[
channel
].
rcMin
=
rcValue
;
}
else
{
_rgChannelInfo
[
channel
].
rcMax
=
rcValue
;
}
_advanceState
();
}
void
RadioComponentController
::
_inputFlapsUp
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
)
{
Q_UNUSED
(
function
);
// FIXME: Duplication
Q_ASSERT
(
function
==
rcCalFunctionFlaps
);
// We only care about the channel mapped to flaps
if
(
_rgFunctionChannelMapping
[
rcCalFunctionFlaps
]
!=
channel
)
{
return
;
}
if
(
_stickDetectChannel
==
_chanMax
())
{
// Setup up to detect stick being pegged to extreme position
if
(
_rgChannelInfo
[
channel
].
reversed
)
{
if
(
value
>
_rcCalPWMCenterPoint
+
_rcCalMoveDelta
)
{
_stickDetectChannel
=
channel
;
_stickDetectInitialValue
=
value
;
_stickDetectValue
=
value
;
}
}
else
{
if
(
value
<
_rcCalPWMCenterPoint
-
_rcCalMoveDelta
)
{
_stickDetectChannel
=
channel
;
_stickDetectInitialValue
=
value
;
_stickDetectValue
=
value
;
}
}
}
else
{
// We are waiting for the selected channel to settle out
if
(
_stickSettleComplete
(
value
))
{
ChannelInfo
*
info
=
&
_rgChannelInfo
[
channel
];
// Stick detection is complete. Stick should be at min position.
if
(
info
->
reversed
)
{
_rgChannelInfo
[
channel
].
rcMax
=
value
;
}
else
{
_rgChannelInfo
[
channel
].
rcMin
=
value
;
}
_advanceState
();
}
}
}
void
RadioComponentController
::
_switchDetect
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
,
bool
moveToNextStep
)
{
// If this channel is already used in a mapping we can't use it again
...
...
@@ -671,11 +558,6 @@ void RadioComponentController::_inputSwitchDetect(enum rcCalFunctions function,
_switchDetect
(
function
,
channel
,
value
,
true
/* move to next step after detection */
);
}
void
RadioComponentController
::
_inputFlapsDetect
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
)
{
_switchDetect
(
function
,
channel
,
value
,
false
/* do not move to next step after detection */
);
}
/// @brief Resets internal calibration values to their initial state in preparation for a new calibration sequence.
void
RadioComponentController
::
_resetInternalCalibrationValues
(
void
)
{
...
...
src/AutoPilotPlugins/Common/RadioComponentController.h
View file @
aefd1860
...
...
@@ -159,9 +159,6 @@ private:
rcCalFunctionLoiterSwitch
,
rcCalFunctionReturnSwitch
,
rcCalFunctionAcroSwitch
,
rcCalFunctionFlaps
,
rcCalFunctionAux1
,
rcCalFunctionAux2
,
rcCalFunctionMax
,
// Attitude functions are roll/pitch/yaw/throttle
...
...
@@ -170,7 +167,7 @@ private:
// Non-Attitude functions are everything else
rcCalFunctionFirstNonAttitudeFunction
=
rcCalFunctionModeSwitch
,
rcCalFunctionLastNonAttitudeFunction
=
rcCalFunctionA
ux2
,
rcCalFunctionLastNonAttitudeFunction
=
rcCalFunctionA
croSwitch
,
};
/// @brief The states of the calibration state machine.
...
...
@@ -224,15 +221,10 @@ private:
void
_inputStickMin
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_inputCenterWait
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_inputSwitchMinMax
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_inputFlapsDown
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_inputFlapsUp
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_inputSwitchDetect
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_inputFlapsDetect
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
);
void
_switchDetect
(
enum
rcCalFunctions
function
,
int
channel
,
int
value
,
bool
moveToNextStep
);
void
_saveFlapsDown
(
void
);
void
_skipFlaps
(
void
);
void
_saveAllTrims
(
void
);
bool
_stickSettleComplete
(
int
value
);
...
...
src/qgcunittest/RadioConfigTest.cc
View file @
aefd1860
...
...
@@ -79,17 +79,15 @@ const struct RadioConfigTest::ChannelSettings RadioConfigTest::_rgChannelSetting
{
RadioComponentController
::
rcCalFunctionYaw
,
_testMinValue
,
_testMaxValue
,
0
,
true
},
{
RadioComponentController
::
rcCalFunctionThrottle
,
_testMinValue
,
_testMaxValue
,
0
,
false
},
// Channels 5-
8
: Not mapped to function, Simulate invalid Min/Max, since available channel Min/Max is still shown.
// Channels 5-
11
: Not mapped to function, Simulate invalid Min/Max, since available channel Min/Max is still shown.
// These are here to skip over the flight mode functions
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
// Channels 9-11: Remainder of non-flight mode switches
{
RadioComponentController
::
rcCalFunctionFlaps
,
_testMinValue
,
_testMaxValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionAux1
,
_testMinValue
,
_testMaxValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionAux2
,
_testMinValue
,
_testMaxValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testCenterValue
,
0
,
false
},
// Channel 12 : Not mapped to function, Simulate invalid Min, valid Max
{
RadioComponentController
::
rcCalFunctionMax
,
_testCenterValue
,
_testMaxValue
,
0
,
false
},
...
...
@@ -118,16 +116,14 @@ const struct RadioConfigTest::ChannelSettings RadioConfigTest::_rgChannelSetting
{
RadioComponentController
::
rcCalFunctionYaw
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
true
},
{
RadioComponentController
::
rcCalFunctionThrottle
,
_testMinValue
,
_testMaxValue
,
_testMinValue
,
false
},
// Channels 5-8: not mapped and should be set to defaults
// Channels 5-11: not mapped and should be set to defaults
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
// Channels 9-11: Remainder of non-flight mode switches
{
RadioComponentController
::
rcCalFunctionFlaps
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
RadioComponentController
::
rcCalFunctionAux1
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
RadioComponentController
::
rcCalFunctionAux2
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
// Channels 12-17 are not mapped and should be set to defaults
{
RadioComponentController
::
rcCalFunctionMax
,
RadioComponentController
::
_rcCalPWMDefaultMinValue
,
RadioComponentController
::
_rcCalPWMDefaultMaxValue
,
1500
/*RadioComponentController::_rcCalPWMCenterPoint*/
,
false
},
...
...
@@ -335,33 +331,6 @@ void RadioConfigTest::_switchMinMaxStep(void)
QCOMPARE
(
_controller
->
_currentStep
,
saveStep
+
1
);
}
void
RadioConfigTest
::
_flapsDetectStep
(
void
)
{
int
channel
=
_rgFunctionChannelMap
[
RadioComponentController
::
rcCalFunctionFlaps
];
qCDebug
(
RadioConfigTestLog
)
<<
"_flapsDetectStep channel"
<<
channel
;
// Test code can't handle reversed flaps channel
Q_ASSERT
(
!
_channelSettings
()[
channel
].
reversed
);
CHK_BUTTONS
(
nextButtonMask
|
cancelButtonMask
|
skipButtonMask
);
int
saveStep
=
_controller
->
_currentStep
;
// Wiggle channel to identify
_stickMoveWaitForSettle
(
channel
,
_testMaxValue
);
_stickMoveWaitForSettle
(
channel
,
_testMinValue
);
// Leave channel on full flaps down
_stickMoveWaitForSettle
(
channel
,
_testMaxValue
);
// User has to hit next at this step
QCOMPARE
(
_controller
->
_currentStep
,
saveStep
);
CHK_BUTTONS
(
nextButtonMask
|
cancelButtonMask
|
skipButtonMask
);
_controller
->
nextButtonClicked
();
QCOMPARE
(
_controller
->
_currentStep
,
saveStep
+
1
);
}
void
RadioConfigTest
::
_switchSelectAutoStep
(
const
char
*
functionStr
,
RadioComponentController
::
rcCalFunctions
function
)
{
Q_UNUSED
(
functionStr
);
...
...
@@ -449,12 +418,6 @@ void RadioConfigTest::_fullCalibrationWorker(MAV_AUTOPILOT firmwareType)
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToMin
,
false
/* not identify step */
);
_stickMoveAutoStep
(
"Pitch"
,
RadioComponentController
::
rcCalFunctionPitch
,
moveToCenter
,
false
/* not identify step */
);
_switchMinMaxStep
();
if
(
firmwareType
==
MAV_AUTOPILOT_PX4
)
{
_flapsDetectStep
();
_stickMoveAutoStep
(
"Flaps"
,
RadioComponentController
::
rcCalFunctionFlaps
,
moveToMin
,
false
/* not identify step */
);
_switchSelectAutoStep
(
"Aux1"
,
RadioComponentController
::
rcCalFunctionAux1
);
_switchSelectAutoStep
(
"Aux2"
,
RadioComponentController
::
rcCalFunctionAux2
);
}
// One more click and the parameters should get saved
_controller
->
nextButtonClicked
();
...
...
src/qgcunittest/RadioConfigTest.h
View file @
aefd1860
...
...
@@ -89,7 +89,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
_flapsDetectStep
(
void
);
void
_switchSelectAutoStep
(
const
char
*
functionStr
,
RadioComponentController
::
rcCalFunctions
function
);
bool
_px4Vehicle
(
void
)
const
;
const
struct
RadioComponentController
::
FunctionInfo
*
_functionInfo
(
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