• So I did a manual remapping from the Graphics.buffer to the way my modules are chained:

    /*
    Graphics.buffer (not zigzag):
    00 01 02 03 04 05 06 07 08 09 10 11
    12 13 14 15 16 17 18 19 20 21 22 23 
    24 25 26 27 28 29 30 31 32 33 34 35
    36 37 38 39 40 41 42 43 44 45 46 47
    
    My module chained, three 4x4 modules horizontally:
    
    00 01 02 03  16 17 18 19  32 33 34 35
    07 06 05 04  23 22 21 20  39 38 37 36
    08 09 10 11  24 25 26 27  40 41 42 43
    15 14 13 12  31 30 29 28  47 46 45 44
    
    */
    

    And use this code, with a util function to copy the triplets of RGB per index:

    //
    var neopixel = require("neopixel");
    
    var leds = Graphics.createArrayBuffer(12,4,24,{zigz­ag:false}); 
    
    
    
    var getTriplet = function(array,index){
     
     index*=3;
      var result =[array[index],array[index+1],array[inde­x+2]];
      return result;
    };
    
    
    leds.flip = function() { 
      var rawBuffer = [];
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,0));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,1));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,2));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,3));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,15));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,14));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,13));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,12));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,24));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,25));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,26));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,27));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,39));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,38));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,37));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,36));
      //
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,4));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,5));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,6));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,7));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,19));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,18));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,17));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,16));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,28));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,29));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,30));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,31));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,43));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,42));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,41));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,40));
      //
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,8));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,9));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,10));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,11));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,23));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,22));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,21));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,20));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,32));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,33));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,34));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,35));
      
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,47));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,46));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,45));
      rawBuffer.push.apply(rawBuffer,getTriple­t(leds.buffer,44));
     
      neopixel.write(B15, rawBuffer); 
    };
    

    The above does the trick, but all of the array operations slowed down the performance quite a bit... :(

    Anybody know any tips on the best way for this kinds of operation?

About

Avatar for n00b @n00b started