Avatar for Mrbbp

Mrbbp

Member since Mar 2017 • Last active Oct 2018
  • 12 conversations
  • 80 comments

I'm newb with espruino, not with arduino, not with js...
But i'm not a coding ninja

Most recent activity

  • in JavaScript
    Avatar for Mrbbp

    well well well i do not understand the issue. I'm confuse.
    i've retried the code on the Max7219 with no encoding accents.. it works fine (few day ago it dont)
    if IDE does not find the font (require), it does not find the module too(require), i have no local repo...
    i do not understand why sometime i have to encode, and not today!

    sorry for this post.
    in fact it works fine.
    i'm not able to reproduce my prob... who does not seem to be...
    sorry

  • in JavaScript
    Avatar for Mrbbp

    i've used the same font on the 2 projects and the same codebase

    require("Font4x6").add(Graphics);
    

    ide trace "no error with Font4x6", and my accents are good on the display (TM1640) with no encoding, but not on the Max7219.

    i do not understand why!
    what i'm doing wrong?

  • in JavaScript
    Avatar for Mrbbp

    i am the plumber, but the way it work is different with the same instruction (with the same tool).
    drawString needs encoding accents for one and not for the other, why?

  • in JavaScript
    Avatar for Mrbbp

    Hello Markus,
    yes that's right (i think i've found a way post#1, i did not tried it with the Max7219 module), BUT
    the need to encode accents (ascii > 127) depends the way we use drawString on espruino.
    It's a bit annoying...
    Is there a way, to homogenize the way it works, with or without a graphicArrayBuffer? (i'm always use the example provided with modules)

    therefore it looks like more a wish list, than a real problem.
    Ok it's a problem only for non english people that use ascii over 127 ;)

    regards

    é.

  • in JavaScript
    Avatar for Mrbbp

    i answer myself

    if i don't use my string.replace it look good (with accents)
    it seems it's a pb with module.
    currently i work with TM1640 Module
    last week i was working with Max7219
    with the max's Module i use an arrayBuffer

    SPI2.setup({mosi:B15, sck:B13});
    var disp = require("MAX7219").connect(SPI2, B14);
    
    var g = Graphics.createArrayBuffer(8,8,1); // Create graphics
    g.flip = function() { disp.raw(g.buffer); }; // To send to the display
    
    g.drawString("Mémé");
    g.flip(); // update what's on the display
    

    with the arrayBuffer, accents must be encoded.

    But with the TM1640 Module, we drawString directly in the display

    var g = require("TM1640").connect({din: NodeMCU.D7, clk: NodeMCU.D5}, function() {
      g.drawString("Mémé");
      g.setContrast(2); // a value between `0` lowest and `7` highest intensity.
      g.flip();
    });
    

    is it the cause of the encoding pb?

    regards

  • in JavaScript
    Avatar for Mrbbp

    Hello,

    it should be a newb question... sorry.
    i'm working with a 8x8 led matrix
    I'm working with string with extented latin chars (éèêàâî,,,).
    to draw the string on the display with accents we have to convert accents with char hexa value.

    "mémé"

    become

    "m\xe9m\xe9"

    i'm a lazy guy and decide to convert the sentence when it's sent to matrix.
    i use this code;

    phrase = phrase.replace(/[^\x00-\x7F]/g, function(m) {
        return "\\x" + m.charCodeAt(0).toString(16);
    });
    

    it's look as it have to look, but the string is sent as is and i saw on the display "m\xe9m\xe9" and not "mémé" as it should.
    What i'have missed?

    regards

  • in General
    Avatar for Mrbbp

    So the problem persist, time to time... I suppose spi is asynchronous...
    Therfore I've added a reboot() at the end of each cycle (all text done and led cycle done)
    The spi is reinitialized and every thing look good. And there is no messe on the display.
    I suppose i can do in an other way by adding more time to the first line, it seems, it's at a restart (when substring displayed (my cursor) go back to beginning) which the prob issue.

    Thanks for your help.

  • in General
    Avatar for Mrbbp

    @allObjects why do you think it is a transcription from another langage?
    I use example provided in the max7219's module. And build in js. I iterate code writing step by step so the structure is durty (i'm pretty sure there is useless var)
    Yes i'm not dev, just designer, and therfore i'm not thinking as a dev. ;)

    I've rewrote with a setTimeout.
    If i well anderstand, there is no parallel process and instructions are worked one by one. Therefore if i restart a function at the end of the same function,it will restart after everythink is done. No?
    Except if spi transfer is asynchronous. Is it?

Actions