| | 78 | %% Check valid-flag, re-request data if necessary |
| | 79 | if ~in.Valid |
| | 80 | % init timeout-counter |
| | 81 | startTime = clock(); |
| | 82 | timeOut = 0.1; % in seconds |
| | 83 | % loop until valid |
| | 84 | while (~in.Valid) && (etime(clock, startTime) < timeOut) |
| | 85 | in = NXT_GetInputValues(f_sensorport, handle); |
| | 86 | end%while |
| | 87 | %TODO please note that we DO NOT warn or do anything else if this |
| | 88 | %procedure above times out -- that seems ok, since we didn't do |
| | 89 | %that before (old ver. up to 2.02) either... |
| | 90 | % in that case, the returned value will probably be invalid... |
| | 91 | % dangerous. |
| | 92 | % solutions: either WARN, or return NaN... |
| | 93 | end%if |
| | 94 | |