Skip to content
Snippets Groups Projects
Commit 40581c22 authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Sensor type is now polled up to 10 times

... before setting it to DeviceType.Error. This is done because sometimes
an erroneous packet slips through the comm-layer and causes mayhem in
high-level scripts, especially when polling sensor-types.
parent 894a093d
Branches
Tags
No related merge requests found
......@@ -472,8 +472,17 @@ classdef Sensor < MaskedHandle
error('Sensor::getTypeMode: Sensor-Object not connected to comm handle.');
end
[typeNo,modeNo] = sensor.commInterface.inputDeviceGetTypeMode(0, sensor.port);
type = DeviceType(typeNo);
type = DeviceType.Error;
for i = 1:10
try
[typeNo,modeNo] = sensor.commInterface.inputDeviceGetTypeMode(0, sensor.port);
type = DeviceType(typeNo);
catch ME
continue;
end
break;
end
try
mode = DeviceMode(type,modeNo);
catch ME
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment