Skip to content

Commit

Permalink
discontinuous line if samples were skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac committed Mar 9, 2022
1 parent 0ce551b commit 6c8fc9d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions software/MATLAB/BpodStepperLive.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,19 @@ function update(obj,~,~)
if isnan(obj.data(1,end))
obj.data(1,:) = obj.data(1,:) + incoming(1)/1E3;
end

tmp = nan(4,1);
tmp(1) = incoming(1) / 1E3; % time-stamp
tmp(2) = obj.vDiv ./ incoming(3); % velocity
tmp(3) = abs(tmp(2)-obj.data(2,end)) / obj.ts; % acceleration
tmp(4) = bitand(1023, incoming(2)); % load
obj.data = [obj.data(:,2:end) tmp];

tmp = nan(4,1);
tmp(1) = incoming(1) / 1E3; % time-stamp
tmp(2) = obj.vDiv ./ incoming(3); % velocity
tmp(3) = abs(tmp(2)-obj.data(2,end)) / obj.ts; % acceleration
tmp(4) = bitand(1023, incoming(2)); % load

if incoming(1) / 1E3 > obj.data(1,end) + 1.5 * obj.ts
tmp(3) = NaN;
obj.data = [obj.data(:,3:end) nan(4,1) tmp];
else
obj.data = [obj.data(:,2:end) tmp];
end

[obj.h.plot.XData] = deal(obj.data(1,:)-obj.data(1,end));
obj.h.plot(1).YData = obj.data(2,:);
Expand Down

0 comments on commit 6c8fc9d

Please sign in to comment.