You are reading a single comment by @MaBe and its replies. Click here to read the full conversation.
  • this works excellent for Espruino

    var C = {
     OLED_WIDTH                 : 128,
     OLED_CHAR                  : 0x40,
     OLED_CHUNK                 : 128
    };
    WIDTH = 128;
    HEIGHT = 64;
    var buffer = new Uint8Array((WIDTH * HEIGHT)/ 8);
    bufferLen = buffer.length;
    var chunk = new Uint8Array(C.OLED_CHUNK+1);
    chunk[0] = C.OLED_CHAR;
    
    for (var p=0; p < bufferLen; p+=C.OLED_CHUNK) {
      console.log(p +"-"+(p+C.OLED_CHUNK));
      chunk.set(new Uint8Array(buffer,p,C.OLED_CHUNK), 1);
    }
    

    but anywhere else it causes something like "RangeError: Offset/length out of range" for chunk.

    Any suggestions how to rewrite this line

     chunk.set(new Uint8Array(buffer,p,C.OLED_CHUNK), 1);
    

    to work with other javascript engines ?

About

Avatar for MaBe @MaBe started