Commit 5f269009 authored by DonLakeFlyer's avatar DonLakeFlyer

parent 8fdbaf3f
...@@ -18,9 +18,7 @@ RCChannelMonitorController::RCChannelMonitorController(void) ...@@ -18,9 +18,7 @@ RCChannelMonitorController::RCChannelMonitorController(void)
void RCChannelMonitorController::_rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels]) void RCChannelMonitorController::_rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels])
{ {
int maxChannel = std::min(channelCount, _chanMax()); for (int channel=0; channel<channelCount; channel++) {
for (int channel=0; channel<maxChannel; channel++) {
int channelValue = pwmValues[channel]; int channelValue = pwmValues[channel];
if (_chanCount != channelCount) { if (_chanCount != channelCount) {
...@@ -33,8 +31,3 @@ void RCChannelMonitorController::_rcChannelsChanged(int channelCount, int pwmVal ...@@ -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: ...@@ -37,12 +37,7 @@ private slots:
void _rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels]); void _rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels]);
private: private:
int _chanMax(void) const;
int _chanCount; 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 #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