Unverified Commit b44d5ad4 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8892 from DonLakeFlyer/RCChannelMax

Radio Cal/Monitor: Handle max channel correctly
parents 8fdbaf3f c16638d0
......@@ -232,8 +232,6 @@ private:
void _signalAllAttitudeValueChanges(void);
int _chanMax(void) const;
bool _channelReversedParamValue(int channel);
void _setChannelReversedParamValue(int channel, bool reversed);
......@@ -272,14 +270,10 @@ private:
static const int _attitudeControls = 5;
int _chanCount; ///< Number of actual rc channels available
static const int _chanMaxPX4 = 18; ///< Maximum number of supported rc channels, PX4 Firmware
static const int _chanMaxAPM = 14; ///< Maximum number of supported rc channels, APM firmware
static const int _chanMaxAny = 18; ///< Maximum number of support rc channels by this implementation
static const int _chanMax = 18; ///< Maximum number of support rc channels by this implementation
static const int _chanMinimum = 5; ///< Minimum numner of channels required to run
struct ChannelInfo _rgChannelInfo[_chanMaxAny]; ///< Information associated with each rc channel
QList<int> _apmPossibleMissingRCChannelParams; ///< List of possible missing RC*_* params for APM stack
struct ChannelInfo _rgChannelInfo[_chanMax]; ///< Information associated with each rc channel
enum rcCalStates _rcCalState; ///< Current calibration state
int _rcCalStateCurrentChannel; ///< Current channel being worked on in rcCalStateIdentify and rcCalStateDetectInversion
......@@ -302,9 +296,9 @@ private:
QString _revParamFormat;
bool _revParamIsBool;
int _rcValueSave[_chanMaxAny]; ///< Saved values prior to detecting channel movement
int _rcValueSave[_chanMax]; ///< Saved values prior to detecting channel movement
int _rcRawValue[_chanMaxAny]; ///< Current set of raw channel values
int _rcRawValue[_chanMax]; ///< Current set of raw channel values
int _stickDetectChannel;
int _stickDetectInitialValue;
......
......@@ -18,9 +18,7 @@ RCChannelMonitorController::RCChannelMonitorController(void)
void RCChannelMonitorController::_rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels])
{
int maxChannel = std::min(channelCount, _chanMax());
for (int channel=0; channel<maxChannel; channel++) {
for (int channel=0; channel<channelCount; channel++) {
int channelValue = pwmValues[channel];
if (_chanCount != channelCount) {
......@@ -33,8 +31,3 @@ void RCChannelMonitorController::_rcChannelsChanged(int channelCount, int pwmVal
}
}
}
int RCChannelMonitorController::_chanMax(void) const
{
return _vehicle->firmwareType() == MAV_AUTOPILOT_PX4 ? _chanMaxPX4 : _chanMaxAPM;
}
......@@ -37,12 +37,7 @@ private slots:
void _rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels]);
private:
int _chanMax(void) const;
int _chanCount;
static const int _chanMaxPX4 = 18; ///< Maximum number of supported rc channels, PX4 Firmware
static const int _chanMaxAPM = 14; ///< Maximum number of supported rc channels, APM firmware
};
#endif // RCChannelMonitorController_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment