Avatar for Mrbbp

Mrbbp

Member since Mar 2017 • Last active Nov 2018
  • 12 conversations
  • 82 comments

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

Most recent activity

  • in Pico / Wifi / Original Espruino
    Avatar for Mrbbp

    well i've got the prob with my new pico (thx @Gordon, they arrived today). i've tried the Storage.getFree() but i've got an error

    Uncaught ReferenceError: "Storage" is not defined
     at line 5 col 22
      console.log(Storage.getFree());
    

    i've tried before without the console.log and received same error

  • 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

Actions