From fb354e008607465ebb9f5cca640517f9b2dde24c Mon Sep 17 00:00:00 2001
From: Tim Stadtmann <tim.stadtmann@rwth-aachen.de>
Date: Tue, 4 Jul 2017 17:41:19 +0200
Subject: [PATCH] Sensor reset now resets the corresponding sensor

... and not all devices. For this functionality, the EV3-method
resetAllDeviceValues has been added.
---
 source/EV3.m    | 5 +++++
 source/Sensor.m | 8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/source/EV3.m b/source/EV3.m
index 5b36c75..25c04ca 100644
--- a/source/EV3.m
+++ b/source/EV3.m
@@ -256,6 +256,11 @@ classdef EV3 < MaskedHandle
             % Sends a stop-command to all motor-ports.
             ev3.commInterface.outputStopAll();
         end
+        
+        function resetAllDeviceValues(ev3)
+            % Resets values of all sensors on all ports (including tacho counter on motors)
+            ev3.handleCommand(@inputDeviceClrAll, false, 0);
+        end
 
         %% Sound functions
         function beep(ev3)
diff --git a/source/Sensor.m b/source/Sensor.m
index 5e6ac9f..a7300c2 100644
--- a/source/Sensor.m
+++ b/source/Sensor.m
@@ -235,13 +235,11 @@ classdef Sensor < MaskedHandle
         function reset(sensor)
             % Resets sensor value.
             %
-			% Notes:
-            %     * This clears ALL the sensors right now, no other Op-Code available... :(
+            % Notes:
+            %     * Has not been thoroughly tested but seems to work as expected
             %
             
-%             warning(['Current version of reset resets ALL devices, that is, ',...
-%                      'all motor tacho counts and all other sensor counters!']);
-            sensor.handleCommand(@inputDeviceClrAll, false, 0);
+            sensor.handleCommand(@inputDeviceClrChanges, false, 0, sensor.port);
         end
         
         %% Setter
-- 
GitLab