Avatar for JumJum

JumJum

Member since Oct 2013 • Last active Aug 2020
  • 142 conversations
  • 729 comments

Most recent activity

    • 6 comments
    • 55 views
  • in JavaScript
    Avatar for JumJum

    Using edge:0 was my first step. Thats were the problem started.
    I changed to 2 watches to have the option to use different debounce for falling and for raising.
    Anyway, I switched back to one watch for testing.

    function initWP(){
      var arr = new Uint8Array(100),pnt = 0,pulsePort = D3;
      pulsePort.mode('input_pullup');
      function pulseHnd(e){arr[pnt++] = e.state;}
      function logPulse(){
        console.log(new Uint8Array(arr.buffer,0,pnt));
        clearWatch();
      }
      setWatch(pulseHnd,pulsePort,{repeat:true­,edge:0,debounce:5});
      setTimeout(logPulse,5000);
    }
    

    Problem stays.
    Next, based on a hint from @MaBe, used 2 wires connecting on a breadboard to simulate pulses instead of my rotary and got similiar problem. This time I've falling edges without raising between (2nd and 3rd example)

    initWP()
    =undefined
    new Uint8Array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
    >initWP()
    =undefined
    new Uint8Array([0, 0, 1, 0, 1, 0, 1, 0, 1])
    >initWP()
    =undefined
    new Uint8Array([0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0])
    
  • in JavaScript
    Avatar for JumJum

    Still working on my rotary phone.
    For recognizing a simple test should help, thats the idea.

    function initWP(){
      var arr = new Uint8Array(100),pnt = 0,pulsePort = D3;
      pulsePort.mode('input_pullup');
      function pulseHnd(e){arr[pnt++] = e.state;}
      function logPulse(){
        console.log(new Uint8Array(arr.buffer,0,pnt));
        clearWatch();
      }
      setWatch(pulseHnd,pulsePort,{repeat:true­,edge:1,debounce:5});
      setWatch(pulseHnd,pulsePort,{repeat:true­,edge:-1,debounce:5});
      setTimeout(logPulse,5000);
    }
    

    Next switched to terminal window and checked several times.

    initWP()
    =undefined
    new Uint8Array([1, 1, 0])
    >initWP()
    =undefined
    new Uint8Array([1, 1, 1, 1, 1, 0])
    >initWP()
    =undefined
    new Uint8Array([1, 1, 1, 1, 0])
    >initWP()
    =undefined
    new Uint8Array([1, 1, 1, 0])
    >initWP()
    =undefined
    new Uint8Array([0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0])
    > 
    

    How can I get raising edge several times, without having falling edge between ?
    Checked the same with one watch (edge:0) and got similiar result.

    • 12 comments
    • 122 views
  • in JavaScript
    Avatar for JumJum

    Its fixed and works fine. Well done ;-)
    Connection issue did happen one time only today.
    Usual problem, if you want to show strange behaviour, it never happens :-(
    Poor signal should not be the problem, distance between board and laptop is less than 20cm

  • in JavaScript
    Avatar for JumJum

    Hmm, some more (may be helpful) info
    One more problem I have around is disconnecting of UART on MDBT42Q.
    Did not encounter this with Puck (yet?)
    From time to time it happens, that connection is kind of frozen. There is no echo in terminal window anymore. This happens at crlf or in the middle of a command.
    Or, another problem, sending even some lines of code, less than 3kb, from source window to Espruino stops somewhere in the middle.
    And one more, sometimes after reset, startinfo comes in very slow only, char by char.

  • in JavaScript
    Avatar for JumJum

    Just seen new version(V2.06.81) in binaries.
    I did some extended testing with other boards

    board V2.04 V2.06
    ========= ===== =====
    Espruino ok ok
    ESP32 ok ok
    MDBT42Q ok bad
    Puck ok bad

    Based on that, my first guess would be somewhere around implementation of UART for BLE

  • in JavaScript
    Avatar for JumJum

    Tested with Android and nrf
    Got same problem, so its not a windows problem.
    With Android its even worth, first time it takes >30 secs

  • in JavaScript
    Avatar for JumJum

    Hmm,
    tested with 2V06,78 from http://www.espruino.com/binaries/travis/­master/
    Still same problem.
    Latest entry is from 2020-07-30
    Looks like there is no update since end of July

  • in JavaScript
    Avatar for JumJum

    During testing a rotary phone, I ran into problems recognizing pulses.

    After some testing brought it down to following samples.
    Duration is always much more than expected (by me).

    Interesting is last example where only first timeout is wrong.

    Testing is done with WebIde. First examples use terminal window for input.
    Last testing is uploaded from editor window and called from terminal.
    Board is MDBT42Q with 2v06, downloaded from binary

    for(var i = 0; i < 10; i++) {var dt = new Date();setTimeout(function(){console.log­(new Date() - dt);},1000);}
    =undefined
    2159.7900390625
    2161.0107421875
    2162.90283203125
    2164.21508789062
    2165.67993164062
    .....
    
    var dt = new Date();setTimeout(function(){console.log­(new Date() - dt);},100);
    =1
    958.46557617187
    >var dt = new Date();setTimeout(function(){console.log­(new Date() - dt);},100);
    =1
    1476.01318359375
    >var dt = new Date();setTimeout(function(){console.log­(new Date() - dt);},100);
    =1
    1280.94482421875
    >var dt = new Date();setTimeout(function(){console.log­(new Date() - dt);},1000);
    =1
    1865.69213867187
    >var dt = new Date();setTimeout(function(){console.log­(new Date() - dt);},1000);
    =1
    2315.673828125
    
    function tst(duration){
      var pnt = 0;
      function tstTimeout(){
        var dt = new Date();
        setTimeout(function(){ 
          console.log(new Date() - dt);
          if(pnt++ < 4) tstTimeout();
        },duration);
      }
      clearTimeout();
      tstTimeout();
    }
    tst(1000);
    =undefined
    1828.857421875
    1001.43432617187
    1001.46484375
    1001.43432617187
    1001.46484375
    
Actions