From f5cee13b01deefd7711c8adaa10090985de949ee Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 3 Oct 2006 08:45:28 +0000 Subject: [PATCH] making sure that core actually handles button press event before releasing button again (possible bug during busy-waits) --- .../sics/cooja/contikimote/interfaces/ContikiButton.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiButton.java b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiButton.java index a605be5ae..34778334c 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiButton.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiButton.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ContikiButton.java,v 1.2 2006/09/26 13:08:05 fros4943 Exp $ + * $Id: ContikiButton.java,v 1.3 2006/10/03 08:45:28 fros4943 Exp $ */ package se.sics.cooja.contikimote.interfaces; @@ -139,8 +139,11 @@ public class ContikiButton extends Button implements ContikiMoteInterface { public void doActionsAfterTick() { // If a button is pressed and should be clicked, release it now if (shouldBeReleased) { - releaseButton(); - shouldBeReleased = false; + // Make sure that the earlier press event has been handled by core + if (moteMem.getByteValueOf("simButtonChanged") == 0) { + releaseButton(); + shouldBeReleased = false; + } } }