• Hello (again),

    well, i apology for this stupid question, but i'm a bit confused with the use of arraybuffer.

    i'm working with a custom font, a slanted font design that need lot of process to write nicely on a screen.
    i've used a pdc8544 display for testing purpose, and i'm now satisfied by my customdrawString().

    my idea (and that perhaps the problem, i don't know)
    is to draw String (that need some process time) in a quite long arrayBuffer (for a sentence, between 20 and 60 chars) and copy a part of it on a display (a simple led matrix, 20mm with TM1640, or bigger with a max7219)

    my question is about copying a part of an arrayBuffer on the display.

    I saw bufferArrayView.slice but i'm in sort of panic, cause i do not understand any example i saw.
    In the MDN, it's to abstract for me!
    And i don't know how to use it!
    and it said, it produce a simple array... therefor how to transfer it to display (and it is here you laugh)

    if i drawString in a certain arrayBuffer, how to copy a part of this buffer (only 8x8) in an other (the display)?
    I can not do that.
    Sure, many of you will laugh at this, but that's how it is.

    I tried to use graphic.scroll () (as @MaBe, suggest in an other post) but it only scrolls the displayed pixels, so only the 8 pixels of the display.
    Even if I try to create a larger buffer let g = Graphics.createArrayBuffer(64,8,1);. (i suposse the display driver have his own buffer (8x8), that's why)
    It doesn't work.

    i certainly missed something...

    let g;
    
    function sendData() {
      // reset le buffer, ajoute la font, ecrit la chaine de caractères
      g.clear(); // efface le buffer (TM1640)
      g.setFont4x6();
      g.drawString("hello",0,0);
      g.setContrast(7); /* val entre 0 et 7 - TM1640*/
      // mise à jour du display
      g.flip();
      setTimeout(scroll, 1000);
    
    }
    function scroll() {
      g.scroll(-1,0);
      g.flip();
      setTimeout(scroll, 200);
    }
    
    function onInit() {
      require("Font4x6").add(Graphics);
      g = require("TM1640").connect({din: B15, clk: B13});
      setTimeout(sendData, 100);
    }
    

    would you have some compassion to explain to me how to do it?

    i'm able to drw in an arrayBuffer but not copy a part.

    thanks very much.

    é.


    1 Attachment

    • slanted.jpg
About

Avatar for Mrbbp @Mrbbp started