• The problem in short: i have written some small light show code for 8x8 LED matrix display using MAX7219 driver. Each small part of my code is designed and tested in left side of IDE window. All seems to working as expected. When i try to run all code parts together, my Espruino board hangs and should be restarted. All my code is bellow:

    SPI2.setup({mosi:B15, sck:B13});
    var disp = require("MAX7219").connect(SPI2,C4);
    
    var matrix = [255,129,129,129,129,129,129,255,0,126,6­6,66,66,66,126,0,0,0,60,36,36,60,0,0,0,0­,0,24,24,0,0,0];
    
    setInterval(function(){
      setTimeout(function() {disp.raw(matrica.slice(0,8)); }, 10);
      setTimeout(function() {disp.raw(matrica.slice(8,16)); }, 200);
      setTimeout(function() {disp.raw(matrica.slice(16,24)); }, 300);
      setTimeout(function() {disp.raw(matrica.slice(24,32)); }, 400);
    }, 1000);
    

    There is link to Youtube video: http://youtu.be/cTESkFNigac

    Code should be buggy. Or... i can't understand where is difference between two parts of Espruino IDE.
    Btw, sorry for worst english grammar ever, still learning.

  • I just tried your code in the right-hand side of the Web IDE and it seems to work for me? (although I did have to remove the 2 strange characters that the forum added)

    Are you getting any errors/warnings highlighted in the right-hand side of the IDE where your code is?

    I know one really easy way to confuse it is to put more open brackets than close brackets - but the recent Web IDE has changes that should detect that and complain about it before the upload.

  • Just to add - there is very little difference between right and left, apart from how newlines are treated.

    I got lots of complaints that people were doing things like this:

    var a = 1
        , b=2;
    var c = "Hello"
         + "World";
    

    and it was breaking - because obviously if you type that into the left-hand side the code will be executed right after the first line.

    So now, the Web IDE tries to detect stuff like that and in those cases it replaces the newline with Alt+Enter - which adds a newline without attempting to execute the last.

    Hope that helps!

  • Nop. The code in right side of my IDE is the exactly like this in forum thread. When i copy/pasted to left side, is working perfectly.
    Is there special options for OS on my laptop? I'm linux user. Ubuntu derivative, Linux Mint.

    Btw, this is first time when i get some strange (no syntactic) errors or behaviour.

  • One more thing. On terminal side cursor are in waiting mode. Its like broken terminal, when Rx or Tx line is disconnected and user still writing in console.
    And what is more wierd, i have sucessfully download code to Espruino board, cursor still hangs, i have disconnect the board from USB cable and connect back. Urra, code is running.
    Something is broken between me and board :) Probably line endings, or something more special in my OS installation.? Thanks to kernel, not me.

  • That is strange. I use Ubuntu all the time, so I would have thought I'd have noticed problems if there were any.

    Actually sorry - I forgot to add I had to change var matrix = to var matrica =. But uploading as it was didn't halt Espruino, it just made a bunch of errors show up about slice not existing on undefined.

    Maybe type:

    [Enter]
    [Ctrl+C]
    echo(1)[Enter]
    

    If it was an error sending to the board, that should help to recover from it.

  • Actually it's my fault matrix, matrica. Diff between english and my native language.
    But this trinity helps. I can get board back from "another dimension". Command line is live again. Code on board is not running anyway.

  • Brokened part of my example is found. Before posting of my code i deleted some commented lines out from code. Without thees lines code is running on board and nothing hangs. But anyway, case is wierd. Theese lines are commented anyway. Why interpreter hangs?

    //disp.raw([1,2,4,8,16,32,64,128]); // Diagonāle
    //disp.raw([255,129,129,129,129,129,129,­255]); // Kvadrāts
    //disp.raw([0,126,66,66,66,66,126,0]); // Kvadrāts-1
    //disp.raw([0,0,60,36,36,60,0,0]); // Kvadrāts-2
    //disp.raw([0,0,0,24,24,0,0,0]); // Kvadrāts-3
    

    At end of each line is comment in my native language for myself. To remember what is done already.

  • I still can't get it to happen - can you click 'save' in the Web IDE, save the file, and e-mail it to me?

    It might help me to figure out what's going on. I guess it's possible that there is some issue with uploading the comments (maybe it's something to do with UTF8 characters?).

    Probably if you turned on 'whitespace minification' in settings it would solve the problem? It makes it harder to debug though.

  • After i turned on 'Whitespace Only' for code and modules, there is no more faults. Code downloaded to board and running like shown on video.
    In my code, i have used just module for MAX7219.
    Without any 'Minification' options turned on, downloading just hangs.

  • Ok, It'll be fixed in the latest Web IDE from Git, or when I next do a release.

    The issue was that the character code of ā in Kvadrāts-2 was 257, so it got clipped down to 8 bits to get sent over serial, making it character code '1'. A few months ago someone committed some code that made Ctrl-A (character code 1) behave like the 'home' button (although they never implemented this for the Web IDE) - so it had the effect of pressing the home key in the middle of writing something, which meant that at the end the cursor in the middle of the line of text and 'Enter' no longer executed anything.

  • The IDE should probably throw up a warning when you try to send code that contains unicode characters - there's nothing good that can come from sending munged unicode to the Espruino, so we should notify people when it's doing that. (Of course, for this to be useful, something also needs to be done about how error message are displayed in the IDE, because they pop up and then vanish too fast to read them - maybe ones that are yellow/red, indicating errors, should stay for longer?)
    Maybe the offending characters should even be ditched alltogether, or replaced with a placeholder - though you still need to notify the user of this.

  • Yes, I suppose it's an idea - currently it warns in the console and just replaces with a ?

    By the way, I just increased the timeout for notifications

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Is there some hidden differences between terminal and editor in Espruino IDE

Posted by Avatar for Ritvars @Ritvars

Actions