Avatar for Ptitonio

Ptitonio

Member since Nov 2019 • Last active May 2022
  • 2 conversations
  • 16 comments

Most recent activity

  • in Bangle.js
    Avatar for Ptitonio

    @Robin :
    Thanks for the advice, I will no longer use this writing for prototypes. The problem still persists with the conventional form.
    I'm not used to Github, but I'll try to do it.

    @Gordon :
    I'm a little ashamed. I didn't uncheck all options.
    Obviously, it works on all devices. This reassures me, thank you.

  • in Bangle.js
    Avatar for Ptitonio

    Now test with this code :

    function Test() {
      this.p1 = {x:0, y:80};
      this.p2 = {x:240, y:80};
    }
    
    Test.prototype.draw = _=> {
      g.clear();
      g.drawLine(0,80,240,80);
      return true;
    };
    
    var t= new Test();
    if (t.draw()) {
      g.drawLine(0,160,240,160);
    }
    
    

    It works in the emulator but not on Bangle, only the first line is drawn and an error message appear on console ( see screen copy )

    I have tested on Pico with this similar code :

    function Test() {
      this.p1 = {x:0, y:80};
      this.p2 = {x:240, y:80};
    }
    
    Test.prototype.draw = _=> {
    //  g.clear();
    //  g.drawLine(0,80,240,80);
      console.log('line1');
      return true;
    };
    
    var t= new Test();
    if (t.draw()) {
    //  g.drawLine(0,160,240,160);
      console.log('line2');
    }
    

    same problem , with this message error :


    | |_ ___ ___ _ ||___ ___
    | |_ -| . | _| | | | | . |
    |
    |_| || |_|||_|_|

         |_| espruino.com
    

    2v04 (c) 2019 G.Williams
    line1
    Uncaught SyntaxError: BREAK statement outside of SWITCH, FOR or WHILE loop
    at line 4 col 22
    console.log('line1');return true;
    ^
    in function "draw" called from line 7 col 10
    if(t.draw()){console.log('line2');

    (test are made without minification)
    Strange !

  • in Bangle.js
    Avatar for Ptitonio

    In fact it also does not work in the emulator if the minimification is on.

  • in Bangle.js
    Avatar for Ptitonio

    yes and it's ok with no minification .

  • in Bangle.js
    Avatar for Ptitonio

    Good morning,

    Look at this code, it draws 2 horizontal lines on the Bangle screen

    
    function Test(){
      this.p1 = {x:0, y:80};
      this.p2 = {x:240, y:80};
    }
    
    Test.prototype.draw = _=> {
      g.clear();
      g.drawLine(0,80,240,80);
    };
    
    var t= new Test();
    t.draw();
    g.drawLine(0,160,240,160);
    
    

    When it is sent to the emulator, it works well.
    When it is sent to the Bangle, it does not work properly, only the second line is drawn.
    A dump to the console shows that the function draw() is not properly loaded

    dump()
    function Test() {this.p1={x:0,y:80},this.p2={x:240,y:80}­;}
    Test.prototype.draw = function (undefined) {return g.clear()};
    var t = Object.create(Test["prototype"]);
    t.p1 = { "x": 0, "y": 80 };
    t.p2 = { "x": 240, "y": 80 };
    E.setFlags({ "deepSleep": 0, "pretokenise": 1, "unsafeFlash": 0, "unsyncFiles": 0 });

    If I type this code in REPL mode with Bangle connected, it works well.

    Where's the error ?

  • in ESP32
    Avatar for Ptitonio

    Hello everyone,
    It seems that the quantifiers '?' and '{}' don't work'

    /2?\d/.exec("24") // return null rather than 24
    

    Are they implemented ?

    Thank you.

    • 16 comments
    • 5,210 views
  • in General
    Avatar for Ptitonio

    Gordon ! We are a genie !
    Indeed the setting of Chrome Web store IDE was : .js.|min.j
    Yet I had control over the setting of both IDE.
    I do not remember having modified this parameter on Chrome Web store IDE.
    Now Both of IDE works fine.

    Thanks a lot

    PS: WEB IDE = Chrome Web store IDE

  • in General
    Avatar for Ptitonio

    Screenshoots ...

Actions