1
0
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:
James Cotton 2012-02-13 14:55:44 -06:00
parent 81ceb9c17a
commit fea4accb07
2 changed files with 13 additions and 3 deletions

View File

@ -50,6 +50,7 @@ $(ALLOCATIONCODE)
fid = fopen(logfile); fid = fopen(logfile);
correctMsgByte=hex2dec('20'); correctMsgByte=hex2dec('20');
correctSyncByte=hex2dec('3C'); correctSyncByte=hex2dec('3C');
unknownObjIDList=zeros(1,2);
% Parse log file, entry by entry % Parse log file, entry by entry
prebuf = fread(fid, 12, 'uint8'); prebuf = fread(fid, 12, 'uint8');
@ -99,7 +100,12 @@ while (1)
switch objID switch objID
$(SWITCHCODE) $(SWITCHCODE)
otherwise 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; msgBytesLeft = datasize - 1 - 1 - 2 - 4;
if msgBytesLeft > 255 if msgBytesLeft > 255
msgBytesLeft = 0; msgBytesLeft = 0;
@ -114,6 +120,10 @@ $(SWITCHCODE)
prebuf = fread(fid, 12, 'uint8'); prebuf = fread(fid, 12, 'uint8');
end 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 %% Clean Up and Save mat file
fclose(fid); fclose(fid);

View File

@ -137,14 +137,14 @@ bool UAVObjectGeneratorMatlab::process_object(ObjectInfo* info)
matlabSwitchCode.append("\t\t\t\tFieldNames= fieldnames(" + objectTableName +");\n"); 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\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\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"); matlabSwitchCode.append("\t\t\tend\n");
//============================================================// //============================================================//
// Generate 'Cleanup:' code (will replace the $(CLEANUP) tag) // // Generate 'Cleanup:' code (will replace the $(CLEANUP) tag) //
//============================================================// //============================================================//
matlabCleanupCode.append(objectTableName + "=PruneStructOfArrays(" + objectTableName + "," + tableIdxName +"); %#ok<NASGU>\n" ); matlabCleanupCode.append(objectTableName + "=PruneStructOfArrays(" + objectTableName + "," + tableIdxName +");\n" );
//========================================================================// //========================================================================//