mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Patch from Kenz to suppress warnings about unknown object IDs until end of
parsing
This commit is contained in:
parent
81ceb9c17a
commit
fea4accb07
@ -50,6 +50,7 @@ $(ALLOCATIONCODE)
|
||||
fid = fopen(logfile);
|
||||
correctMsgByte=hex2dec('20');
|
||||
correctSyncByte=hex2dec('3C');
|
||||
unknownObjIDList=zeros(1,2);
|
||||
|
||||
% Parse log file, entry by entry
|
||||
prebuf = fread(fid, 12, 'uint8');
|
||||
@ -99,7 +100,12 @@ while (1)
|
||||
switch objID
|
||||
$(SWITCHCODE)
|
||||
otherwise
|
||||
disp(['Unknown object ID: 0x' dec2hex(objID)]);
|
||||
unknownObjIDListIdx=find(unknownObjIDList(:,1)==objID, 1, 'first');
|
||||
if isempty(unknownObjIDListIdx)
|
||||
unknownObjIDList=[unknownObjIDList; objID 1];
|
||||
else
|
||||
unknownObjIDList(unknownObjIDListIdx,2)=unknownObjIDList(unknownObjIDListIdx,2)+1;
|
||||
end
|
||||
msgBytesLeft = datasize - 1 - 1 - 2 - 4;
|
||||
if msgBytesLeft > 255
|
||||
msgBytesLeft = 0;
|
||||
@ -114,6 +120,10 @@ $(SWITCHCODE)
|
||||
prebuf = fread(fid, 12, 'uint8');
|
||||
end
|
||||
|
||||
for i=2:size(unknownObjIDList,1) %Don't show the first one, as it was simply a dummy placeholder
|
||||
disp(['Unknown object ID: 0x' dec2hex(unknownObjIDList(i,1),8) ' appeared ' int2str(unknownObjIDList(i,2)) ' times.']);
|
||||
end
|
||||
|
||||
%% Clean Up and Save mat file
|
||||
fclose(fid);
|
||||
|
||||
|
@ -137,14 +137,14 @@ bool UAVObjectGeneratorMatlab::process_object(ObjectInfo* info)
|
||||
matlabSwitchCode.append("\t\t\t\tFieldNames= fieldnames(" + objectTableName +");\n");
|
||||
matlabSwitchCode.append("\t\t\t\tfor i=1:length(FieldNames) %Grow structure\n");
|
||||
matlabSwitchCode.append("\t\t\t\t\t" + objectTableName + ".(FieldNames{i})(:," + tableIdxName + "*2+1) = 0;\n");
|
||||
matlabSwitchCode.append("\t\t\t\tend;\n");
|
||||
matlabSwitchCode.append("\t\t\t\tend\n");
|
||||
matlabSwitchCode.append("\t\t\tend\n");
|
||||
|
||||
|
||||
//============================================================//
|
||||
// Generate 'Cleanup:' code (will replace the $(CLEANUP) tag) //
|
||||
//============================================================//
|
||||
matlabCleanupCode.append(objectTableName + "=PruneStructOfArrays(" + objectTableName + "," + tableIdxName +"); %#ok<NASGU>\n" );
|
||||
matlabCleanupCode.append(objectTableName + "=PruneStructOfArrays(" + objectTableName + "," + tableIdxName +");\n" );
|
||||
|
||||
|
||||
//========================================================================//
|
||||
|
Loading…
Reference in New Issue
Block a user