@ -78,10 +78,10 @@ void FlightModesComponentController::_init(void)
@@ -78,10 +78,10 @@ void FlightModesComponentController::_init(void)
QVariant value ;
_rgRCMin [ channel ] = getParameterFact ( FactSystem : : defaultComponentId , rcMinParam ) - > v alue( ) . toInt ( ) ;
_rgRCMax [ channel ] = getParameterFact ( FactSystem : : defaultComponentId , rcMaxParam ) - > v alue( ) . toInt ( ) ;
_rgRCMin [ channel ] = getParameterFact ( FactSystem : : defaultComponentId , rcMinParam ) - > rawV alue( ) . toInt ( ) ;
_rgRCMax [ channel ] = getParameterFact ( FactSystem : : defaultComponentId , rcMaxParam ) - > rawV alue( ) . toInt ( ) ;
float floatReversed = getParameterFact ( - 1 , rcRevParam ) - > v alue( ) . toFloat ( ) ;
float floatReversed = getParameterFact ( - 1 , rcRevParam ) - > rawV alue( ) . toFloat ( ) ;
_rgRCReversed [ channel ] = floatReversed = = - 1.0f ;
_rcValues [ channel ] = 0.0 ;
@ -89,7 +89,7 @@ void FlightModesComponentController::_init(void)
@@ -89,7 +89,7 @@ void FlightModesComponentController::_init(void)
// RC_CHAN_CNT parameter is set by Radio Cal to specify the number of radio channels.
if ( parameterExists ( FactSystem : : defaultComponentId , " RC_CHAN_CNT " ) ) {
_channelCount = getParameterFact ( FactSystem : : defaultComponentId , " RC_CHAN_CNT " ) - > v alue( ) . toInt ( ) ;
_channelCount = getParameterFact ( FactSystem : : defaultComponentId , " RC_CHAN_CNT " ) - > rawV alue( ) . toInt ( ) ;
} else {
_channelCount = _chanMax ;
}
@ -98,9 +98,9 @@ void FlightModesComponentController::_init(void)
@@ -98,9 +98,9 @@ void FlightModesComponentController::_init(void)
_channelCount = _chanMax ;
}
int modeChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > v alue( ) . toInt ( ) ;
int posCtlChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > v alue( ) . toInt ( ) ;
int loiterChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > v alue( ) . toInt ( ) ;
int modeChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > rawV alue( ) . toInt ( ) ;
int posCtlChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > rawV alue( ) . toInt ( ) ;
int loiterChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > rawV alue( ) . toInt ( ) ;
if ( posCtlChannel = = 0 ) {
// PosCtl disabled so AltCtl must move back to main Mode switch
@ -125,7 +125,7 @@ void FlightModesComponentController::_init(void)
@@ -125,7 +125,7 @@ void FlightModesComponentController::_init(void)
attitudeParams < < " RC_MAP_THROTTLE " < < " RC_MAP_YAW " < < " RC_MAP_PITCH " < < " RC_MAP_ROLL " < < " RC_MAP_FLAPS " < < " RC_MAP_AUX1 " < < " RC_MAP_AUX2 " ;
foreach ( QString attitudeParam , attitudeParams ) {
int channel = getParameterFact ( - 1 , attitudeParam ) - > v alue( ) . toInt ( ) ;
int channel = getParameterFact ( - 1 , attitudeParam ) - > rawV alue( ) . toInt ( ) ;
if ( channel ! = 0 ) {
usedChannels < < channel ;
}
@ -168,7 +168,7 @@ void FlightModesComponentController::_validateConfiguration(void)
@@ -168,7 +168,7 @@ void FlightModesComponentController::_validateConfiguration(void)
switchParams < < " RC_MAP_MODE_SW " < < " RC_MAP_ACRO_SW " < < " RC_MAP_POSCTL_SW " < < " RC_MAP_LOITER_SW " < < " RC_MAP_RETURN_SW " < < " RC_MAP_OFFB_SW " ;
for ( int i = 0 ; i < switchParams . count ( ) ; i + + ) {
int map = getParameterFact ( FactSystem : : defaultComponentId , switchParams [ i ] ) - > v alue( ) . toInt ( ) ;
int map = getParameterFact ( FactSystem : : defaultComponentId , switchParams [ i ] ) - > rawV alue( ) . toInt ( ) ;
switchMappings < < map ;
if ( map < 0 | | map > _channelCount ) {
@ -184,7 +184,7 @@ void FlightModesComponentController::_validateConfiguration(void)
@@ -184,7 +184,7 @@ void FlightModesComponentController::_validateConfiguration(void)
attitudeParams < < " RC_MAP_THROTTLE " < < " RC_MAP_YAW " < < " RC_MAP_PITCH " < < " RC_MAP_ROLL " < < " RC_MAP_FLAPS " < < " RC_MAP_AUX1 " < < " RC_MAP_AUX2 " ;
for ( int i = 0 ; i < attitudeParams . count ( ) ; i + + ) {
int map = getParameterFact ( FactSystem : : defaultComponentId , attitudeParams [ i ] ) - > v alue( ) . toInt ( ) ;
int map = getParameterFact ( FactSystem : : defaultComponentId , attitudeParams [ i ] ) - > rawV alue( ) . toInt ( ) ;
for ( int j = 0 ; j < switchParams . count ( ) ; j + + ) {
if ( map ! = 0 & & map = = switchMappings [ j ] ) {
@ -201,7 +201,7 @@ void FlightModesComponentController::_validateConfiguration(void)
@@ -201,7 +201,7 @@ void FlightModesComponentController::_validateConfiguration(void)
thresholdParams < < " RC_ASSIST_TH " < < " RC_AUTO_TH " < < " RC_ACRO_TH " < < " RC_POSCTL_TH " < < " RC_LOITER_TH " < < " RC_RETURN_TH " < < " RC_OFFB_TH " ;
foreach ( QString thresholdParam , thresholdParams ) {
float threshold = getParameterFact ( - 1 , thresholdParam ) - > v alue( ) . toFloat ( ) ;
float threshold = getParameterFact ( - 1 , thresholdParam ) - > rawV alue( ) . toFloat ( ) ;
if ( threshold < 0.0f | | threshold > 1.0f ) {
_validConfiguration = false ;
_configurationErrors + = QString ( " %1 is set to %2. Threshold must between 0.0 and 1.0 (inclusive). \n " ) . arg ( thresholdParam ) . arg ( threshold ) ;
@ -239,7 +239,7 @@ double FlightModesComponentController::_switchLiveRange(const QString& param)
@@ -239,7 +239,7 @@ double FlightModesComponentController::_switchLiveRange(const QString& param)
{
QVariant value ;
int channel = getParameterFact ( - 1 , param ) - > v alue( ) . toInt ( ) ;
int channel = getParameterFact ( - 1 , param ) - > rawV alue( ) . toInt ( ) ;
if ( channel = = 0 ) {
return 0.0 ;
} else {
@ -269,7 +269,7 @@ double FlightModesComponentController::acroModeRcValue(void)
@@ -269,7 +269,7 @@ double FlightModesComponentController::acroModeRcValue(void)
double FlightModesComponentController : : altCtlModeRcValue ( void )
{
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > v alue( ) . toInt ( ) ;
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > rawV alue( ) . toInt ( ) ;
if ( posCtlSwitchChannel = = 0 ) {
return _switchLiveRange ( " RC_MAP_MODE_SW " ) ;
@ -285,8 +285,8 @@ double FlightModesComponentController::posCtlModeRcValue(void)
@@ -285,8 +285,8 @@ double FlightModesComponentController::posCtlModeRcValue(void)
double FlightModesComponentController : : missionModeRcValue ( void )
{
int returnSwitchChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > v alue( ) . toInt ( ) ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > v alue( ) . toInt ( ) ;
int returnSwitchChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > rawV alue( ) . toInt ( ) ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > rawV alue( ) . toInt ( ) ;
const char * switchChannelParam = " RC_MAP_MODE_SW " ;
@ -334,20 +334,20 @@ void FlightModesComponentController::_recalcModeSelections(void)
@@ -334,20 +334,20 @@ void FlightModesComponentController::_recalcModeSelections(void)
_offboardModeSelected = false ;
// Convert channels to 0-based, -1 signals not mapped
int modeSwitchChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > v alue( ) . toInt ( ) - 1 ;
int acroSwitchChannel = getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > v alue( ) . toInt ( ) - 1 ;
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > v alue( ) . toInt ( ) - 1 ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > v alue( ) . toInt ( ) - 1 ;
int returnSwitchChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > v alue( ) . toInt ( ) - 1 ;
int offboardSwitchChannel = getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > v alue( ) . toInt ( ) - 1 ;
double autoThreshold = getParameterFact ( - 1 , " RC_AUTO_TH " ) - > v alue( ) . toDouble ( ) ;
double assistThreshold = getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > v alue( ) . toDouble ( ) ;
double acroThreshold = getParameterFact ( - 1 , " RC_ACRO_TH " ) - > v alue( ) . toDouble ( ) ;
double posCtlThreshold = getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > v alue( ) . toDouble ( ) ;
double loiterThreshold = getParameterFact ( - 1 , " RC_LOITER_TH " ) - > v alue( ) . toDouble ( ) ;
double returnThreshold = getParameterFact ( - 1 , " RC_RETURN_TH " ) - > v alue( ) . toDouble ( ) ;
double offboardThreshold = getParameterFact ( - 1 , " RC_OFFB_TH " ) - > v alue( ) . toDouble ( ) ;
int modeSwitchChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > rawV alue( ) . toInt ( ) - 1 ;
int acroSwitchChannel = getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > rawV alue( ) . toInt ( ) - 1 ;
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > rawV alue( ) . toInt ( ) - 1 ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > rawV alue( ) . toInt ( ) - 1 ;
int returnSwitchChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > rawV alue( ) . toInt ( ) - 1 ;
int offboardSwitchChannel = getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > rawV alue( ) . toInt ( ) - 1 ;
double autoThreshold = getParameterFact ( - 1 , " RC_AUTO_TH " ) - > rawV alue( ) . toDouble ( ) ;
double assistThreshold = getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > rawV alue( ) . toDouble ( ) ;
double acroThreshold = getParameterFact ( - 1 , " RC_ACRO_TH " ) - > rawV alue( ) . toDouble ( ) ;
double posCtlThreshold = getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > rawV alue( ) . toDouble ( ) ;
double loiterThreshold = getParameterFact ( - 1 , " RC_LOITER_TH " ) - > rawV alue( ) . toDouble ( ) ;
double returnThreshold = getParameterFact ( - 1 , " RC_RETURN_TH " ) - > rawV alue( ) . toDouble ( ) ;
double offboardThreshold = getParameterFact ( - 1 , " RC_OFFB_TH " ) - > rawV alue( ) . toDouble ( ) ;
if ( modeSwitchChannel > = 0 ) {
if ( offboardSwitchChannel > = 0 & & _rcValues [ offboardSwitchChannel ] > = offboardThreshold ) {
@ -382,12 +382,12 @@ void FlightModesComponentController::_recalcModeSelections(void)
@@ -382,12 +382,12 @@ void FlightModesComponentController::_recalcModeSelections(void)
void FlightModesComponentController : : _recalcModeRows ( void )
{
int modeSwitchChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > v alue( ) . toInt ( ) ;
int acroSwitchChannel = getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > v alue( ) . toInt ( ) ;
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > v alue( ) . toInt ( ) ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > v alue( ) . toInt ( ) ;
int returnSwitchChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > v alue( ) . toInt ( ) ;
int offboardSwitchChannel = getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > v alue( ) . toInt ( ) ;
int modeSwitchChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > rawV alue( ) . toInt ( ) ;
int acroSwitchChannel = getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > rawV alue( ) . toInt ( ) ;
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > rawV alue( ) . toInt ( ) ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > rawV alue( ) . toInt ( ) ;
int returnSwitchChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > rawV alue( ) . toInt ( ) ;
int offboardSwitchChannel = getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > rawV alue( ) . toInt ( ) ;
if ( modeSwitchChannel = = 0 ) {
_acroModeRow = 0 ;
@ -477,65 +477,65 @@ double FlightModesComponentController::manualModeThreshold(void)
@@ -477,65 +477,65 @@ double FlightModesComponentController::manualModeThreshold(void)
double FlightModesComponentController : : assistModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : autoModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_AUTO_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_AUTO_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : acroModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_ACRO_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_ACRO_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : altCtlModeThreshold ( void )
{
return _assistModeVisible ? 0.0 : getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > v alue( ) . toDouble ( ) ;
return _assistModeVisible ? 0.0 : getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : posCtlModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : missionModeThreshold ( void )
{
return _autoModeVisible ? 0.0 : getParameterFact ( - 1 , " RC_AUTO_TH " ) - > v alue( ) . toDouble ( ) ;
return _autoModeVisible ? 0.0 : getParameterFact ( - 1 , " RC_AUTO_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : loiterModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_LOITER_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_LOITER_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : returnModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_RETURN_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_RETURN_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
double FlightModesComponentController : : offboardModeThreshold ( void )
{
return getParameterFact ( - 1 , " RC_OFFB_TH " ) - > v alue( ) . toDouble ( ) ;
return getParameterFact ( - 1 , " RC_OFFB_TH " ) - > rawV alue( ) . toDouble ( ) ;
}
void FlightModesComponentController : : setAssistModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
void FlightModesComponentController : : setAutoModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_AUTO_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_AUTO_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
void FlightModesComponentController : : setAcroModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_ACRO_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_ACRO_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
@ -546,7 +546,7 @@ void FlightModesComponentController::setAltCtlModeThreshold(double threshold)
@@ -546,7 +546,7 @@ void FlightModesComponentController::setAltCtlModeThreshold(double threshold)
void FlightModesComponentController : : setPosCtlModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
@ -557,19 +557,19 @@ void FlightModesComponentController::setMissionModeThreshold(double threshold)
@@ -557,19 +557,19 @@ void FlightModesComponentController::setMissionModeThreshold(double threshold)
void FlightModesComponentController : : setLoiterModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_LOITER_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_LOITER_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
void FlightModesComponentController : : setReturnModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_RETURN_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_RETURN_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
void FlightModesComponentController : : setOffboardModeThreshold ( double threshold )
{
getParameterFact ( - 1 , " RC_OFFB_TH " ) - > setValue ( threshold ) ;
getParameterFact ( - 1 , " RC_OFFB_TH " ) - > setRaw Value ( threshold ) ;
_recalcModeSelections ( ) ;
}
@ -580,7 +580,7 @@ int FlightModesComponentController::_channelToChannelIndex(int channel)
@@ -580,7 +580,7 @@ int FlightModesComponentController::_channelToChannelIndex(int channel)
int FlightModesComponentController : : _channelToChannelIndex ( const QString & channelParam )
{
return _channelToChannelIndex ( getParameterFact ( - 1 , channelParam ) - > v alue( ) . toInt ( ) ) ;
return _channelToChannelIndex ( getParameterFact ( - 1 , channelParam ) - > rawV alue( ) . toInt ( ) ) ;
}
int FlightModesComponentController : : manualModeChannelIndex ( void )
@ -605,7 +605,7 @@ int FlightModesComponentController::acroModeChannelIndex(void)
@@ -605,7 +605,7 @@ int FlightModesComponentController::acroModeChannelIndex(void)
int FlightModesComponentController : : altCtlModeChannelIndex ( void )
{
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > v alue( ) . toInt ( ) ;
int posCtlSwitchChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > rawV alue( ) . toInt ( ) ;
if ( posCtlSwitchChannel = = 0 ) {
return _channelToChannelIndex ( " RC_MAP_MODE_SW " ) ;
@ -626,7 +626,7 @@ int FlightModesComponentController::loiterModeChannelIndex(void)
@@ -626,7 +626,7 @@ int FlightModesComponentController::loiterModeChannelIndex(void)
int FlightModesComponentController : : missionModeChannelIndex ( void )
{
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > v alue( ) . toInt ( ) ;
int loiterSwitchChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > rawV alue( ) . toInt ( ) ;
if ( loiterSwitchChannel = = 0 ) {
return _channelToChannelIndex ( " RC_MAP_MODE_SW " ) ;
@ -652,7 +652,7 @@ int FlightModesComponentController::_channelIndexToChannel(int index)
@@ -652,7 +652,7 @@ int FlightModesComponentController::_channelIndexToChannel(int index)
void FlightModesComponentController : : setManualModeChannelIndex ( int index )
{
getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > setValue ( _channelIndexToChannel ( index ) ) ;
getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > setRaw Value ( _channelIndexToChannel ( index ) ) ;
_recalcModeSelections ( ) ;
_recalcModeRows ( ) ;
@ -662,7 +662,7 @@ void FlightModesComponentController::setManualModeChannelIndex(int index)
@@ -662,7 +662,7 @@ void FlightModesComponentController::setManualModeChannelIndex(int index)
void FlightModesComponentController : : setAcroModeChannelIndex ( int index )
{
getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > setValue ( _channelIndexToChannel ( index ) ) ;
getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > setRaw Value ( _channelIndexToChannel ( index ) ) ;
_recalcModeSelections ( ) ;
_recalcModeRows ( ) ;
@ -672,14 +672,14 @@ void FlightModesComponentController::setPosCtlModeChannelIndex(int index)
@@ -672,14 +672,14 @@ void FlightModesComponentController::setPosCtlModeChannelIndex(int index)
{
int channel = _channelIndexToChannel ( index ) ;
getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > setValue ( channel ) ;
getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > setRaw Value ( channel ) ;
if ( channel = = 0 ) {
// PosCtl disabled so AltCtl must move back to main Mode switch
_assistModeVisible = false ;
} else {
// Assist mode is visible if AltCtl/PosCtl are on seperate channel from main Mode switch
_assistModeVisible = channel ! = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > v alue( ) . toInt ( ) ;
_assistModeVisible = channel ! = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > rawV alue( ) . toInt ( ) ;
}
emit modesVisibleChanged ( ) ;
@ -694,14 +694,14 @@ void FlightModesComponentController::setLoiterModeChannelIndex(int index)
@@ -694,14 +694,14 @@ void FlightModesComponentController::setLoiterModeChannelIndex(int index)
{
int channel = _channelIndexToChannel ( index ) ;
getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > setValue ( channel ) ;
getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > setRaw Value ( channel ) ;
if ( channel = = 0 ) {
// Loiter disabled so Mission must move back to main Mode switch
_autoModeVisible = false ;
} else {
// Auto mode is visible if Mission/Loiter are on seperate channel from main Mode switch
_autoModeVisible = channel ! = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > v alue( ) . toInt ( ) ;
_autoModeVisible = channel ! = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > rawV alue( ) . toInt ( ) ;
}
emit modesVisibleChanged ( ) ;
@ -714,7 +714,7 @@ void FlightModesComponentController::setLoiterModeChannelIndex(int index)
@@ -714,7 +714,7 @@ void FlightModesComponentController::setLoiterModeChannelIndex(int index)
void FlightModesComponentController : : setReturnModeChannelIndex ( int index )
{
getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > setValue ( _channelIndexToChannel ( index ) ) ;
getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > setRaw Value ( _channelIndexToChannel ( index ) ) ;
_recalcModeSelections ( ) ;
_recalcModeRows ( ) ;
emit channelIndicesChanged ( ) ;
@ -723,7 +723,7 @@ void FlightModesComponentController::setReturnModeChannelIndex(int index)
@@ -723,7 +723,7 @@ void FlightModesComponentController::setReturnModeChannelIndex(int index)
void FlightModesComponentController : : setOffboardModeChannelIndex ( int index )
{
getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > setValue ( _channelIndexToChannel ( index ) ) ;
getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > setRaw Value ( _channelIndexToChannel ( index ) ) ;
_recalcModeSelections ( ) ;
_recalcModeRows ( ) ;
emit channelIndicesChanged ( ) ;
@ -739,17 +739,17 @@ void FlightModesComponentController::generateThresholds(void)
@@ -739,17 +739,17 @@ void FlightModesComponentController::generateThresholds(void)
thresholdParams < < " RC_ASSIST_TH " < < " RC_AUTO_TH " < < " RC_ACRO_TH " < < " RC_POSCTL_TH " < < " RC_LOITER_TH " < < " RC_RETURN_TH " < < " RC_OFFB_TH " ;
foreach ( QString thresholdParam , thresholdParams ) {
getParameterFact ( - 1 , thresholdParam ) - > setValue ( 0.0f ) ;
getParameterFact ( - 1 , thresholdParam ) - > setRaw Value ( 0.0f ) ;
}
// Redistribute
int modeChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > v alue( ) . toInt ( ) ;
int acroChannel = getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > v alue( ) . toInt ( ) ;
int posCtlChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > v alue( ) . toInt ( ) ;
int loiterChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > v alue( ) . toInt ( ) ;
int returnChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > v alue( ) . toInt ( ) ;
int offboardChannel = getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > v alue( ) . toInt ( ) ;
int modeChannel = getParameterFact ( - 1 , " RC_MAP_MODE_SW " ) - > rawV alue( ) . toInt ( ) ;
int acroChannel = getParameterFact ( - 1 , " RC_MAP_ACRO_SW " ) - > rawV alue( ) . toInt ( ) ;
int posCtlChannel = getParameterFact ( - 1 , " RC_MAP_POSCTL_SW " ) - > rawV alue( ) . toInt ( ) ;
int loiterChannel = getParameterFact ( - 1 , " RC_MAP_LOITER_SW " ) - > rawV alue( ) . toInt ( ) ;
int returnChannel = getParameterFact ( - 1 , " RC_MAP_RETURN_SW " ) - > rawV alue( ) . toInt ( ) ;
int offboardChannel = getParameterFact ( - 1 , " RC_MAP_OFFB_SW " ) - > rawV alue( ) . toInt ( ) ;
if ( modeChannel ! = 0 ) {
int positions = 3 ; // Manual/Assist/Auto always exist
@ -771,35 +771,35 @@ void FlightModesComponentController::generateThresholds(void)
@@ -771,35 +771,35 @@ void FlightModesComponentController::generateThresholds(void)
if ( acroOnModeSwitch ) {
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_ACRO_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_ACRO_TH " ) - > setRaw Value ( currentThreshold ) ;
acroChannel = 0 ;
}
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_ASSIST_TH " ) - > setRaw Value ( currentThreshold ) ;
if ( posCtlOnModeSwitch ) {
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > setRaw Value ( currentThreshold ) ;
posCtlChannel = 0 ;
}
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_AUTO_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_AUTO_TH " ) - > setRaw Value ( currentThreshold ) ;
if ( loiterOnModeSwitch ) {
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_LOITER_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_LOITER_TH " ) - > setRaw Value ( currentThreshold ) ;
loiterChannel = 0 ;
}
if ( returnOnModeSwitch ) {
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_RETURN_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_RETURN_TH " ) - > setRaw Value ( currentThreshold ) ;
returnChannel = 0 ;
}
if ( offboardOnModeSwitch ) {
currentThreshold + = increment ;
getParameterFact ( - 1 , " RC_OFFB_TH " ) - > setValue ( currentThreshold ) ;
getParameterFact ( - 1 , " RC_OFFB_TH " ) - > setRaw Value ( currentThreshold ) ;
offboardChannel = 0 ;
}
}
@ -807,23 +807,23 @@ void FlightModesComponentController::generateThresholds(void)
@@ -807,23 +807,23 @@ void FlightModesComponentController::generateThresholds(void)
if ( acroChannel ! = 0 ) {
// If only two positions don't set threshold at midrange. Setting to 0.25
// allows for this channel to work with either a two or three position switch
getParameterFact ( - 1 , " RC_ACRO_TH " ) - > setValue ( 0.25f ) ;
getParameterFact ( - 1 , " RC_ACRO_TH " ) - > setRaw Value ( 0.25f ) ;
}
if ( posCtlChannel ! = 0 ) {
getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > setValue ( 0.25f ) ;
getParameterFact ( - 1 , " RC_POSCTL_TH " ) - > setRaw Value ( 0.25f ) ;
}
if ( loiterChannel ! = 0 ) {
getParameterFact ( - 1 , " RC_LOITER_TH " ) - > setValue ( 0.25f ) ;
getParameterFact ( - 1 , " RC_LOITER_TH " ) - > setRaw Value ( 0.25f ) ;
}
if ( returnChannel ! = 0 ) {
getParameterFact ( - 1 , " RC_RETURN_TH " ) - > setValue ( 0.25f ) ;
getParameterFact ( - 1 , " RC_RETURN_TH " ) - > setRaw Value ( 0.25f ) ;
}
if ( offboardChannel ! = 0 ) {
getParameterFact ( - 1 , " RC_OFFB_TH " ) - > setValue ( 0.25f ) ;
getParameterFact ( - 1 , " RC_OFFB_TH " ) - > setRaw Value ( 0.25f ) ;
}
emit thresholdsChanged ( ) ;