• It looks to me that watches tells you what you have bound to the Buttons.
    Below is the result of my stepo watch, which detects press and release of BTN2.

    global["\xFF"].watches
    =[
      undefined,
      { pin: D22, recur: true, debounce: 26214, edge: 1,
        callback: function () { ... },
        state: false },
      { pin: D22, recur: true, debounce: 26214, edge: -1,
        callback: function () { ... },
        state: false }
     ]
    >
    

    Below is the result of my experimental multiclock where I want to have {BTN1, BTN2} short and long presses passed onto the current watch face. I use BTN3 rising edge to switch faces and leave BTN3 long press for the reset.

    >global["\xFF"].watches
    =[
      undefined,
      { pin: D24, recur: true, debounce: 26214, edge: 1,
        callback: function (btn) { ... },
        state: false },
      { pin: D22, recur: true, debounce: 26214, edge: 1,
        callback: function (btn) { ... },
        state: false },
      { pin: D23, recur: true, debounce: 26214, edge: 1,
        callback: function () { ... },
        state: false, lastTime: 1615420296.37918376922 },
      { pin: D24, recur: true, debounce: 26214, edge: -1,
        callback: function (btn) { ... },
        state: false },
      { pin: D22, recur: true, debounce: 26214, edge: -1,
        callback: function (btn) { ... },
        state: false }
     ]
    
    

    So these are both what I would expect.

      setWatch(btn_pressed.bind(null,1), BTN1, {repeat:true,edge:"rising"});
      setWatch(btn_pressed.bind(null,2), BTN2, {repeat:true,edge:"rising"});
      setWatch(nextFace, BTN3, {repeat:true,edge:"rising"});
    
      setWatch(btn_released.bind(null,1), BTN1, {repeat:true,edge:"falling"});
      setWatch(btn_released.bind(null,2), BTN2, {repeat:true,edge:"falling"});
      // BTN 3 long press should always reset the bangle
    
About

Avatar for HughB @HughB started