You are reading a single comment by @Ganblejs and its replies. Click here to read the full conversation.
  • What happens if you change

    if(event.y<60){ walking(){function selectOnTouchTimer(n, event1) {timer();};}
    

    to

    if(event.y<60){ 
      walking();
      Bangle.removeListener('touch', selectOnTouch);
      {function selectOnTouchTimer(n, event1) {timer();};}
    }
    

    ?

    I'm not sure what line 4 above would actually do though? Seems to me like it's only defining a function - not executing it.

    I would probably try a rewrite to something like

    function selectOnTouchTimer(n, event1) {timer()}
    
    function selectOnTouch(n, event) { 
      if(event.y<60){
        walking()
        Bangle.removeListener('touch', selectOnTouch);
        Bangle.on('touch', selectOnTouchTimer)
      }
      else if(event.y>=60 && event.y<120) {jogging();}
      else {cycling();}
    }
    

    possibly switching line 6 and 7 around.

    Does any of that make it work?

    EDIT: Also, both your examples have too few closing curly brackets. There should be a final one closing out the function selectOnTouch() in both. The second example also needs one more at the end of line 2.

About

Avatar for Ganblejs @Ganblejs started