-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: simulink: adjust for elimination of RCMAP_
- Loading branch information
1 parent
9c53428
commit add4906
Showing
2 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
Tools/simulink/arducopter/functions/findRCChannelNumberForAuxFunction.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
function RCChannelNumberForAuxFunction = findRCChannelNumberForAuxFunction(obj,functionNumber) | ||
% Return a channel number for the supplied function number from the enumeration in RC_Channel.h | ||
% | ||
% Peter Barker, based on getParamVal.m by Fabian Bredemeier | ||
% License: GPL v3 | ||
|
||
% Get list of parameter names | ||
param_names = cell(length(obj.PARM.Name),1); | ||
for i=1:length(obj.PARM.Name) | ||
param_names{i,1} = deblank(obj.PARM.Name(i,1:16)); | ||
end | ||
|
||
% Translate parameter name to cell array if only one name is provided | ||
if ~iscell(paramName) | ||
desParamNames{1} = paramName; | ||
else | ||
desParamNames = paramName; | ||
end | ||
|
||
FIXME below this point | ||
|
||
% Read parameter(s) with boolean indexing | ||
paramVals = single(zeros(numel(desParamNames),1)); | ||
for i = 1:length(desParamNames) | ||
paramIdx = strcmp(param_names, desParamNames{i}); | ||
paramVal = single(obj.PARM.Value(paramIdx)); | ||
if isempty(paramVal) | ||
warning('Parameter could not be found!'); | ||
paramVal = []; | ||
return; | ||
end | ||
paramVals(i,1) = paramVal(1); % Prevent nultidimensional parameters | ||
|
||
if isempty(paramVals) | ||
error(['Parameter ' desParam{i} ' could not be found.']); | ||
end | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters