You are reading a single comment by @Jorgen and its replies. Click here to read the full conversation.
  • Ok, don't know why, but when I modify the flip by add 2px to the X and 3px to the Y it works...

    Line 11 + 13

    exports.connectPaletted = function(palette, spi, dc, ce, rst, callback) {
      var bits;
      if (palette.length>16) bits=8;
      else if (palette.length>4) bits=4;
      else if (palette.length>2) bits=2;
      else bits=1;
      var g = Graphics.createArrayBuffer(LCD_WIDTH, LCD_HEIGHT, bits, { msb:true });
      g.flip = function() {
        ce.reset();
        spi.write(0x2A,dc);
        spi.write(2,2,2,LCD_WIDTH+1);
        spi.write(0x2B,dc);
        spi.write(3,3,3,LCD_HEIGHT+2);
        spi.write(0x2C,dc);
        var lines = 16; // size of buffer to use for un-paletting
        var a = new Uint16Array(LCD_WIDTH*lines);
        for (var y=0;y<LCD_HEIGHT;y+=lines) {
          E.mapInPlace(new Uint8Array(g.buffer, y*LCD_WIDTH*bits/8, a.length), a, palette, bits);
          spi.write(a.buffer);
        }
        ce.set();
      };
      init(spi, dc, ce, rst, callback);
      return g;
    };
    

About

Avatar for Jorgen @Jorgen started